summaryrefslogtreecommitdiff
path: root/tools/binman
Commit message (Collapse)AuthorAgeFilesLines
* binman: Move to three-digit test-file numbersSimon Glass2018-10-09101-115/+115
| | | | | | | | We now have 99 tests. Before adding any more, rename everything to three digits. This helps to preserve the ordering of tests and makes it easier to find things. Signed-off-by: Simon Glass <sjg@chromium.org>
* binman: Run tests concurrentlySimon Glass2018-10-084-21/+48
| | | | | | | | | | | | | | | | | At present the tests run one after the other using a single CPU. This is not very efficient. Bring in the concurrencytest module and run the tests concurrently, using one process for each CPU by default. A -P option allows this to be overridden, which is necessary for code-coverage to function correctly. This requires fixing a few tests which are currently not fully independent. At some point we might consider doing this across all pytests in U-Boot. There is a pytest version that supports specifying the number of processes to use, but it did not work for me. Signed-off-by: Simon Glass <sjg@chromium.org>
* binman: Separate out testSplBssPad()Simon Glass2018-10-081-1/+3
| | | | | | | | At present this test runs binman twice, which means that the temporary files from the first run do not get cleaned up. Split this into two tests to fix this problem. Signed-off-by: Simon Glass <sjg@chromium.org>
* binman: Fix up removal of temporary directoriesSimon Glass2018-10-084-7/+18
| | | | | | | | | | At present 'make check' leaves some temporary directories around. Part of this is because we call tools.PrepareOutputDir() twice in some cases, without calling tools.FinaliseOutputDir() in between. Fix this. Signed-off-by: Simon Glass <sjg@chromium.org>
* binman: Add a default path to libfdt.pySimon Glass2018-10-081-0/+2
| | | | | | | | This module is often available in the sandbox_spl build created by 'make check'. Use this as a default path so that just typing 'binman -t' (without setting PYTHONPATH) will generally run the tests. Signed-off-by: Simon Glass <sjg@chromium.org>
* Merge git://git.denx.de/u-boot-dmTom Rini2018-09-3055-153/+1705
|\
| * binman: Allow writing a map file when something goes wrongSimon Glass2018-09-294-8/+46
| | | | | | | | | | | | | | | | | | | | | | When we get a problem like overlapping regions it is sometimes hard to figure what what is going on. At present we don't write the map file in this case. However the file does provide useful information. Catch any packing errors and write a map file (if enabled with -m) to aid debugging. Signed-off-by: Simon Glass <sjg@chromium.org>
| * binman: Support ELF files for U-Boot and SPLSimon Glass2018-09-296-0/+130
| | | | | | | | | | | | | | For sandbox we want to put ELF files in the image since that is what we need to execute. Add support for this. Signed-off-by: Simon Glass <sjg@chromium.org>
| * binman: Correct fmap output on x86Simon Glass2018-09-298-16/+121
| | | | | | | | | | | | | | | | | | | | | | | | | | Normally x86 platforms use the end-at-4gb option. This currently produces an FMAP with positions which have a large offset. The use of end-at-4gb is a useful convenience within binman, but we don't really want to export a map with these offsets. Fix this by subtracting the 'skip at start' parameter. Also put the code which convers names to fmap format, for clarity. Signed-off-by: Simon Glass <sjg@chromium.org>
| * binman: Record the parent section of each sectionSimon Glass2018-09-293-4/+9
| | | | | | | | | | | | | | | | | | | | At present sections have no record of their parent so it is not possible to traverse up the tree to the root and figure out the position of a section within the image. Change the constructor to record this information. Signed-off-by: Simon Glass <sjg@chromium.org>
| * binman: Support x86 microcode in TPLSimon Glass2018-09-299-21/+151
| | | | | | | | | | | | | | | | When TPL is used on x86 we may want to program the microcode (at least for the first CPU) early in boot. Add support for this by refactoring the existing code to be more generic. Signed-off-by: Simon Glass <sjg@chromium.org>
| * binman: Support hashing entriesSimon Glass2018-09-299-0/+143
| | | | | | | | | | | | | | | | Sometimesi it us useful to be able to verify the content of entries with a hash. Add an easy way to do this in binman. The hash information can be retrieved from the device tree at run time. Signed-off-by: Simon Glass <sjg@chromium.org>
| * binman: Mention section attributes in docsSimon Glass2018-09-291-2/+2
| | | | | | | | | | | | | | Images and sections have the same attributes, since an image is mostly just a top-level section. Update the docs to explain this. Signed-off-by: Simon Glass <sjg@chromium.org>
| * binman: Support expanding entriesSimon Glass2018-09-298-2/+136
| | | | | | | | | | | | | | It is useful to have entries which can grow automatically to fill available space. Add support for this. Signed-off-by: Simon Glass <sjg@chromium.org>
| * binman: Support adding filesSimon Glass2018-09-2916-0/+207
| | | | | | | | | | | | | | | | | | | | | | | | In some cases it is useful to add a group of files to the image and be able to access them at run-time. Of course it is possible to generate the binman config file with a set of blobs each with a filename. But for convenience, add an entry type which can do this. Add required support (for adding nodes and string properties) into the state module. Signed-off-by: Simon Glass <sjg@chromium.org>
| * binman: Allow zero-size sectionsSimon Glass2018-09-291-1/+1
| | | | | | | | | | | | | | | | | | | | | | At present if there is only a zero-size entry in a section this is reported as an error, e.g.: Offset 0x0 (0) is outside the section starting at 0x0 (0) Adjust the logic in CheckEntries() to avoid this. Signed-off-by: Simon Glass <sjg@chromium.org>
| * binman: Support compressed entriesSimon Glass2018-09-295-9/+105
| | | | | | | | | | | | | | | | Add support for compressing blob entries. This can help reduce image sizes for many types of data. It requires that the firmware be able to decompress the data at run-time. Signed-off-by: Simon Glass <sjg@chromium.org>
| * binman: Support updating all device tree filesSimon Glass2018-09-2813-21/+235
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Binman currently supports updating the main device tree with things like the position of each entry. Extend this support to SPL and TPL as well, since they may need (a subset of) this information. Also adjust DTB output files to have a .out extension since this seems clearer than having a .dtb extension with 'out' in the name somwhere. Also add a few missing comments and update the DT setup code to use ReadFile and WriteFile(). Signed-off-by: Simon Glass <sjg@chromium.org>
| * binman: Allow control of whether a fake DT is usedSimon Glass2018-09-284-2/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | We use a fake device tree in tests most of the time since tests don't normally care about the actual data. For example, for U-Boot proper we use U_BOOT_DTB_DATA which is just a four-character string. This makes testing the image output against an expected value very easy. However in some cases, such as when the test wants to check that the DT output containing particular nodes, we do actually need the real DT. Add support for this, along with a command-line option to select 'test mode'. Signed-off-by: Simon Glass <sjg@chromium.org>
| * binman: Obtain the list of device trees from the configSimon Glass2018-09-285-3/+46
| | | | | | | | | | | | | | | | We always have a device tree for U-Boot proper. But we may also have one for SPL and TPL. Add a new Entry method to find out what DTs an entry has, and use that list when updating DTs. Signed-off-by: Simon Glass <sjg@chromium.org>
| * binman: Centralise device-tree updates within binmanSimon Glass2018-09-283-8/+44
| | | | | | | | | | | | | | | | | | | | | | At present we have a few calls to device-tree functions in binman and plan to add more as we add new entry types which need to report their results. It makes sense to put this code in a central place so that we can make sure all device trees are updated. At present we only have U-Boot proper, but plan to add SPL and TPL too. Signed-off-by: Simon Glass <sjg@chromium.org>
| * binman: Move state logic into the state moduleSimon Glass2018-09-282-8/+56
| | | | | | | | | | | | | | Rather than reaching into this module from control, move the code that needs this info into state. Signed-off-by: Simon Glass <sjg@chromium.org>
| * binman: Move state information into a new moduleSimon Glass2018-09-285-48/+95
| | | | | | | | | | | | | | | | | | | | | | | | At present the control module has state information in it, since it is the primary user of this. But it is a bit odd to have entries and other modules importing control to obtain this information. It seems better to have a dedicated state module, which control can use as well. Create a new module using code from control and update other modules to use it. Signed-off-by: Simon Glass <sjg@chromium.org>
| * binman: Add an entry method for getting the default filenameSimon Glass2018-09-282-0/+8
| | | | | | | | | | | | | | | | Various entry implementations provide a way to obtain the default filename for an entry. But at present there is no base-class implementation for this function. Add one so that the API is defined. Signed-off-by: Simon Glass <sjg@chromium.org>
| * dtoc: Allow syncing of the device tree back to a fileSimon Glass2018-09-281-0/+2
| | | | | | | | | | | | | | | | | | | | | | At present we require the caller to manually update the device tree using individual calls to libfdt functions. This is not ideal. It would be better if we could make changes using the Python structure and then call a Sync() function to write them back. Add this feature to the Fdt class. Update binman and the tests to match. Signed-off-by: Simon Glass <sjg@chromium.org>
| * binman: Support building a selection of imagesSimon Glass2018-09-283-1/+29
| | | | | | | | | | | | | | | | | | Sometimes it is useful to build only a subset of the images provided by the binman configuration. Add a -i option for this. It can be given multiple times to build several images. If the option is not given, all images are built. Signed-off-by: Simon Glass <sjg@chromium.org>
| * binman: Tidy up the vblock entrySimon Glass2018-09-285-4/+43
| | | | | | | | | | | | | | | | | | | | | | At present if there are two vblock entries an image their contents are written to the same file in the output directory. This prevents checking the contents of each separately. Fix this by adding part of the entry path to the filename, and add some missing comments. Signed-off-by: Simon Glass <sjg@chromium.org>
| * binman: Add x86 support for starting TPLSimon Glass2018-09-284-1/+70
| | | | | | | | | | | | | | | | 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>
| * binman: Generate an error when text is not providedSimon Glass2018-09-282-0/+10
| | | | | | | | | | | | | | | | 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>
| * binman: Allow 'fill' entry to have a size of 0Simon Glass2018-09-283-1/+21
| | | | | | | | | | | | The check for this should be for None, not 0. Fix it and add a test. Signed-off-by: Simon Glass <sjg@chromium.org>
| * binman: Move 'special properties' docs to README.entriesSimon Glass2018-09-283-12/+7
| | | | | | | | | | | | | | 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>
* | binman: Add support for PowerPC mpc85xx 'bootpg + resetvec' entryJagdish Gediya2018-09-274-1/+62
| | | | | | | | | | | | | | | | | | | | 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>
* | binman: Add a new "skip-at-start" property in Section classJagdish Gediya2018-09-274-4/+49
|/ | | | | | | | | | | | | | | | | | | | | | | | | 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>
* binman: fix a few typos in documentationMichael Heimpold2018-09-181-4/+4
| | | | | | | | | 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>
* binman: Adjust _GetPropTree() parametersSimon Glass2018-08-011-9/+5
| | | | | | | | | 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>
* binman: Add a test to catch use of the old 'pos' propertySimon Glass2018-08-013-0/+19
| | | | | | | 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>
* binman: Rename ReadContents() to ReadBlobContents()Simon Glass2018-08-013-4/+4
| | | | | | | | 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>
* binman: Show the image position in the mapSimon Glass2018-08-014-19/+23
| | | | | | | | | | 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>
* binman: Add support for adding TPL binariesSimon Glass2018-08-017-6/+137
| | | | | | | 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>
* binman: Add an entry for a Chromium vblockSimon Glass2018-08-019-1/+259
| | | | | | | 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>
* binman: Add support for Chromium GBBSimon Glass2018-08-016-0/+221
| | | | | | | 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>
* binman: Add an entry filled with a repeating byteSimon Glass2018-08-015-0/+90
| | | | | | | | | | | 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>
* binman: Add support for a cros_ec imageSimon Glass2018-08-015-0/+108
| | | | | | | | | 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>
* binman: Add support for flashrom FMAPSimon Glass2018-08-017-2/+265
| | | | | | | | | 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>
* binman: Create README.entriesSimon Glass2018-08-012-0/+457
| | | | | | | | | | 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>
* binman: Allow creation of entry documentationSimon Glass2018-08-016-22/+118
| | | | | | | | | | | 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>
* binman: Expand documentation for entriesSimon Glass2018-08-0124-9/+305
| | | | | | | | | 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>
* binman: Allow help to work without libfdtSimon Glass2018-08-011-2/+5
| | | | | | | | 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>
* binman: Support an entry that holds textSimon Glass2018-08-013-0/+94
| | | | | | | | | | 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>
* binman: Add support for passing arguments to entriesSimon Glass2018-08-0110-4/+264
| | | | | | | | | | | | | | | | | | 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>