Commit graph

865 commits

Author SHA1 Message Date
Lothar Rubusch
e3b13ce84e doc: develop: Fix typos and wording in binman/binman.rst
Fix some typos and duplicate words in binman.rst.

Signed-off-by: Lothar Rubusch <l.rubusch@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
2025-01-05 02:30:48 +01:00
Tom Rini
5cfbf8c364 Prepare v2025.01-rc5
-----BEGIN PGP SIGNATURE-----
 
 iQGzBAABCgAdFiEEGjx/cOCPqxcHgJu/FHw5/5Y0tywFAmdqIAsACgkQFHw5/5Y0
 tyxmdAv/a0dUsibc2oyLJzRFioJO6ib0dro5EHiH1oyF3igOTGe1ifxeQyR/0bb8
 /3Qtr19f77INNjgQmRNpLbBfeoIMm3MeVF+zwQzEvUDEHNNQ0nnxu/yNnJB6Ebej
 xF/vdAP4JoV+KFQXMCMjIyFZcjZh4wGn1L1T8y7GQHS+p1zf0EYA7tPbk5rbwk/E
 xAFSymtWvOZVjLgV9YKp/RqS1+vGHaKydwzUZAncXJzeAMFD2Wm7mnDkd828U/eR
 7vs5BCnRwTgj7iWE6KXJUhFz2hrrBMFTEIV4GNW28vBSCoArlWshLbpKRolEoKY9
 i+dfkBDhghw9fVcTBOSP7BkiFwQl02jPB4Vf8G5ykK11CHO8XTpdjE5buGS1zsiW
 dTX9w4pynCl07p0qYsgGPYf2cE1k6dG6XFNUzH3owyNGiF+66VQeG05V79moQp9F
 ZF0/rux475UhZceXDImdecgkBDsc9gRvu0aX9ZYQtaBCgKJnQ8nyYPXGWZ/u0TSl
 1WVADGUq
 =4mOT
 -----END PGP SIGNATURE-----

Merge tag 'v2025.01-rc5' into next

Prepare v2025.01-rc5
2024-12-25 22:31:04 -06:00
Tom Rini
9378307136 binman: Regenerate tools/binman/entries.rst
There have been a few changes to the areas that this file documents
without having regenerated the file. Do so now.

Signed-off-by: Tom Rini <trini@konsulko.com>
2024-12-19 10:19:57 -06:00
Paul HENRYS
e7d7d3307c tools: binman: etype: fit: Append DTB directory to the list of input directories
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 <paul.henrys_ext@softathome.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
2024-12-19 09:10:34 -06:00
Paul HENRYS
a4345b1934 tools: binman: etype: Allow to replace 'NAME' in node names
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 <paul.henrys_ext@softathome.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
2024-12-19 09:10:34 -06:00
Paul HENRYS
f5c1b12267 tools: binman: Pass a list of input directory to EnsureCompiled()
Input directories can be passed to binman using the '-I' option and those
input directories are now also passed to 'dtc' when run by binman.

Signed-off-by: Paul HENRYS <paul.henrys_ext@softathome.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
2024-12-19 09:10:34 -06:00
Paul HENRYS
1a957ff5d4 tools: binman: Add tests for FIT with data encrypted by mkimage
Test the property 'fit,encrypt' to encrypt FIT data.

Signed-off-by: Paul HENRYS <paul.henrys_ext@softathome.com>
2024-12-19 09:10:34 -06:00
Paul HENRYS
e2cc9b4fc1 tools: binman: add 'fit, encrypt' property to pass keys directory to mkimage
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 <paul.henrys_ext@softathome.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
2024-12-19 09:10:34 -06:00
Rasmus Villemoes
bfbbd8472e imx: hab: fix size of IVT+CSF blob tacked on to u-boot.itb
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 89f19f45d6, except that this time
around I don't know how to cleanly get CONFIG_CSF_SIZE.

Fixes: bc6beae7c5 (binman: Add nxp_imx8mcst etype for i.MX8M flash.bin signing)
Signed-off-by: Rasmus Villemoes <ravi@prevas.dk>
Tested-by: Heiko Schocher <hs@denx.de>
2024-10-29 16:25:25 -03:00
Simon Glass
7f4e1ea00b binman: Add a tutorial on resolving test-coverage bugs
Provide a short description of how tests work, why they are so critical
and how to resolve gaps in Binman's test coverage.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>
2024-10-18 14:10:22 -06:00
Simon Glass
3473e1779c binman: Support getting test-coverage on just one test
Pass the arguments through to test_util so that a single test can be
used.

