summaryrefslogtreecommitdiff
path: root/tools/binman
AgeCommit message (Collapse)AuthorFilesLines
2022-01-13binman: Write fake blobs to the output directorySimon Glass4-11/+26
At present binman writes fake blobs to the current directory. This is not very helpful, since the files serve no useful purpose once binman has finished. They clutter up the source directory and affect future runs, since the files in the current directory are often used in preference to those in the board directory. To avoid these problems, write them to the output directory instead. Move the file-creation code to the Entry base class, so it can be used by any entry type that needs it. This is required since some entry types, such as Entry_blob_ext_list, are not subclasses of Entry_blob. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-01-13binman: Renumber the fake blob dtsSimon Glass2-10/+12
Use a unique number instead of the current 203, which is used by 203_fip as well. Reformat the code to avoid a long line. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-01-10Merge branch 'next'Tom Rini38-216/+2811
Signed-off-by: Tom Rini <trini@konsulko.com>
2022-01-07binman: add support for creating dummy files for external blobsHeiko Thiery9-8/+138
While converting to binman for an imx8mq board, it has been found that building in the u-boot CI fails. This is because an imx8mq requires an external binary (signed_hdmi_imx8m.bin). If this file cannot be found mkimage fails. To be able to build this board in the u-boot CI a binman option (--fake-ext-blobs) is introduced that can be switched on via the u-boot makefile option BINMAN_FAKE_EXT_BLOBS. With that the needed dummy files are created. Signed-off-by: Heiko Thiery <heiko.thiery@gmail.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2021-12-23fdt: Make it easier to debug u-boot.dtsi filesSimon Glass1-6/+8
At present one must hack the Makefile to see what is going on with these files. Also it doesn't quite work correctly. Fix this by using an environment variable for debugging. Update the docs also. Signed-off-by: Simon Glass <sjg@chromium.org>
2021-12-23fdt: Drop CONFIG_BINMAN_STANDALONE_FDTSimon Glass1-20/+0
This was added as a hack to work around not having an in-tree devicetree. Now that this is fixed it is not needed. Drop it. Signed-off-by: Simon Glass <sjg@chromium.org>
2021-12-17iot2050: binman: add missing-msg for blobsIvan Mikhaylov1-0/+11
Add the 'missing-msg' for blobs for more detailed output on missing system firmware and SEBoot blobs. Signed-off-by: Ivan Mikhaylov <ivan.mikhaylov@siemens.com> Reviewed-by: Simon Glass <sjg@chromium.org> Fix minor typos: Signed-off-by: Simon Glass <sjg@chromium.org>
2021-12-17binman: Use less hard coded magic when inserting new PATHAndy Shevchenko1-5/+7
Instead of joining hard coded '..' to the run-time path of the executable, take just a dirname out of it. Besides that, use $(srctree) where it makes sense. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
2021-12-17binman: Do not pollute source tree when build with `make O=...`Andy Shevchenko1-1/+12
Importing libraries in Python caches the bytecode by default. Since we run scripts in source tree it ignores the current directory settings, which is $(srctree), and creates cache just in the middle of the source tree. Move cache to the current directory. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
2021-12-17binman: Add support for ATF FIPSimon Glass13-0/+862
This format is used in firmware binaries so we may as well supported it. With this patch binman supports creating, listing and updating FIPs, as well as extracting files from one, provided that an FDTMAP is also present somewhere in the image. Signed-off-by: Simon Glass <sjg@chromium.org>
2021-12-17binman: Add a utility module for ATF FIPSimon Glass3-1/+1061
Add support for this format which is used by ARM Trusted Firmware to find firmware binaries to load. FIP is like a simpler version of FMAP but uses a UUID instead of a name, for each entry. It supports reading a FIP, writing a FIP and parsing the ATF source code to get a list of supported UUIDs. Signed-off-by: Simon Glass <sjg@chromium.org>
2021-12-05binman: Rename _ReadSubnodes() to ReadEntries()Simon Glass3-6/+6
This method name is more commonly used for this function. Use it consistently. Signed-off-by: Simon Glass <sjg@chromium.org>
2021-12-05binman: Support lists of external blobsSimon Glass6-3/+133
Sometimes it is useful to have a list of related external blobs in a single entry. An example is the DDR binaries used by meson. There are 9 files in total. Add support for this, so we don't have to have a separate entry for each. Signed-off-by: Simon Glass <sjg@chromium.org>
2021-12-05binman: Allow extracting a file in an alternative formatSimon Glass12-21/+193
In some cases entries encapsulate other data and it is useful to access the data within. An example is the fdtmap which consists of a 16-byte header, followed by a devicetree. Provide an option to specify an alternative format when extracting files. In the case of fdtmap, this is 'fdt', which produces an FDT file which can be viewed with fdtdump. Signed-off-by: Simon Glass <sjg@chromium.org>
2021-12-05binman: Allow listing an image created by a newer versionSimon Glass5-18/+74
If an older version of binman is used to list images created by a newer one, it is possible that it will contain entry types that are not supported. At present this produces an error. Adjust binman to use a plain 'blob' entry type to cope with this, so the image can at least be listed. Signed-off-by: Simon Glass <sjg@chromium.org>
2021-12-05binman: Allow providing tools and blob directoriesSimon Glass1-1/+30
At present it is necessary to symlink files containing external blobs into the U-Boot tree in order for binman to find them. This is not very convenient. Add two new environment/Makefile variables to help with this. Add documentation as well, fixing a related nit. Signed-off-by: Simon Glass <sjg@chromium.org>
2021-12-02binman: Rename testCbfsNoCOntents()Simon Glass1-1/+1
Use a lower-case O as was intended. Signed-off-by: Simon Glass <sjg@chromium.org>
2021-12-02binman: cfbs: Refactor ObtainContents() for consistencySimon Glass1-17/+23
Update this to use the same arguments as entry_Section uses. Signed-off-by: Simon Glass <sjg@chromium.org>
2021-12-02binman: cbfs: Refactor the init processSimon Glass1-2/+6
Update the constructor to work in the recommended way, where the node properties are read in a separate function. This makes it more similar to entry_Section. Signed-off-by: Simon Glass <sjg@chromium.org>
2021-12-02binman: Use normal entries in cbfsSimon Glass1-8/+8
This currently uses _cbfs_entries[] to store entries. Since the entries are in fact valid etypes, we may as well use the same name as entry_Section uses, which is _entries. This allows reusing more of the code there (in a future patch). Signed-off-by: Simon Glass <sjg@chromium.org>
2021-12-02binman: Move cbfs.ObtainContents() down a bitSimon Glass1-15/+15
It is easier to understand this file if reading the entries comes before obtaining the contents, since that is the order in which Binman proceeds. Move the function down a bit. Signed-off-by: Simon Glass <sjg@chromium.org>
2021-12-02binman: Update the section documentationSimon Glass2-55/+242
Expand this to explain subclassing better and also to tidy up formatting for rST. Fix a few pylint warnings to avoid dropping the score. Signed-off-by: Simon Glass <sjg@chromium.org>
2021-12-02binman: Allow control of which entries to readSimon Glass1-6/+7
The ObtainContents() and GetEntryContents() methods in this file read every single entry in the section. This is the common case. However when one of the entries has had its data updated (e.g. with 'binman replace') we don't want to read it again from the file. Allow the entry to be skipped, for this purpose. This is currently done in the CBFS implementation, so adding it here will allow that to use more of the entry_Section code. Signed-off-by: Simon Glass <sjg@chromium.org>
2021-12-02binman: Allow overriding BuildSectionData()Simon Glass2-5/+13
This method is currently marked private. However it is useful to be able to subclass it, since much of the entry_Section code can be reused. Rename it. Also document one confusing part of this code, so people can understand how to add a test for this case. Fix up a few pylint warnings to avoid regressing the score. Signed-off-by: Simon Glass <sjg@chromium.org>
2021-12-02binman: Drop the filename property in entry_SectionSimon Glass1-4/+1
This is not used and does nothing. Drop it. Add a tweak to avoid reducing the pylint score. Signed-off-by: Simon Glass <sjg@chromium.org>
2021-12-02binman: Drop the underscore in _ReadEntries()Simon Glass4-8/+8
This function can be overridden so should not have an underscore. Drop it. Signed-off-by: Simon Glass <sjg@chromium.org>
2021-12-02binman: Correct comments for ReadChildData()Simon Glass1-2/+3
The comment here is incomplete. Fix it. Signed-off-by: Simon Glass <sjg@chromium.org>
2021-12-02binman: Correct init of entry in Entry classSimon Glass1-1/+1
This should not have an underscore. Drop it so that derived classes can rely on it being set correctly. Signed-off-by: Simon Glass <sjg@chromium.org>
2021-12-02binman: Add a way to obtain the versionSimon Glass3-0/+67
Add a -V option which shows the version number of binman. For now this just uses a local 'version' file. Once the tool is packaged in some way we can figure out an approach that suits. Signed-off-by: Simon Glass <sjg@chromium.org>
2021-12-02binman: Tidy up style in cmdlineSimon Glass1-18/+27
Update this file to improve the pylint score a little. The remaining item is: Function name "ParseArgs" doesn't conform to snake_case naming style which needs some binman-wide renaming. Signed-off-by: Simon Glass <sjg@chromium.org>
2021-11-29binman: Fix extract command for using non-absolute image pathsJan Kiszka1-0/+1
Otherwise the updated image will end up in the temporary folder that is purged after completion. Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2021-11-14binman: Fix replace subcommand help and commentsJan Kiszka2-4/+4
Fix some copy&paste artifacts. Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
2021-11-13binman: Support updating the dtb in an ELF fileSimon Glass9-2/+216
WIth EFI we must embed the devicetree in an ELF image so that it is loaded as part of the executable file. We want it to include the binman definition in there also, which in some cases cannot be created until the ELF (u-boot) is built. Add an option to binman to support writing the updated dtb to the ELF file u-boot.out This is useful with the EFI app, which is always packaged as an ELF file. Signed-off-by: Simon Glass <sjg@chromium.org>
2021-11-13binman: Tidy up comments on _DoTestFile()Simon Glass1-0/+5
The comment for this function is missing an argument and the return value. Fix it. Signed-off-by: Simon Glass <sjg@chromium.org>
2021-11-13binman: Support reading the offset of an ELF-file symbolSimon Glass6-5/+131
Binman needs to be able to update the contents of an ELF file after it has been build. To support this, add a function to locate the position of a symbol's contents within the file. Fix the comments on bss_data.c and Symbol while we are here. Signed-off-by: Simon Glass <sjg@chromium.org>
2021-11-13binman: Report an error if test files fail to compileSimon Glass1-2/+6
At present any error from the 'make' command is silently swallowed by the test system. Fix this by showing it when detected. Signed-off-by: Simon Glass <sjg@chromium.org>
2021-10-31binman: Allow timeout to occur in the image or its sectionSimon Glass1-2/+1
At present testThreadTimeout() assumes that the expected timeout happens first when building the section, but it can just as easily happen at the top-level image. Update the test to cope with both. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Marek BehĂșn <marek.behun@nic.cz>
2021-10-18treewide: Remove OF_PRIOR_STAGEIlias Apalodimas1-10/+6
The previous patches removed OF_PRIOR_STAGE from the last consumers of the Kconfig option. Cleanup any references to it in documentation, code and configuration options. Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org> Reviewed-by: Simon Glass <sjg@chromium.org>
2021-10-03iot2050: Enable watchdog support, but do not auto-start itJan Kiszka1-0/+5
This allows to use the watchdog in custom scripts but does not enforce that the OS has to support it as well. Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
2021-09-24tools: Refactor full help printingPaul Barker1-6/+3
Collect the code for printing the full help message of patman, buildman and binman into a single function in patman.tools. Signed-off-by: Paul Barker <paul.barker@sancloud.com>
2021-07-21binman: Add basic support for debugging performanceSimon Glass4-0/+88
One of binman's attributes is that it is extremely fast, at least for a Python program. Add some simple timing around operations that might take a while, such as reading an image and compressing it. This should help to maintain the performance as new features are added. This is for debugging purposes only. Signed-off-by: Simon Glass <sjg@chromium.org>
2021-07-21binman: Use bytearray instead of stringSimon Glass2-3/+3
This is faster if data is being concatenated. Update the section and collection etypes. Signed-off-by: Simon Glass <sjg@chromium.org>
2021-07-21binman: Split node-reading out from constructor in filesSimon Glass1-0/+3
The constructor should not read the node information. Move it to the ReadNode() method instead. This allows this etype to be subclassed. Signed-off-by: Simon Glass <sjg@chromium.org>
2021-07-21binman: Support multithreading for building imagesSimon Glass8-6/+136
Some images may take a while to build, e.g. if they are large and use slow compression. Support compiling sections in parallel to speed things up. Signed-off-by: Simon Glass <sjg@chromium.org> (fixed to use a separate test file to fix flakiness)
2021-05-19binman: Support packaging U-Boot for scenarios like OF_BOARD or OF_PRIOR_STAGEBin Meng1-0/+24
For scenarios like OF_BOARD or OF_PRIOR_STAGE, no device tree blob is provided in the U-Boot build phase hence the binman node information is not available. In order to support such use case, a new Kconfig option BINMAN_STANDALONE_FDT is introduced, to tell the build system that a device tree blob containing binman node is explicitly required when using binman to package U-Boot. Signed-off-by: Bin Meng <bmeng.cn@gmail.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2021-05-19binman: Add support for RISC-V OpenSBI fw_dynamic blobBin Meng4-0/+57
Add an entry for RISC-V OpenSBI's 'fw_dynamic' firmware payload. Signed-off-by: Bin Meng <bmeng.cn@gmail.com> Reviewed-by: Simon Glass <sjg@chromium.org> Reviewed-by: Rick Chen <rick@andestech.com> Reviewed-by: Rick Chen <rick@andestech.com>
2021-05-19binman: test: Rename 172_fit_fdt.dts to 170_fit_fdt.dtsBin Meng2-5/+5
Currently there are 2 binman test cases using the same 172 number. It seems that 172_fit_fdt.dts was originally named as 170_, but commit c0f1ebe9c1b9 ("binman: Allow selecting default FIT configuration") changed its name to 172_ for no reason. Let's change it back. Signed-off-by: Bin Meng <bmeng.cn@gmail.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2021-05-19binman: Correct the comment for ATF entry typeBin Meng1-1/+1
This is wrongly referring to Intel ME, which should be ATF. Signed-off-by: Bin Meng <bmeng.cn@gmail.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2021-05-19binman: Correct '-a' description in the docBin Meng1-2/+2
It needs a space around '-a'. Signed-off-by: Bin Meng <bmeng.cn@gmail.com> Reviewed-by: Simon Glass <sjg@chromium.org> Reviewed-by: Rick Chen <rick@andestech.com>
2021-04-29binman: Support adding sections to FMAPsSimon Glass4-9/+50
When used with hierarchical images, use the Chromium OS convention of adding a section before all the subentries it contains. Signed-off-by: Simon Glass <sjg@chromium.org>