summaryrefslogtreecommitdiff
path: root/tools/binman/etype
AgeCommit message (Collapse)Author
2026-03-18binman: DTS: Add dump-signature option for capsulesWojciech Dubowik
Mkeficapsule can dump signature for signed capsules. It can be used in test to validate signature i.e. with openssl. Add an entry for device tree node. Signed-off-by: Wojciech Dubowik <[email protected]> Reviewed-by: Simon Glass <[email protected]>
2026-03-18binman: Accept pkcs11 URI tokens for capsule updatesWojciech Dubowik
With pkcs11 support in mkeficapsule we can now accept URI tokens and not only files. Signed-off-by: Wojciech Dubowik <[email protected]> Reviewed-by: Simon Glass <[email protected]>
2025-12-10binman: blob_dtb: improve error message when SPL is not foundJérémie Dautheribes
When using binman with the '-a spl-dtb=y' flag, if the SPL blob is not found, binman throws a cryptic error message: binman: 'NoneType' object has no attribute 'startswith' Let's improve the error message to explicitly state which SPL blob is missing. This is particularly useful when binman is used as a standalone tool outside the U-Boot source tree. Signed-off-by: Jérémie Dautheribes <[email protected]> [trini: Add '# pragma: no cover' because coverage doesn't seem to like the documentation about this error] Signed-off-by: Tom Rini <[email protected]>
2025-12-06tools: binman: fit: add support for OpenSSL enginesQuentin Schulz
This adds support for using an OpenSSL engine for signing a FIT image. To use it, one should set the fit,engine property at the FIT node level with the engine to use. This will in turn call mkimage with the -N option. The -k argument to mkimage can be specified via fit,engine-keydir. If not specified, -k is not passed to mkimage. This property is especially useful for pkcs11 engine to specify slots, token label, etc... As far as I could tell, mkimage encrypts and signs a FIT in one go, thus the -k argument applies to both signing and encrypting. Considering we reuse the -k argument for two different meanings (info to pass to the engine when using an engine otherwise the directory where keys are stored), we cannot reasonably encrypt using local keys and signing with an engine, hence the enforced check. I believe it should be possible to support encrypting and signing with the same engine (using different key pairs of course, via different key-name-hint likely), but this is left for the next person to implement. This is why the property is named fit,engine and not fit,sign-engine. Ditto for fit,engine-keydir. The public key (with .crt extension) is still required if it needs to be embedded in the SPL DTB for example. We could probably support retrieving the public key from an engine, but this is a change to make to fdt_add_pubkey.c. Signed-off-by: Quentin Schulz <[email protected]>
2025-09-17binman: add a new entry type to support .bin file generation for the i.MX95 ↵Alice Guo
platform To support passing specific commands defined in enum imx8image_cmd to the imx8image_copy_image() function, this patch introduces a new entry type nxp-imx9image. This entry generates a plain text data file containing the relevant commands, enabling flexible configuration during image creation. Signed-off-by: Alice Guo <[email protected]>
2025-07-22binman: Fix typing for python >= 3.7Yannic Moog
To get the [] annotation working with python 3.7 and 3.8, import annotations. Reported-by: Tim Harvey <[email protected]> Fixes: 21bc3433a43d ("binman: rework dropping absent entries from packaged image") Reviewed-by: Bryan Brattlof <[email protected]> Signed-off-by: Yannic Moog <[email protected]> Tested-by: Tim Harvey <[email protected]>
2025-07-10binman: Add renesas_rcar4_sa0 etypeMarek Vasut
Add new etype which generates the Renesas R-Car Gen4 SA0 header. This header is placed at the beginning of SPI NOR and describes where should data from SPI NOR offset 0x40000 be loaded to, and how much data should be loaded there. In case of U-Boot, this is used to load SPL and possibly other payload(s) into RT-VRAM. Signed-off-by: Marek Vasut <[email protected]>
2025-07-01Merge patch series "binman: properly error out if path provided to ↵Tom Rini
key-name-hint in signature nodes" Quentin Schulz <[email protected]> says: I misunderstood the documentation and put the signing key in a keys/ directory while setting key-name-hint property in the signature node and u-boot-spl-pubkey-dtb to a path. mkimage doesn't fail if it cannot find the public key when signing a FIT but returns something on stderr to notify the user it couldn't find the key. The issue is that bintool currently discards stderr if the command successfully returns, so the FIT is not signed AND the user isn't made aware of it unless the image is manually inspected. mkimage does fail when trying to insert a public key in a DTB if it isn't found but we can have a better error message. Link: https://lore.kernel.org/r/[email protected]
2025-07-01binman: etype: u_boot_spl_pubkey_dtb: provide more explicit error for ↵Quentin Schulz
key-name-hint with path key-name-hint property in u-boot-spl-pubkey-dtb binman entry may contain a path instead of a filename due to user mistake. Because we currently assume it is a filename instead of a path, binman will find the full path to the key based on that path, and return the dirname of the full path but keeps the path in key-name-hint instead of stripping the directories from it. This means mkimage will fail with the following error message if we have key-name-hint set to keys/dev: binman: Error 1 running 'fdt_add_pubkey -a sha256,rsa2048 -k /home/qschulz/work/upstream/u-boot/keys -n keys/dev -r conf /home/qschulz/work/upstream/u-boot/build/ringneck/u-boot-spl-dtbdhsfx3mf': Couldn't open RSA certificate: '/home/qschulz/work/upstream/u-boot/keys/keys/dev.crt': No such file or directory Let's make it a bit more obvious what the error is by erroring out in binman if a path is provided in key-name-hint (it is named key-name-hint and not key-path-hint after all). Fixes: 5609843b57a4 ("binman: etype: Add u-boot-spl-pubkey-dtb etype") Signed-off-by: Quentin Schulz <[email protected]> Reviewed-by: Simon Glass <[email protected]>
2025-07-01binman: etype: fit: raise ValueError if key-name-hint is a pathQuentin Schulz
mkimage doesn't fail if it cannot find the public key but it prints to stderr. Considering that btool.run() discards stderr, it means binman happily returns an unsigned FIT and doesn't tell you something went wrong. Binman will actually find the file if there's a path in the key-name-hint property but the current logic expects key-name-hint to be a filename and thus returns the dirname of the found path for the key, but with the original key-name-hint appended. This means we can have the following: - key-name-hint = "keys/dev" - name = "/home/qschulz/work/upstream/u-boot/keys/" so we pass /home/qschulz/work/upstream/u-boot/keys/ to the -k option of mkimage but the FIT still contains "keys/dev" in key-name-hint which means mkimage will try to find the key at /home/qschulz/work/upstream/u-boot/keys/keys/, which doesn't exist. Let's assume paths are simply not supported (it is named key-name-hint and not key-path-hint after all) and raise an error if the property contains a path so that the build fails and not quietly. Fixes: 133c000ca334 ("binman: implement signing FIT images during image build") Signed-off-by: Quentin Schulz <[email protected]> Reviewed-by: Simon Glass <[email protected]>
2025-06-26Merge patch series "Fix handling of optional blobs in binman"Tom Rini
Yannic Moog <[email protected]> says: This series solves a contradiction regarding ext blobs packaged in binman. When they are marked as optional, by default they are faked, two messages are emitted. One says the image is not functional the other says the image is still functional. Both concern the same binman entry/blob. Binman is set up to have fake external blobs in case they are missing. This is regardless on whether they are optional or not. The implementation does not allow different types of entries to override the faking decision; at least there wouldn't be much sense in doing so. Here is an example build output of a phycore-imx8mp: BINMAN .binman_stamp Image 'image' is missing optional external blobs but is still functional: tee-os /binman/section/fit/images/tee/tee-os (tee.bin): See the documentation for your board. You may need to build Open Portable Trusted Execution Environment (OP-TEE) and build with TEE=/path/to/tee.bin Image 'image' has faked optional external blobs and is still functional: tee.bin OFCHK .config The output stays to inform/warn the user, but in this case the tee-os entry will not be present in the final image. Link: https://lore.kernel.org/r/[email protected]
2025-06-26binman: rework dropping absent entries from packaged imageYannic Moog
When blobs are absent and are marked as optional, they can be safely dropped from the binman tree. Use the drop_absent function for that. Rename drop_absent to drop_absent_optional as we do not want to drop any entries that are absent; they should be reported by binman as errors when they are missing. We also reorder the processing of the image the following: - We call the CheckForProblems function before the image is built. - We drop entries after we checked for problems with the image. This is okay because CheckForProblems does not look at the file we have written but rather queries the data structure (image) built with binman. This also allows us to get all error and warning messages that we want to report while avoiding putting missing optional entries in the final image. As only the blobs are dropped, the sections still remain in the assembled image. Thus add them to the expected test case checks where necessary. In addition, a rework of testPackTeeOsOptional test case is necessary. The test did not really do what it was supposed to. The description said that optional binary is tested, but the binary is not marked as optional. Further, the tee.elf file, when included in the image properly, also shows up in the image data. This must be added as well. As there is no global variable for the elf data, set the pathname to the elf file that was created when setting up the test suite. For the test case get the filename and read the contents, comparing them to the contents of the created binman image. Signed-off-by: Yannic Moog <[email protected]> Reviewed-by: Bryan Brattlof <[email protected]>
2025-06-26binman: mark optional missing blobs as absentYannic Moog
Optional blobs should mark themselves as absent to avoid being packed into an image. Extend the documentation of this behaviour. Although the documentation implied this before, the "optional" property had not been explained properly before. The behaviour will change as now absent entries are no longer packed into an image. The image map will also reflect this. As a result, the CheckForProblems() function will no longer alert on optional (blob) entries. This is because the missing optional images were removed before CheckForProblems is called. Adjust the testExtblobOptional test case to highlight that we are testing not only an optional image but the image is missing as well. The behaviour for these is different where the latter will not be packaged into the image. Reported-by: Simon Glass <[email protected]> Signed-off-by: Yannic Moog <[email protected]> Reviewed-by: Bryan Brattlof <[email protected]>
2025-06-26binman: drop "faked" return value from check_fake_fnameYannic Moog
check_fake_fname sets the faked member of the entry. Use that member to get the faked status instead of a returned value indicating the same. Add type annotations to the modified functions while at it. Signed-off-by: Yannic Moog <[email protected]> Reviewed-by: Simon Glass <[email protected]> Reviewed-by: Bryan Brattlof <[email protected]>
2025-06-25binman: openssl: disable JTAG access by defaultBryan Brattlof
Typically boards operating in production environments will not be monitored and so will not need JTAG access unlocked. Disable the debug extension by default (set debugType = 0) unless we add the 'debug' property in the binman configs. Acked-by: Andrew Davis <[email protected]> Signed-off-by: Bryan Brattlof <[email protected]>
2025-06-12binman: add atf-bl1 to etypesBryan Brattlof
Some SoCs require a Trusted Firmware-A (TF-A) AP Trusted ROM (BL1) to initialize the SoC before U-Boot can run properly. Add an atf-bl1 etype so we can properly package BL1 into a final binary Signed-off-by: Bryan Brattlof <[email protected]> Acked-by: Simon Glass <[email protected]>
2025-05-27binman: x86: Write skip-at-start when end-at-4gb is usedSimon Glass
The end-at-4gb property implies a value for skip-at-start so add it into the output FDT so that U-Boot can read it. Now that skip-at-start is implemented, we can drop the workarounds used in the x86 code to obtain the correct image-pos value. Signed-off-by: Simon Glass <[email protected]>
2025-05-03binman: add a new entry type for packing DDR PHY firmware imagesAlice Guo
i.MX95 needs to combine DDR PHY firmware images and their byte counts together, so add a new entry type nxp-header-ddrfw for this requirement. Signed-off-by: Alice Guo <[email protected]>
2025-04-11binman: fit: Drop unused codeSimon Glass
The key-name-hint case is not tested so is presumably not used. Drop it. Signed-off-by: Simon Glass <[email protected]>
2025-04-11binman: Drop GetRootSkipAtStart()Simon Glass
This method is not called anymore, so drop it. Signed-off-by: Simon Glass <[email protected]>
2025-03-10Merge tag 'v2025.04-rc4' into nextTom Rini
This uses Heinrich's merge of lib/efi_loader/efi_net.c which results in no changes.
2025-03-04binman: Honour the skip-at-start property more faithfullySimon Glass
A discussion on the mailing list about dealing with block offsets and binman symbols made me think that something is wrong with how Binman deals with the skip-at-start property. The feature was originally designed to handle x86 ROMs, which are mapped at the top of the address space. That seemed too specific, whereas skipping some space at the start seemed more generally useful. It has proved useful. For example, rockchip images start at block 64, so a skip-at-start of 0x8000 deals with this. But it doesn't actually work correctly, since the image_pos value does not give the actual position on the media. Fix this and update the documentation, moving it into the 'section' section. Signed-off-by: Simon Glass <[email protected]>
2025-03-04binman: Rename Entry.end_4gbSimon Glass
The property is named end_at_4gb so name the variable the same, to avoid confusion. Signed-off-by: Simon Glass <[email protected]>
2025-02-21tools: Fix pylint 3.3.4 errorsSimon Glass
This newer pylint produces errors about variables possibly being used before being set. Adjust the code to pass these checks. Signed-off-by: Simon Glass <[email protected]> Reported-by: Tom Rini <[email protected]>
2025-02-21tools: binman: ti_board_cfg: Fix pylint error over 'br'Tom Rini
With a newer pylint, we get a warning that 'br' could be used before assignment. Fix this by declaring br first as an empty bytearray. Reviewed-by: Neha Malcom Francis <[email protected]> Signed-off-by: Tom Rini <[email protected]>
2024-12-19tools: binman: etype: fit: Append DTB directory to the list of input directoriesPaul HENRYS
When specifying a directory containing DTBs with 'fit,fdt-list-dir', it can be handy not to have to also specify this directory to the input directories of binman with '-I' option and use the method tools.append_input_dirs() append it. This avoids to have to specify the DTB directory in both the device tree provided to binman and through '-I' option to binman. Signed-off-by: Paul HENRYS <[email protected]> Reviewed-by: Simon Glass <[email protected]>
2024-12-19tools: binman: etype: Allow to replace 'NAME' in node namesPaul HENRYS
This change allows to replace both 'SEQ' and 'NAME' keywords by respectively a sequence number and the name of the FDT to provide more flexibility in the node name for the device trees included in the FIT. Signed-off-by: Paul HENRYS <[email protected]> Reviewed-by: Simon Glass <[email protected]>
2024-12-19tools: binman: add 'fit, encrypt' property to pass keys directory to mkimagePaul HENRYS
mkimage can be used for both signing the FIT or encrypt its content and the option '-k' can be used to pass a directory where both signing and encryption keys can be retrieved. Adding 'fit,encrypt' property to the 'fit' node, leads to try to find keys directory among binman include directories. _get_priv_keys_dir() is renamed as _get_keys_dir() and adapted to support both signing and encryption nodes in the FIT. Signed-off-by: Paul HENRYS <[email protected]> Reviewed-by: Simon Glass <[email protected]>
2024-10-29imx: hab: fix size of IVT+CSF blob tacked on to u-boot.itbRasmus Villemoes
Loading flash.bin using uuu fails when flash.bin does not have the right size. When flash.bin is loaded from some storage medium (sd card/emmc), SPL just loads some random garbage bytes from beyond what has been populated when flash.bin was written, but when loaded via uuu, SPL hangs waiting for the host to send the expected number of bytes. Which is (size of FIT image aligned to 0x1000)+CONFIG_CSF_SIZE. The alignment to 0x1000 is already done and is necessary in all cases because that's the exact expected location of the 32 byte IVT header. But the IVT+CSF blob tacked onto the end must be a total of CONFIG_CSF_SIZE. This is exactly the same fix as 89f19f45d650, except that this time around I don't know how to cleanly get CONFIG_CSF_SIZE. Fixes: bc6beae7c55f (binman: Add nxp_imx8mcst etype for i.MX8M flash.bin signing) Signed-off-by: Rasmus Villemoes <[email protected]> Tested-by: Heiko Schocher <[email protected]>
2024-10-18binman: implement signing FIT images during image buildAlexander Kochetkov
The patch implement new property 'fit,sign' that can be declared at the top-level 'fit' node. If that option is declared, fit tryies to detect private keys directory among binman include directories. That directory than passed to mkimage using '-k' flag and that enable signing of FIT. Signed-off-by: Alexander Kochetkov <[email protected]> Reviewed-by: Simon Glass <[email protected]> Renumbered files, moved new tests to end: Signed-off-by: Simon Glass <[email protected]>
2024-10-18binman: fix passing loadables to mkimage on first runAlexander Kochetkov
FIT use mkimage from BuildSectionData() to build FIT entry contents. BuildSectionData() get called several times during building FIT image. Currently when fit inserts loadables, it use self._loadables property that contain loadables computed during previuos BuildSectionData() invocation. So for the first run it use empty list and pass no loadables to mkimage. That makes problem for adding signature to FIT image because mkimage fails to add signature and aborts building FIT if no loadables provided. The patch fixes described behaviour in a way that BuildSectionData() uses recently calculated loadables value, not previosly calculated. Signed-off-by: Alexander Kochetkov <[email protected]> Reviewed-by: Simon Glass <[email protected]>
2024-10-13binman: add fast authentication method for i.MX8M signingBrian Ruley
Using the PKI tree with SRKs as intermediate CA isn't necessary or even desirable in some situations (boot time, for example). Add the possibility to use the "fast authentication" method where the image and CSF are both signed using the SRK [1, p.63]. [1] https://community.nxp.com/pwmxy87654/attachments/pwmxy87654/imx-processors/202591/1/CST_UG.pdf Signed-off-by: Brian Ruley <[email protected]> Cc: Marek Vasut <[email protected]> Reviewed-by: Simon Glass <[email protected]>
2024-10-13binman: cosmetic: refactor `nxp_imx8mcst' etype codeBrian Ruley
Simplify code and conform to the style guide used in the project by making the following changes: * Capitalize global constants * Use single quotes for multiline strings (except docstrings) * Fix line width to 79 cols * Use f-string instead of formatting a regular string or using a complicated concatenation * Move common suffix used in keys to a global variable "KEY_NAME" to reduce the likelihood of typos and making future changes easier Signed-off-by: Brian Ruley <[email protected]> Cc: Marek Vasut <[email protected]>
2024-10-07Merge branch 'next'Tom Rini
2024-10-03Update the ARM trusted firmware git URLPeter Robinson
The primary upstream URL for tf-a has moved, in some cases things like tags are not always pushed to the old URL so update the URLs to the primary upstream project URL. Signed-off-by: Peter Robinson <[email protected]>
2024-09-26binman: Make a start on an iMX8 testSimon Glass
This patch is for Marek, to provide a starting point. To try it, use 'binman test -T' and see the missing coverage. Signed-off-by: Simon Glass <[email protected]>
2024-09-26binman: Allow image_pos to be None when writing symbolsSimon Glass
Some images do not have an image_pos value, for example an image which is part of a compressed section and therefore cannot be accessed directly. Handle this case, returning None as the value. Signed-off-by: Simon Glass <[email protected]>
2024-09-26binman: Unwind the end-at-4gb special-case a littleSimon Glass
Move the check for this further out, so that base_addr is computed in Entry.WriteSymbols() rather than at lower levels. Signed-off-by: Simon Glass <[email protected]>
2024-09-26binman: Provide a way to set the symbol base addressSimon Glass
The base address of the ELF containing symbols is normally added to any symbols written, so that the value points to the correct address in memory when everything is loaded. When the binary resides on disk, a different offset may be needed, typically 0. Provide a way to specify this. Signed-off-by: Simon Glass <[email protected]>
2024-09-26binman: Adjust naming for reading symbolsSimon Glass
These functions get the value of a symbol. The reference to ELF files is confusing since they are reading the position/size of entries, not ELF symbols. Rename the functions and adjust the comments also. Signed-off-by: Simon Glass <[email protected]>
2024-09-26binman: fit: Refine handling of devicetrees for OF_UPSTREAMSimon Glass
With OF_UPSTREAM the dts files are in an SoC-specific subdirectory, meaning that the resulting dtb files all end up in a similar subdirectory. We don't want the subdirectory name to appear as a node name in the FIT, so handle this as a special case. Also the default devicetree may have a directory-name prefix, so handle that when searching through the available devicetree files. Signed-off-by: Simon Glass <[email protected]>
2024-09-26binman: fit: Set the image_pos attributes only onceSimon Glass
The section etype has its own implementation of SetImagePos(), most of which is not useful since the code is included here. So call Entry.SetImagePos() which has the only piece of this which we actually want. Signed-off-by: Simon Glass <[email protected]>
2024-09-26binman: fit: Avoid assuming that a FIT member is a sectionSimon Glass
Use the more generic variable name 'entry' to avoid confusion. Signed-off-by: Simon Glass <[email protected]>
2024-09-26binman: Update fdt-list-dir to use the provided directorySimon Glass
Since the files are known to be in the provided directory, use that instead of requiring it to be added to the list of input directories. Signed-off-by: Simon Glass <[email protected]>
2024-09-26binman: Avoid setting the image_pos attribute directlySimon Glass
Two places set this attribute directly. Update them to use the function provided. Signed-off-by: Simon Glass <[email protected]>
2024-09-26binman: Tidy up comments and pylint warnings in fitSimon Glass
Update this entry type to resolve some pylint warnings and make sure that functions and members are fully commented. Signed-off-by: Simon Glass <[email protected]>
2024-09-26binman: Correct the comment for fdtgrepSimon Glass
This returns stdout, not a CommandResult so update the comment. Signed-off-by: Simon Glass <[email protected]>
2024-09-26binman: Fix up test coverage for mkeficapsuleSimon Glass
Add tests for missing tools to complete the test coverage for this etype. Signed-off-by: Simon Glass <[email protected]>
2024-09-16Merge tag 'v2024.10-rc5' into nextTom Rini
Prepare v2024.10-rc5
2024-09-12binman: Update links for sending patchesTom Rini
When linking to our documentation for submitting patches, we shouldn't point at the old wiki but instead our current documentation. Signed-off-by: Tom Rini <[email protected]>