Update the docs and add some missing backquotes in the same section.

Signed-off-by: Simon Glass <sjg@chromium.org>
2024-10-18 14:10:22 -06:00
Alexander Kochetkov
133c000ca3 binman: implement signing FIT images during image build
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 <al.kochet@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Renumbered files, moved new tests to end:
Signed-off-by: Simon Glass <sjg@chromium.org>
2024-10-18 14:10:22 -06:00
Alexander Kochetkov
7c4e5223cb binman: fix passing loadables to mkimage on first run
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 <al.kochet@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
2024-10-18 14:10:22 -06:00
Brian Ruley
cd31c72872 binman: add fast authentication method for i.MX8M signing
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 <brian.ruley@gehealthcare.com>
Cc: Marek Vasut <marex@denx.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
2024-10-13 09:44:00 -03:00
Brian Ruley
784f84d5d8 binman: cosmetic: refactor `nxp_imx8mcst' etype code
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 <brian.ruley@gehealthcare.com>
Cc: Marek Vasut <marex@denx.de>
2024-10-13 09:44:00 -03:00
Tom Rini
c530f6079c Merge branch 'next' 2024-10-07 09:06:49 -06:00
Peter Robinson
af69289d61 Update directories for new name of TF-A directories
The TF-A URL was updated, as a result the name of the
directory changed as part of the new git URL and not
all the referenced directories were updated.

Fixes: 0ec0207fe0 ("Update the ARM trusted firmware git URL")
Signed-off-by: Peter Robinson <pbrobinson@gmail.com>
2024-10-04 09:00:47 -06:00
Peter Robinson
0ec0207fe0 Update the ARM trusted firmware git URL
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 <pbrobinson@gmail.com>
2024-10-03 09:08:29 -06:00
Simon Glass
ac0876c890 binman: Make a start on an iMX8 test
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 <sjg@chromium.org>
2024-09-26 12:40:31 +02:00
Simon Glass
a96dda1a70 binman: Allow image_pos to be None when writing symbols
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 <sjg@chromium.org>
2024-09-26 12:40:30 +02:00
Simon Glass
b73d0bb584 binman: Unwind the end-at-4gb special-case a little
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 <sjg@chromium.org>
2024-09-26 12:40:30 +02:00
Simon Glass
bce055338e binman: Provide a way to set the symbol base address
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 <sjg@chromium.org>
2024-09-26 12:40:30 +02:00
Simon Glass
01a609930b binman: Add minor improvements to symbol-writing
Add a clarification to the documentation and add a missing comment. Also
update the test so that when it fails it is easier to see what is going
on, rather than having to decode hex strings.

Signed-off-by: Simon Glass <sjg@chromium.org>
2024-09-26 12:40:30 +02:00
Simon Glass
f2154c30f6 binman: Adjust naming for reading symbols
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 <sjg@chromium.org>
2024-09-26 12:40:30 +02:00
Simon Glass
c8b7d72b43 binman: fit: Refine handling of devicetrees for OF_UPSTREAM
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 <sjg@chromium.org>
2024-09-26 12:40:30 +02:00
Simon Glass
6fac8e4883 binman: fit: Set the image_pos attributes only once
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 <sjg@chromium.org>
2024-09-26 12:40:30 +02:00
Simon Glass
a1fe67a58c binman: fit: Avoid assuming that a FIT member is a section
Use the more generic variable name 'entry' to avoid confusion.

Signed-off-by: Simon Glass <sjg@chromium.org>
2024-09-26 12:40:30 +02:00
Simon Glass
52983ff54b binman: Update fdt-list-dir to use the provided directory
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 <sjg@chromium.org>
2024-09-26 12:40:30 +02:00
Simon Glass
8498d550c5 binman: Avoid setting the image_pos attribute directly
Two places set this attribute directly. Update them to use the function
provided.

Signed-off-by: Simon Glass <sjg@chromium.org>
2024-09-26 12:40:30 +02:00
Simon Glass
fb428a63c1 binman: Tidy up comments and pylint warnings in fit
Update this entry type to resolve some pylint warnings and make sure
that functions and members are fully commented.

Signed-off-by: Simon Glass <sjg@chromium.org>
2024-09-26 12:40:30 +02:00
Simon Glass
be45bb941a binman: Tidy up comments for Entry.GetEntryArgsOrProps()
Improve the comments for this function.

Signed-off-by: Simon Glass <sjg@chromium.org>
2024-09-26 12:40:30 +02:00
Simon Glass
548e86198b binman: Correct the comment for fdtgrep
This returns stdout, not a CommandResult so update the comment.

Signed-off-by: Simon Glass <sjg@chromium.org>
2024-09-26 12:40:30 +02:00
Simon Glass
7d77ad9061 binman: Fix up test coverage for mkeficapsule
Add tests for missing tools to complete the test coverage for this
etype.

Signed-off-by: Simon Glass <sjg@chromium.org>
2024-09-26 12:40:30 +02:00
Tom Rini
19dbc09405 Prepare v2024.10-rc5
-----BEGIN PGP SIGNATURE-----
 
 iQGzBAABCgAdFiEEGjx/cOCPqxcHgJu/FHw5/5Y0tywFAmbomBcACgkQFHw5/5Y0
 tywNnAv/ZJ+EdFyNSPAWDnzFbuG5dnkkOHcgFofhqaoXCuswm3vLSO66v/MLGAgA
 LcHcwuF5IQ8RfEZOFXdhifuiEYqnEDyhK1UNXZUdhsgjbWslfSsJva1z2/3SjtOf
 WNOg6CCGeSlW0E/kW9smaxJ/sJmW2gphuNsUNa1sTlUQ+XFgtGwbcHZvdVfogwhN
 K3tmdHDNj3bFfrMON4OI9uu6qiZAmdYv42IxMxuw/1DuVzrJ/z+5ROA9wKKNOuxz
 6QwBITnUwSDs+nDIaGphjigMAHOhbK4HvTYZ0HcvmVxm44mTHgi0/PqXzbG58cM5
 jZydm4oGD1IZyXGrOrle4CfvF/vg0SvTwFlU5KqCQAmN1elqfG87Vce2OqJGW1Y8
 /HzoiiECWlC3ejj5tFg/0cr4xBT5GI8x4KeNJzT+VNwAbCUZY9JgxIABsVjEDeAF
 OKw/lYxlmBe1zn8X8Bc6BKH5ZOutCrqrRDTGq/yEWolRODKuLIyZkwH4sR0Wfm10
 W47S5AAu
 =c7Hz
 -----END PGP SIGNATURE-----

Merge tag 'v2024.10-rc5' into next

Prepare v2024.10-rc5
2024-09-16 14:48:13 -06:00
Tom Rini
ff994a3c2e binman: Update links for sending patches
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 <trini@konsulko.com>
2024-09-12 18:14:50 +02:00
Caleb Connolly
2bf0a87ae3 sandbox: switch to dynamic UUIDs
Migrate sandbox over to generating it's capsule update image GUIDs
dynamically from the namespace and board/image info. Update the
reference and tests to use the new GUIDs.

Acked-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Signed-off-by: Caleb Connolly <caleb.connolly@linaro.org>
2024-09-12 17:35:37 +02:00
Simon Glass
cbf3d274cf binman: Keep the efi_capsule input file
There is no need to remove input files. It makes it harder to diagnose
failures. Keep the payload file.

There is no test for this condition, but one could be added.

Signed-off-by: Simon Glass <sjg@chromium.org>
Acked-by: Sughosh Ganu <sughosh.ganu@linaro.org>
2024-08-05 12:15:29 -06:00
Simon Glass
2e658c1809 binman: Deal with mkeficapsule being missing
Tools cannot be assumed to be present. Add a check for this with the
mkeficpasule tool.

Signed-off-by: Simon Glass <sjg@chromium.org>
Fixes: b617611b27 ("binman: capsule: Add support for generating...")
2024-08-05 12:15:29 -06:00
Simon Glass
d0dbfd5299 binman: Collect the version number for mkeficapsule
Now that this tool has a version number, collect it.

Signed-off-by: Simon Glass <sjg@chromium.org>
2024-08-05 12:15:29 -06:00
Simon Glass
20e5399a31 Makefile: Pass OF_SPL_REMOVE_PROPS to binman
Pass CONFIG_OF_SPL_REMOVE_PROPS to binman so that it can remove
properties correctly when producing FITs for SPL phases.

Signed-off-by: Simon Glass <sjg@chromium.org>
2024-07-29 08:42:18 -06:00
Simon Glass
34d4a5df1b binman: fit: Allow running fdtgrep on devicetree blobs
When using FIT to load firmware builds for multiple models, the FIT must
include a common binary along with a number of devicetree blobs, one for
each model. This is the same mechanism as is used for loading an OS.

However, SPL builds do not normally use the full devicetree, but instead
a cut-down version which various nodes and properties removed.

Add a new fit,fdt-phase property to allow binman to produce these
devicetree blobs.

Signed-off-by: Simon Glass <sjg@chromium.org>
2024-07-29 08:42:18 -06:00
Simon Glass
57902e6941 binman: fit: Write the compatible string to configuration
FIT allows the FDT's root-node compatible string to be placed in a
configuration node to simplify and speed up finding the best match for
booting.

Add a new property to support this.

Signed-off-by: Simon Glass <sjg@chromium.org>
2024-07-29 08:42:18 -06:00
Simon Glass
9db7a3a432 binman: fit: Allow providing FDT filenames in a directory
In some cases the list of available FDT files is not available in an
entryarg. Provide an option to point to a directory containing them
instead.

Signed-off-by: Simon Glass <sjg@chromium.org>
2024-07-29 08:42:18 -06:00
Simon Glass
7081a94ea4 binman: Add support for alternative FDTs
FIT provides a way to select between different devicetree blobs
depending on the model. This works fine for U-Boot proper and allows SPL
to select the correct blob for the current board at runtime. The boot
sequence (SPL->U-Boot proper) is therefore covered by the existing
feature set.

The first boot phase (typically TPL) cannot use FIT since SoC boot ROMs
don't currently support it. Therefore the TPL image must be specific to
each model it boots on.

To support booting on mulitple models, binman must therefore produce a
separate TPL image for each model, even if the images for the rest of
the phases are identical.

TPL needs to be packaged as an executable binary along with a reduced
devicetree. When multiple models are supported, a reduced devicetree
must be provided for each model.

U-Boot's build system is designed to build a single devicetree for SPL
builds, so does not support this requirement.

Add a new 'alternatives' feature to Binman, allowing it to automatically
subset a devicetree to produce the reduced devicetree for a particular
phase for each supported model. With this it is possible to produce a
separate TPL image for each of the models. The correct one can then be
loaded onto a board, along with the common FIT image(s).

Signed-off-by: Simon Glass <sjg@chromium.org>
2024-07-29 08:42:18 -06:00
Simon Glass
daed9b42b4 binman: Allow entry types to override FDT contents
At present the contents of an FDT (for each phase) are fixed,
determined by the build and provided to Binman as input files.

Provide a means for entry types to provide their own FDT, so that it can
be processed, if needed.

Signed-off-by: Simon Glass <sjg@chromium.org>
2024-07-29 08:42:18 -06:00
Simon Glass
2e3697b954 binman: Remove dependency on pylibfdt for entry-docs
Allow the entry-docs command to operate even if pylibfdt is not present
in the systemn.

Signed-off-by: Simon Glass <sjg@chromium.org>
2024-07-29 08:42:18 -06:00
Simon Glass
76cbda76e7 binman: Add a bintool for fdtgrep
Binman needs the ability to run fdtgrep to prepare devicetree subsets
for use by SPL and TPL. Add a new bintool in preparation for this.

Signed-off-by: Simon Glass <sjg@chromium.org>
2024-07-29 08:42:18 -06:00
Simon Glass
a56ea60627 binman: Correct indentation in testSplPubkeyDtb
This function has strange indentation. Fix it.

Fixes: 8c1fbd1f60 ("binman: ftest: Add test for u_boot_spl_pubkey_dtb")

Signed-off-by: Simon Glass <sjg@chromium.org>
2024-07-29 08:42:18 -06:00
Simon Glass
57208ddc8c binman: Fix a comment typo in _DoReadFileDtb()
Fix a minor typo in this function.

Signed-off-by: Simon Glass <sjg@chromium.org>
2024-07-29 08:42:18 -06:00
Simon Glass
1900986446 binman: Mention expanded entries in u-boot-vpl
Add a comment about this entry type being expanded, to match the comment
for SPL and TPL. Drop an unwanted line in the SPL and TPL docs while
here.

Signed-off-by: Simon Glass <sjg@chromium.org>
2024-07-29 08:42:18 -06:00