summaryrefslogtreecommitdiff
path: root/tools/binman
AgeCommit message (Collapse)Author
2022-10-31Rename CONFIG_SYS_TEXT_BASE to CONFIG_TEXT_BASESimon Glass
The current name is inconsistent with SPL which uses CONFIG_SPL_TEXT_BASE and this makes it imposible to use CONFIG_VAL(). Rename it to resolve this problem. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-10-29binman: Add support for symlinking imagesNeha Malcom Francis
Adding support to symlink an image packaged using binman. Signed-off-by: Neha Malcom Francis <n-francis@ti.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2022-09-29treewide: Drop image_header_t typedefSimon Glass
This is not needed and we should avoid typedefs. Use the struct instead and rename it to indicate that it really is a legacy struct. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-09-21binman: Get futility by building itSimon Glass
A binary download is not great, since it depends on libraries being present in the system. Build futility from source instead. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-09-12binman: Add VPL supportSimon Glass
Add support for U-Boot's Verifying Program Loader phase. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-09-07Merge tag 'dm-pull-7sep22' of https://source.denx.de/u-boot/custodians/u-boot-dmTom Rini
binman fixes for bintool support
2022-09-04binman: allow user-defined filenames for mkimage entryQuentin Schulz
mkimage entry currently creates a file whose name is derived from the section name containing said entry. Let's allow the user to define a filename for the mkimage-generated binary by using the 'filename' DT property. Cc: Quentin Schulz <foss+uboot@0leil.net> Signed-off-by: Quentin Schulz <quentin.schulz@theobroma-systems.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2022-09-04binman: add support for skipping file concatenation for mkimageQuentin Schulz
Some image types handled by mkimage require the datafiles to be passed independently (-d data1:data2) for specific handling of each. A concatenation of datafiles prior to passing them to mkimage wouldn't work. That is the case for rkspi for example which requires page alignment and only writing 2KB every 4KB. This adds the ability to tell binman to pass the datafiles without prior concatenation to mkimage, by adding the multiple-data-files boolean property to the mkimage node. Cc: Quentin Schulz <foss+uboot@0leil.net> Signed-off-by: Quentin Schulz <quentin.schulz@theobroma-systems.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2022-09-01binman: bintool: bzip2: fix version function on non-Debian-based systemsQuentin Schulz
Upstream bzip2 1.0.x actually is stuck when running bzip2 -V and redirecting the output. This is fixed in Debian for about a decade already in https://git.launchpad.net/ubuntu/+source/bzip2/tree/debian/patches/20-legacy.patch?h=ubuntu/jammy and in bzip2 1.1.x (no release yet, see https://gitlab.com/bzip2/bzip2/-/commit/65179284ceddc43e6388bf4ed8c2d85cf16e1b2f ). Fedora notably does not have such a patch. Since bzip2 --help actually prints the version number too, let's use it instead so that binman works fine on (hopefully) all distributions. Fixes: 45aa2798008c ("binman: Add bzip2 bintool") Signed-off-by: Quentin Schulz <quentin.schulz@theobroma-systems.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2022-09-01binman: btool: futility: use Bintool.versionQuentin Schulz
Bintool.version can now be passed the binary argument to return the version text, so there's no need to override it in futility anymore. Signed-off-by: Quentin Schulz <quentin.schulz@theobroma-systems.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2022-09-01binman: btool: fiptool: use Bintool.versionQuentin Schulz
Bintool.version can now be passed the binary argument to return the version text, so there's no need to override it in fiptool anymore. Signed-off-by: Quentin Schulz <quentin.schulz@theobroma-systems.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2022-09-01binman: bintool: parametrize args to pass to binary for returning versionQuentin Schulz
The code to check the version is very similar between binaries, the most likely only needed variables are the regex to find the version (already supported) and the args to pass to the binary so that it prints this version (e.g. --version, -V or similar). Let's make it a parameter of Bintool so that code duplication can be avoided for simple changes. Signed-off-by: Quentin Schulz <quentin.schulz@theobroma-systems.com>
2022-09-01binman: btool: mkimage: use Bintool.versionQuentin Schulz
Bintool.version already contains everything required to get the version out of mkimage binary so let's not override it with its own implementation. Signed-off-by: Quentin Schulz <quentin.schulz@theobroma-systems.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2022-09-01binman: btool: lz4: use Bintool.versionQuentin Schulz
Bintool.version already contains everything required to get the version out of lz4 binary so let's not override it with its own implementation. Signed-off-by: Quentin Schulz <quentin.schulz@theobroma-systems.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2022-09-01binman: bintool: move version check implementation into bintool classQuentin Schulz
Version checking has nothing specific to compression/decompression tools so let's move it to the Bintool class. Signed-off-by: Quentin Schulz <quentin.schulz@theobroma-systems.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2022-09-01binman: btool: gzip: fix packer name so that binary can be foundQuentin Schulz
The binary is looked on the system by the suffix of the packer class. This means binman was looking for btool_gzip on the system and not gzip. Therefore, let's pass "gzip" as the name so that it can be found and used. Fixes: 0f369d79925a ("binman: Add gzip bintool") Signed-off-by: Quentin Schulz <quentin.schulz@theobroma-systems.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2022-08-26binman: Sort tests and rework test-file numbersStefan Herbrechtsmeier
Tests should be in order of the test-file numbers. Sort the tests according to the test-file numbers and rework the test-file numbers to eliminate duplicate numbers. Signed-off-by: Stefan Herbrechtsmeier <stefan.herbrechtsmeier@weidmueller.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2022-08-26binman: Document how to handle dependent imagesSimon Glass
Binman does not support this properly at present. Add documentation about it including a work-around. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-08-26binman: Mention split-elf in the main docsSimon Glass
Since we are talking about ATF, add mention of this new feature too. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-08-20binman: Add zstd bintoolStefan Herbrechtsmeier
Add zstd bintool to binman to support on-the-fly compression. Signed-off-by: Stefan Herbrechtsmeier <stefan.herbrechtsmeier@weidmueller.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2022-08-20binman: Add xz bintoolStefan Herbrechtsmeier
Add xz bintool to binman to support on-the-fly compression. Signed-off-by: Stefan Herbrechtsmeier <stefan.herbrechtsmeier@weidmueller.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2022-08-20binman: Add lzop bintoolStefan Herbrechtsmeier
Add lzop bintool to binman to support on-the-fly compression. Signed-off-by: Stefan Herbrechtsmeier <stefan.herbrechtsmeier@weidmueller.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2022-08-20binman: Add gzip bintoolStefan Herbrechtsmeier
Add gzip bintool to binman to support on-the-fly compression of Linux kernel images and FPGA bitstreams. The SPL basic fitImage implementation supports only gzip decompression. Signed-off-by: Stefan Herbrechtsmeier <stefan.herbrechtsmeier@weidmueller.com> Reviewed-by: Simon Glass <sjg@chromium.org> Rename the module and support this, since gzip.py is a system module: Signed-off-by: Simon Glass <sjg@chromium.org>
2022-08-20binman: Add bzip2 bintoolStefan Herbrechtsmeier
Add bzip2 bintool to binman to support on-the-fly compression. Signed-off-by: Stefan Herbrechtsmeier <stefan.herbrechtsmeier@weidmueller.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2022-08-20binman: Add BintoolPacker class to bintoolStefan Herbrechtsmeier
Add a bintools base class for packers which compression / decompression entry contents. Signed-off-by: Stefan Herbrechtsmeier <stefan.herbrechtsmeier@weidmueller.com> Reviewed-by: Simon Glass <sjg@chromium.org> Dropped dead/untested code in version(): Signed-off-by: Simon Glass <sjg@chromium.org>
2022-08-20binman: Add compression testsStefan Herbrechtsmeier
Add common test functions to test all supported compressions. Signed-off-by: Stefan Herbrechtsmeier <stefan.herbrechtsmeier@weidmueller.com> Reviewed-by: Simon Glass <sjg@chromium.org> Reviewed-by: Simon Glass <sjg@chromium.org>
2022-08-20binman: Support missing compression toolsStefan Herbrechtsmeier
Handle missing compression tools by returning empty data and record missing bintool. Signed-off-by: Stefan Herbrechtsmeier <stefan.herbrechtsmeier@weidmueller.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2022-08-20binman: Move compression bintool management into entry classStefan Herbrechtsmeier
Move management of the bintool to compress and decompress data into the entry class and add the bintool to the list of required bintools. Signed-off-by: Stefan Herbrechtsmeier <stefan.herbrechtsmeier@weidmueller.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2022-08-20binman: Select compression bintools in cbfs_util classStefan Herbrechtsmeier
Select the lz4 and lzma_alone bintools in cbfs_util class to centralize the supported compression algorithm evaluation inside the class and over multiple classes. Signed-off-by: Stefan Herbrechtsmeier <stefan.herbrechtsmeier@weidmueller.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2022-08-20binman: Move compression bintools creation into test setupStefan Herbrechtsmeier
Move compression bintools (packer) creation into test setup to reuse bintool objects between tests. Signed-off-by: Stefan Herbrechtsmeier <stefan.herbrechtsmeier@weidmueller.com> Reviewed-by: Simon Glass <sjg@chromium.org> Put comp_util import back in, since it is still needed here: Signed-off-by: Simon Glass <sjg@chromium.org>
2022-08-20binman: Remove obsolete compressed data header handlingStefan Herbrechtsmeier
Remove the obsolete compressed data header handling from the utilities to compress and decompress data. The header is uncommon, not supported by U-Boot and incompatible with external compressed artifacts. Signed-off-by: Stefan Herbrechtsmeier <stefan.herbrechtsmeier@weidmueller.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2022-08-20binman: Disable compressed data headerStefan Herbrechtsmeier
Disable the compressed data header of the utilities to compress and decompress data. The header is uncommon, not supported by U-Boot and incompatible with external compressed artifacts. The header was introduced as part of commit eb0f4a4cb402 ("binman: Support replacing data in a cbfs") to allow device tree entries to be larger than the compressed contents. Signed-off-by: Stefan Herbrechtsmeier <stefan.herbrechtsmeier@weidmueller.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2022-08-20binman: Add length header attribute to dtb entryStefan Herbrechtsmeier
Add an optional length header attribute to the device tree blob entry class based on the compressed data header from the utilities to compress and decompress data. If needed the header could be enabled with the following attribute beside the compress attribute: prepend = "length"; The header was introduced as part of commit eb0f4a4cb402 ("binman: Support replacing data in a cbfs") to allow device tree entries to be larger than the compressed contents. Regarding the commit "this is necessary to cope with a compressed device tree being updated in such a way that it shrinks after the entry size is already set (an obscure case)". This case need to be fixed without influence any compressed data by itself. Signed-off-by: Stefan Herbrechtsmeier <stefan.herbrechtsmeier@weidmueller.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2022-08-20binman: Add DecompressData function to entry classStefan Herbrechtsmeier
Add a DecompressData function to entry class to allow override in child classes and to centralize the compress and decompress in a single class. Signed-off-by: Stefan Herbrechtsmeier <stefan.herbrechtsmeier@weidmueller.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2022-08-20binman: Check only section data in multi section testStefan Herbrechtsmeier
Check only section data instead of the rest of the image in multi section test. Signed-off-by: Stefan Herbrechtsmeier <stefan.herbrechtsmeier@weidmueller.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2022-08-20binman: Collect bintools before usageStefan Herbrechtsmeier
Collect and thereby initialize bintools before any usage but after generation of entries. This is needed to handle bintools for compress and decompress like other bintools. Signed-off-by: Stefan Herbrechtsmeier <stefan.herbrechtsmeier@weidmueller.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2022-08-20binman: Forward AddBintools calls to base classStefan Herbrechtsmeier
Forward AddBintools calls to base class to collect bintools of base class. Signed-off-by: Stefan Herbrechtsmeier <stefan.herbrechtsmeier@weidmueller.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2022-08-20binman: Forward AddBintools calls to sub entries in cbfs_utilStefan Herbrechtsmeier
Forward AddBintools calls to sub entries in cbfs_util to collect bintools of sub entries. Signed-off-by: Stefan Herbrechtsmeier <stefan.herbrechtsmeier@weidmueller.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2022-08-20binman: Avoid duplicates in bintool listsStefan Herbrechtsmeier
Avoid duplicate entries in the list of bintools used by the image and the list of missing bintools. Signed-off-by: Stefan Herbrechtsmeier <stefan.herbrechtsmeier@weidmueller.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2022-08-20binman: Skip elf tests if python elftools is not availableStefan Herbrechtsmeier
Skip tests which requires python elftools if the tool is not available. Signed-off-by: Stefan Herbrechtsmeier <stefan.herbrechtsmeier@weidmueller.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2022-08-20binman: Allow collection to use entries from other sectionsSimon Glass
At present the collections etype only works with entries in the same section. This can be limiting, since in some cases the data may be inside a subsection, e.g. if there are alignment constraints. Add a function to find the entries in an etype and have it search recursively. Make use of this for mkimage also. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-08-20binman: Allow passing entries using -nSimon Glass
Also control over what goes in the file passed with -n using a separate imagename subnode. This can include a section or any other entry type. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-08-20binman: Allow the image name to be the data fileSimon Glass
Some image types use the -n parameter to pass in the data file. Add support for this, with a new property. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-08-20binman: Improve mkimage documentationSimon Glass
Expand this a little to make things clearer. Also drop the invalid entry arg. Series-changes 2 - Make it clear that -d data is concatenated/collected by binman - Fix mulitple typoe - Reword a sentence for grammar Signed-off-by: Simon Glass <sjg@chromium.org>
2022-08-20binman: Avoid use of expected failureSimon Glass
The testReplaceSectionSimple() test is the only one which expects failure. It looks odd in the output and takes time to glance at it to see that all is in fact well. Also it does not check that the right exception is generated. Use the more common (in binman) approach of checking for an exception. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-08-20binman: Adjust mkimage etype node readingSimon Glass
Since this is implemented as a section, it should really be split into several functions, one to read the node and one to read the entries. Do this so that it matches how Entry_section works. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-08-20binman: Add a way to check for missing propertiesSimon Glass
Some new entries are likely to have required properties. Support this in a standard way, with a list of required properties which can be set up by base classes. Check for missing properties when the entry is read. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-08-20binman: Fix up the entry-docs for Entry_pre_loadSimon Glass
This has got out of sync and needs a line wrap. Fix it. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-08-20binman: Put fake files in a subdirectorySimon Glass
At present fake files from a previous build appear to be real files for a subsequent build, since they sit in the output directory. This can cause problems, since binman may need to parse the file, e.g. with the Intel description.bin files. Fix this by putting them in a 'binman-fake' subdirectory. Keep a track of the fake filename so we only create it once. Subsequent builds will still see that the file is missing and mark it as fake. Update a few tests to check the behaviour. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-08-13binman: Add more documentation about binman usageSimon Glass
This is an attempt to answer the comments provided by Xavier [1]. [1] https://lore.kernel.org/all/Yulcol7HpTHtjXTX@begut/ Signed-off-by: Simon Glass <sjg@chromium.org> Acked-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>