aboutsummaryrefslogtreecommitdiff
path: root/tools/binman
AgeCommit message (Collapse)Author
2018-09-28binman: Add x86 support for starting TPLSimon Glass
Sometimes we want to include TPL for x86 platforms, such as when we want to select between different SPL images (e.g. for Chrome OS verified boot). Add support for this. Signed-off-by: Simon Glass <sjg@chromium.org>
2018-09-28binman: Generate an error when text is not providedSimon Glass
When the value of a text entry is not provided an execption is generated talking about a None type. This is confusing. Add a more explanatory error and a test for this case. Signed-off-by: Simon Glass <sjg@chromium.org>
2018-09-28binman: Allow 'fill' entry to have a size of 0Simon Glass
The check for this should be for None, not 0. Fix it and add a test. Signed-off-by: Simon Glass <sjg@chromium.org>
2018-09-28binman: Move 'special properties' docs to README.entriesSimon Glass
This information should be in the entry it relates to, not in the main README. Move it. Signed-off-by: Simon Glass <sjg@chromium.org>
2018-09-27binman: Add support for PowerPC mpc85xx 'bootpg + resetvec' entryJagdish Gediya
This entry contains the PowerPC mpc85xx boot page and resetvec sections. Signed-off-by: Jagdish Gediya <jagdish.gediya@nxp.com> Reviewed-by: Simon Glass <sjg@chromium.org> Reviewed-by: Bin Meng <bmeng.cn@gmail.com> Reviewed-by: York Sun <york.sun@nxp.com>
2018-09-27binman: Add a new "skip-at-start" property in Section classJagdish Gediya
Currently binman calculates '_skip_at_start' based on 'end-at-4gb' property and it is used for x86 images. For PowerPC mpc85xx based CPU, CONFIG_SYS_TEXT_BASE is the entry offset of the first entry. It can be 0xeff40000 or 0xfff40000 for nor flash boot, 0x201000 for sd boot etc, so "_skip_at_start" should be set to CONFIG_SYS_TEXT_BASE. 'end-at-4gb' property is not applicable where CONFIG_SYS_TEXT_BASE + Image size != 4gb. Add new property 'skip-at-start' in Section class so that '_skip_at_start' can be calculated either based on 'end-at-4gb' or based on "skip-at-start". Add a test case to check that 'skip-at-start' and 'end-at-4gb' property can't be used together. Signed-off-by: Jagdish Gediya <jagdish.gediya@nxp.com> Reviewed-by: Bin Meng <bmeng.cn@gmail.com> Reviewed-by: Simon Glass <sjg@chromium.org> Reviewed-by: York Sun <york.sun@nxp.com>
2018-09-18binman: fix a few typos in documentationMichael Heimpold
This fixes four small typos in the README file. Signed-off-by: Michael Heimpold <mhei@heimpold.de> Cc: Simon Glass <sjg@chromium.org> Reviewed-by: Bin Meng <bmeng.cn@gmail.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2018-08-01binman: Adjust _GetPropTree() parametersSimon Glass
At present this function takes a filename, but it is better to use an Fdt object so that the caller can control this, perhaps obtainint the device tree from a bytearray. Update the method accordingly and also fix a confusing parameter name. Signed-off-by: Simon Glass <sjg@chromium.org>
2018-08-01binman: Add a test to catch use of the old 'pos' propertySimon Glass
This property has been changed to 'offset'. To help downstream users who might still be using 'pos', add a check that this is not used by mistake. Signed-off-by: Simon Glass <sjg@chromium.org>
2018-08-01binman: Rename ReadContents() to ReadBlobContents()Simon Glass
This function name is too generic for its purpose and is therefore confusing. It actually only applies to blobs, so rename it to indicate this. Signed-off-by: Simon Glass <sjg@chromium.org>
2018-08-01binman: Show the image position in the mapSimon Glass
At present the map only shows the offset and size for each region. The image position provides the actual position of each entry in the image, regardless of the section hierarchy. Add the image position to the map. Signed-off-by: Simon Glass <sjg@chromium.org>
2018-08-01binman: Add support for adding TPL binariesSimon Glass
Add support for U-Boot's TPL and TPL device tree. Also fix a few comments in the other device-tree entries. Signed-off-by: Simon Glass <sjg@chromium.org>
2018-08-01binman: Add an entry for a Chromium vblockSimon Glass
This adds support for a Chromium verified boot block, used to sign a read-write section of the image. Signed-off-by: Simon Glass <sjg@chromium.org>
2018-08-01binman: Add support for Chromium GBBSimon Glass
This entry contains a Google Binary Block, used to store keys and bitmaps in a Chromium image. Signed-off-by: Simon Glass <sjg@chromium.org>
2018-08-01binman: Add an entry filled with a repeating byteSimon Glass
It is sometimes useful to have an area of the image which is all zeroes, or all 0xff. This can often be achieved by padding the size of an an existing entry and setting the pad byte for an entry or image. But it is useful to have an explicit means of adding blocks of repeating data to the image. Add a 'fill' entry type to handle this. Signed-off-by: Simon Glass <sjg@chromium.org>
2018-08-01binman: Add support for a cros_ec imageSimon Glass
Add an entry type which can hold a Chrome OS EC. To make this work a new entry type is created, which supports getting a blob filename from the command line. Signed-off-by: Simon Glass <sjg@chromium.org>
2018-08-01binman: Add support for flashrom FMAPSimon Glass
Add an entry which can hold an FMAP region as used by flashrom, an open-source flashing tool used on Linux x86 machines. This provides a simplified non-hierarchical view of the entries in the image and has a signature at the start to allow flashrom to find it in the image. Signed-off-by: Simon Glass <sjg@chromium.org>
2018-08-01binman: Create README.entriesSimon Glass
Create a new README containing documentation for the entry types supported by binman. This provides an easy reference in one place. It is automatically generated from the source-code documentation. Add a reference to this from the binman README. Signed-off-by: Simon Glass <sjg@chromium.org>
2018-08-01binman: Allow creation of entry documentationSimon Glass
Binman supports quite a number of different entries now. The operation of these is not always obvious but at present the source code is the only reference for understanding how an entry works. Add a way to create documentation (from the source code) which can be put in a new 'README.entries' file. Signed-off-by: Simon Glass <sjg@chromium.org>
2018-08-01binman: Expand documentation for entriesSimon Glass
At present only the more complex entries are documented. It is useful to have documentation for all entries in one place. As a first step, add and expand the documentation to cover all entries. Signed-off-by: Simon Glass <sjg@chromium.org>
2018-08-01binman: Allow help to work without libfdtSimon Glass
At present binman needs libfdt.py to be available before it will do anything, even print help. Import those modules later to avoid this, as it is bad practice to fail to even show help on startup. Signed-off-by: Simon Glass <sjg@chromium.org>
2018-08-01binman: Support an entry that holds textSimon Glass
It is useful to able to write an identifying string to the image within an entry. Add a 'text' entry type to handle this. The actual text is typically passed to binman on the command line. The text is not itself nul-terminated but this can be achieved if required by setting the size of the entry to something larger than the text. Signed-off-by: Simon Glass <sjg@chromium.org>
2018-08-01binman: Add support for passing arguments to entriesSimon Glass
Sometimes it is useful to pass binman the value of an entry property from the command line. For example some entries need access to files and it is not always convenient to put these filenames in the image definition (device tree). Add a -a option which can be used like this: -a<prop>=<value> where <prop> is the property to set <value> is the value to set it to Signed-off-by: Simon Glass <sjg@chromium.org>
2018-08-01binman: Add a new 'image-pos' propertySimon Glass
At present each entry has an offset within its parent section. This is useful for figuring out how entries relate to one another. However it is sometimes necessary to locate an entry within an image, regardless of which sections it is nested inside. Add a new 'image-pos' property to provide this information. Also add some documentation for the -u option binman provides, which updates the device tree with final entry information. Since the image position is a better symbol to use for the position of U-Boot as obtained by SPL, update the SPL symbols to use this instead of offset, which might be incorrect if hierarchical sections are used. Signed-off-by: Simon Glass <sjg@chromium.org>
2018-08-01binman: Enhance the map and fdt-update outputSimon Glass
At present the .map file produced for each image does not include the overall image size. This is useful information. Update the code to generate it in the .map file as well as the updated FDT. Also fix a few comments while we are here. Signed-off-by: Simon Glass <sjg@chromium.org>
2018-08-01binman: Tidy up some comments in the testsSimon Glass
A few lines are commented out and can be removed. Also fix return-value docs for _DoReadFile() and _DoReadFileDtb(). Signed-off-by: Simon Glass <sjg@chromium.org>
2018-08-01binman: Add comments to elf_testSimon Glass
The purpose of some of the tests is not obvious from the function names. Add a few comments to help with understanding. Signed-off-by: Simon Glass <sjg@chromium.org>
2018-08-01binman: Rename 'position' to 'offset'Simon Glass
After some thought, I believe there is an unfortunate naming flaw in binman. Entries have a position and size, but now that we support hierarchical sections it is unclear whether a position should be an absolute position within the image, or a relative position within its parent section. At present 'position' actually means the relative position. This indicates a need for an 'image position' for code that wants to find the location of an entry without having to do calculations back through parents to discover this image position. A better name for the current 'position' or 'pos' is 'offset'. It is not always an absolute position, but it is always an offset from its parent offset. It is unfortunate to rename this concept now, 18 months after binman was introduced. However I believe it is the right thing to do. The impact is mostly limited to binman itself and a few changes to in-tree users to binman: tegra sunxi x86 The change makes old binman definitions (e.g. downstream or out-of-tree) incompatible if they use the 'pos = <...>' property. Later work will adjust binman to generate an error when it is used. Signed-off-by: Simon Glass <sjg@chromium.org>
2018-08-01binman: Don't depend on dict order in ELF testOutsideFile()Simon Glass
At present this test assumes that the symbols are returned in address order. However, objdump can list symbols in any order and dictionaries do not guarantee any particular order when iterating through item. Update elf.GetSymbols() to return an OrderedDict, sorted by address, to avoid any problems. Signed-off-by: Simon Glass <sjg@chromium.org>
2018-07-09binman: Support updating the device tree with calc'd infoSimon Glass
It is useful to write the position and size of each entry back to the device tree so that U-Boot can access this at runtime. Add a feature to support this, along with associated tests. Signed-off-by: Simon Glass <sjg@chromium.org>
2018-07-09binman: Add a SetCalculatedProperties() methodSimon Glass
Once binman has packed the image, the position and size of each entry is known. It is then possible for binman to update the device tree with these positions. Since placeholder values have been added, this does not affect the size of the device tree and therefore the packing does not need to be performed again. Add a new SetCalculatedProperties method to handle this. Signed-off-by: Simon Glass <sjg@chromium.org>
2018-07-09binman: Add a ProcessFdt() methodSimon Glass
Some entry types modify the device tree, e.g. to remove microcode or add a property. So far this just modifies their local copy and does not affect a 'shared' device tree. Rather than doing this modification in the ObtainContents() method, and a new ProcessFdt() method which is specifically designed to modify this shared device tree. Move the existing device-tree code over to use this method, reducing ObtainContents() to the goal of just obtaining the contents without any processing, even for device tree. Signed-off-by: Simon Glass <sjg@chromium.org>
2018-07-09binman: Complete documentation of stagesSimon Glass
At present one of the stages is badly numbered and not described. Fix this. Signed-off-by: Simon Glass <sjg@chromium.org>
2018-07-09binman: Move capture_sys_output() to test_utilSimon Glass
This function is useful in various tests. Move it into the common test utility module. Signed-off-by: Simon Glass <sjg@chromium.org>
2018-07-09binman: Move coverage logic into a new test_util fileSimon Glass
At present only binman has the logic for determining Python test coverage but this is useful for other tools also. Move it out into a separate file so it can be used by other tools. Signed-off-by: Simon Glass <sjg@chromium.org>
2018-07-09binman: Tidy up setting of entry contentsSimon Glass
At present the contents of an entry are set in subclasses simply by assigning to the data and content_size properties. Add some methods to do this, so that we have more control. In particular, add a method to set the contents without changing its size, so we can validate that case. Add a test case for trying to change the size when this is not allowed. Signed-off-by: Simon Glass <sjg@chromium.org>
2018-07-09binman: Tidy up execution of testsSimon Glass
Move all the test execution into the same mechanism so that we can request a particular test (from any suite) by passing it as an argument to 'binman -t'. Signed-off-by: Simon Glass <sjg@chromium.org>
2018-07-09binman: Correct operation of ObtainContents()Simon Glass
This method is supposed to return the contents of an entry. However at present there is no check that it actually does. Also some implementations do not return 'True' to indicate success, as required. Add a check for things working as expected, and correct the implementations. This requires some additional test cases to cover things which were missed originally. Add these at the same time. Signed-off-by: Simon Glass <sjg@chromium.org>
2018-07-09binman: Tidy up variables in _RunMicrocodeTest()Simon Glass
At present we call the three entries first, second and third. Rename them to reflect their contents instead, for clarity. Signed-off-by: Simon Glass <sjg@chromium.org>
2018-07-09binman: Make the operation of Entry__testing explicitSimon Glass
This fake entry is used for testing. At present it only has one behaviour which is to return an invalid set of entry positions, to cause an error. The fake entry will need to be used for other things too. Allow the test .dts file to specify the behaviour of the fake entry, so we can control its behaviour easily. While we are here, drop the ReadContents() method, since this only applies to subclasses of Entry_blob, which Entry__testing is not. Signed-off-by: Simon Glass <sjg@chromium.org>
2018-07-09binman: Switch to 'python-coverage'Tom Rini
The most portable way to get access to coverage is to invoke it as 'python-coverage'. Cc: Simon Glass <sjg@chromium.org> Signed-off-by: Tom Rini <trini@konsulko.com> Signed-off-by: Simon Glass <sjg@chromium.org>
2018-06-07binman: Mark 'align-end' as implementedSimon Glass
The documentation says this is not implemented, but it is. Update the documentation, and clarify its operation. Signed-off-by: Simon Glass <sjg@chromium.org>
2018-06-07binman: Add support for adding a name prefix to entriesSimon Glass
Sometimes we have several sections which repeat the same entries (e.g. for a read-only and read-write version of the same section). It is useful to be able to tell these entries apart by name. Add a new 'name-prefix' property for sections, which causes all entries within that section to have a given name prefix. Signed-off-by: Simon Glass <sjg@chromium.org>
2018-06-07binman: Add support for outputing a map fileSimon Glass
It is useful to be able to see a list of regions in each image produced by binman. Add a -m option to output this information in a '.map' file alongside the image file. Signed-off-by: Simon Glass <sjg@chromium.org>
2018-06-07binman: Tidy up some docs and commentsSimon Glass
Fix a few missing comments and tidy up some existing ones. Signed-off-by: Simon Glass <sjg@chromium.org>
2018-06-07binman: Allow a single test to be executedSimon Glass
Provide an easy way to execute a single binman test by specifying it on the command line. Signed-off-by: Simon Glass <sjg@chromium.org>
2018-06-07binman: Add documentation for pos-unset propertySimon Glass
This property is not documented. Add a note to the README. Signed-off-by: Simon Glass <sjg@chromium.org>
2018-06-07binman: Add support for sectionsSimon Glass
It is useful to be able to split an image into multiple sections, each with its own size and position, for cases where a flash device has read-only and read-write portions. Add support for this. Signed-off-by: Simon Glass <sjg@chromium.org>
2018-06-07binman: Avoid setting sys.path globallySimon Glass
At present we set the Python path at the start of binman so we can read modules in the 'etype' directory. This is a bit messy since it affects 'import' statements through binman. Adjust the code to set the path locally, just where it is needed. Move the 'entry' module in with the other base modules to help with this. It makes more sense here anyway since it does not implement an entry type. Signed-off-by: Simon Glass <sjg@chromium.org>
2018-06-07binman: Rename Entry property to 'section'Simon Glass
Entries are now passed a Section object rather than an Image. Rename this property to avoid confusion. Signed-off-by: Simon Glass <sjg@chromium.org>