summaryrefslogtreecommitdiff
path: root/tools/binman
AgeCommit message (Collapse)AuthorFilesLines
2022-01-25binman: Enable bintool tests including cmdline processingSimon Glass2-3/+36
The tests rely on having at least 5 bintool implementions. Now that we have this, enable them. Add tests for the binman 'tool' subcommand. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-01-25binman: Add a bintool implementation for mkimageSimon Glass1-0/+80
Add a Bintool for this, which is used to build images for use by U-Boot. It supports the features needed by binman as well as installing via the u-boot-tools packages. Although this is built in the U-Boot tree, it is still useful to install a binary on the system. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-01-25binman: Add a bintool implementation for ifwitoolSimon Glass1-0/+166
Add a Bintool for this, which is used to build Intel IFWI images. It supports the features needed by the tests as well as downloading a binary from Google Drive. Although this is built in the U-Boot tree, it is not currently included with u-boot-tools, so it may be useful to install a binary on the system. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-01-25binman: Add a bintool implementation for futilitySimon Glass1-0/+178
Add a Bintool for this, which is used to sign Chrome OS images and build the Google Binary Block (GBB). It supports the features needed by binman as well as fetching a binary from Google Drive. Building it from source is possible but is left for another time, as it requires at least one other library. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-01-25binman: Add a bintool implementation for fiptoolSimon Glass1-0/+123
Add a Bintool for this, which is used to run FIP tests. It supports the features needed by the tests as well as building a binary from the git tree. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-01-25binman: Add a bintool implementation for cbfstoolSimon Glass1-0/+219
Add a Bintool for this, which is used to run CBFS tests. It supports the features needed by the tests as well as fetching a binary from Google Drive. Building it from source is very slow since it is not separately supported by the coreboot build system and it builds an entire gcc toolchain before starting. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-01-25binman: Add tests for bintoolSimon Glass2-0/+389
Add tests to cover the bintool functionality. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-01-25binman: Plumb in support for bintoolsSimon Glass6-1/+64
Support collecting the available bintools needed by an image, by scanning the entries in the image. Also add a command-line interface to access the basic bintool features, such as listing the bintools and fetching them if needed. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-01-25binman: Add support for bintoolsSimon Glass1-0/+421
Binman requires various tools to actually work, such as 'lz4' to compress data and 'futility' to sign Chrome OS firmware. At present these are handled in an ad-hoc manner and there is no easy way to find out what tools are needd to build an image, nor where to obtain them. Add an implementation of 'bintool', a base class which implements this functionality. When a bintool is required, it can be requested from this module, then executed. When the tool is missing, it can provide a way to obtain it. Note that this uses Command directly, not the tools.Run() function. This allows proper handling of missing tools and avoids needing to catch and re-raise exceptions. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-01-25binman: Add installation instructionsSimon Glass1-2/+25
Explain how to install binman, since it is not obvious. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-01-25binman: Correct path for fip_utilSimon Glass1-1/+1
This should be imported from the binman module. Fix it. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-01-25binman: Allow faked blobs in blob-ext-listSimon Glass5-1/+25
Since this is a list of blobs, each blob should have the ability to be faked, as with blob-ext. Update the Entry base class to set allow_fake and use the base class in the section code also, so that this propagagtes to blob-ext-list, which is not a section. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-01-25binman: Drop the image name from the fake-blob messageSimon Glass1-4/+3
This is not really needed and it makes the message different from the missing-blob message. Update it. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-01-25binman: Expand the external FIT test a littleSimon Glass2-1/+18
At present this does not check that the external data is in the expected place. Use a non-zero offset for the external data and check it. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-01-25binman: Tweak elf tests for a toolchain changeSimon Glass1-4/+4
Some newer toolchains do not create a symbol for the .ucode section that this test relies on. Update the test to use the symbol that is explicitly created, instead. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-01-25tools: Add init files for Python toolsSimon Glass1-0/+0
Add some empty __init__ files for binman, buildman and dtoc so that pylint is able to recognise these as Python modules and produce more useful pylint output. Signed-off-by: Simon Glass <sjg@chromium.org>
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>