Commit graph

3753 commits

Author SHA1 Message Date
Simon Glass
ae94c3d4ee u_boot_pylib: Ensure subprocess is closed down
It isn't clear why we need to have two different paths for closing down
the pipe. Unify them and use the Python to avoid this warning:

  subprocess.py:1127: ResourceWarning: subprocess 83531 is still running

Note that this code appears to originally have come from [1] and was
committed into the ChromeOS chromiumos/platform/crosutils repo in the
bin/cros_image_to_target.py file. The addition of the extra code path
came later, so that is chosen for the fixes tag.

[1] https://codereview.chromium.org/3391008

Signed-off-by: Simon Glass <sjg@chromium.org>
Fixes: a10fd93cbc patman: Make command methods return a CommandResult
2023-11-02 22:38:01 -04:00
Simon Glass
a44cb1f240 buildman: Support upstream branch name containing /
Buildman assumes that branch names do not have a slash in them, since
slash is used to delimit remotes, etc. This means that a branch called
'WIP/tryme' in remote dm ends up being 'tryme'.

Adjust the logic a little, to try to accommodate this.

For now, no tests are added for this behaviour.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Tom Rini <trini@konsulko.com>
2023-11-02 22:38:01 -04:00
Neha Malcom Francis
a4ed4c8a51 binman: openssl: x509: ti_secure_rom: Add support for bootcore_opts
According to the TRMs of K3 platform of devices, the ROM boot image
format specifies a "Core Options Field" that provides the capability to
set the boot core in lockstep when set to 0 or to split mode when set
to 2. Add support for providing the same from the binman DTS. Also
modify existing test case for ensuring future coverage.

Signed-off-by: Neha Malcom Francis <n-francis@ti.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
2023-11-02 22:38:01 -04:00
Simon Glass
ad8dbabc22 buildman: Include symbols in the read-only data section
When symbols switch between the inited data section and the read-only
data section their visbility changes, at present, with the -B option.

This is confusing, since adding 'const' to a variable declaration can
make it look like a significant improvement in bloat. But in fact
nothing has changed.

Add 'r' to the list of symbols types that are recorded, to correct this
problem. Add a constant to make it easier to find this code next time.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reported-by: Tom Rini <trini@konsulko.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
2023-11-02 22:38:01 -04:00
Simon Glass
ce0e9e3990 binman: Move stage header into a CBFS attribute
cbfsutil completely changed the way that stages are formatted in CBFS.
Adjust the binman implementation to do the same.

This mirrors commit 81dc20e744 in coreboot.

Signed-off-by: Simon Glass <sjg@chromium.org>
2023-11-02 22:38:01 -04:00
Simon Glass
fe35c2f011 binman: Rename TYPE_STAGE to TYPE_LEGACY_STAGE
In preparation for changing how stages are stored, rename the existing
stage tag.

Signed-off-by: Simon Glass <sjg@chromium.org>
2023-11-02 22:38:01 -04:00
Simon Glass
ab326010a9 binman: Replace FILENAME_ALIGN 16 with ATTRIBUTE_ALIGN 4
cbfsutil changed to 4-byte alignment for filenames instead of 16.
Adjust the binman implementation to do the same.

This mirrors commit 5779ca718c in coreboot.

Signed-off-by: Simon Glass <sjg@chromium.org>
2023-11-02 22:38:01 -04:00
Simon Glass
e9199a74e0 binman: Ensure attributes always come last in the metadata
cbfsutil changed to write zero bytes instead of 0xff when a small
padding must be added. Adjust the binman implementation to do the same.

Drop the code which looks for an unused attribute tag, since it is not
used. A future patch moves the attributes to the end of the header in
any case, so no data will follow the attributes.

This mirrors commit f0cc7adb2f in coreboot.

Signed-off-by: Simon Glass <sjg@chromium.org>
2023-11-02 22:38:01 -04:00
Simon Glass
bd13255a91 binman: Don't add compression attribute for uncompressed files
cbfsutil changed to skip adding a compression attribute if there is no
compression. Adjust the binman implementation to do the same.

This mirrors commit 105cdf5625 in coreboot.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Neha Malcom Francis <n-francis@ti.com>
2023-11-02 22:37:50 -04:00
Simon Glass
823f5c3a02 binman: Reset missing bintools after testing
For tests which fake bintools being missing, we need to reset the list
afterwards, to ensure that future tests do not also see the bintools as
missing.

Reset the list when processing is complete.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Neha Malcom Francis <n-francis@ti.com>
2023-11-02 09:38:54 -06:00
Maxim Cournoyer
a13af89e10 patman: Add a 'keep_change_id' setting
A Change-Id can be useful for traceability purposes, and some projects
may wish to have them preserved.  This change makes it configurable
via a new 'keep_change_id' setting.

Signed-off-by: Maxim Cournoyer <maxim.cournoyer@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
2023-11-02 09:38:54 -06:00
Heinrich Schuchardt
54024c8021 tools: mkimage: fix sfspl_image_extract_subimage()
Do not leak file descriptor if writing fails.
Correct the error text if opening a file fails.

Addresses-Coverity-ID: 467054 Resource leaks
Fixes: 64fd30d367 ("tools: mkimage: Add StarFive SPL image support")
Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
2023-10-30 15:32:49 -04:00
Simon Glass
2f34b0331a patman: Add a little documentation on the checkpatch tests
These texts lack comments. Add some so that it is clearer what is going
on.

Signed-off-by: Simon Glass <sjg@chromium.org>
2023-10-24 16:34:45 -04:00
Tom Rini
a8384f8da1 checkpatch.pl: Make common.h check boarder
At this point in time we should not add common.h to any new files, so
make checkpatch.pl complain.

Signed-off-by: Tom Rini <trini@konsulko.com>
Signed-off-by: Simon Glass <sjg@chromium.org>
2023-10-24 16:34:45 -04:00
Sughosh Ganu
74aae507bc binman: capsule: Add support for generating EFI empty capsules
Add support in binman for generating EFI empty capsules. These
capsules are used in the FWU A/B update feature. Also add test cases
in binman for the corresponding code coverage.

Signed-off-by: Sughosh Ganu <sughosh.ganu@linaro.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
2023-10-13 14:01:42 -06:00
Sughosh Ganu
f1c8fc5e67 btool: mkeficapsule: Add support for EFI empty capsule generation
Add a method to the mkeficapsule bintool to generate empty
capsules. These are capsules needed for the FWU A/B update feature.

Signed-off-by: Sughosh Ganu <sughosh.ganu@linaro.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
2023-10-13 14:01:42 -06:00
Sughosh Ganu
809f28e721 binman: capsule: Use dumped capsule header contents for verification
The various fields of a generated capsule are currently verified
through hard-coded offsets. Use the dump-capsule feature for dumping
the capsule header contents and use those for capsule verification.

Signed-off-by: Sughosh Ganu <sughosh.ganu@linaro.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
2023-10-13 14:01:42 -06:00
Sughosh Ganu
bb8f892052 binman: capsule: Remove superfluous [address, size]-cells properties
The #address-cells and #size-cells are not needed for running the
capsule generation binman tests. Remove the superfluous properties.

Signed-off-by: Sughosh Ganu <sughosh.ganu@linaro.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
2023-10-13 14:01:42 -06:00
Sughosh Ganu
6984077de0 tools: mkeficapsule: Add support to print capsule headers
Add support to dump the contents of capsule headers. This is useful as
a debug feature for checking the contents of the capsule headers, and
can also be used in capsule verification.

Signed-off-by: Sughosh Ganu <sughosh.ganu@linaro.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
2023-10-13 14:01:42 -06:00
Lukas Funke
bff16109e3 binman: bintool: Change make target arg type from string to list
The argument type of `build_from_git` was changed from string to list
in d71e711699.

This commit adapts the argument type of all bintools using this
function.

Signed-off-by: Lukas Funke <lukas.funke@weidmueller.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Tested-by: Simon Glass <sjg@chromium.org>
2023-10-13 10:15:41 -07:00
Tom Rini
429d59c3e5 Revert "mkimage: update man page and -h output"
This is part of a longer series, which isn't quite ready.  Revert this
for now at least.

This reverts commit 4cb6c8e5f0.

Signed-off-by: Tom Rini <trini@konsulko.com>
2023-10-11 15:32:39 -04:00
Rasmus Villemoes
4cb6c8e5f0 mkimage: update man page and -h output
The man page correctly said that -B was ignored without -E, while the
`mkimage -h` output suggested otherwise. Now that -B can actually be
used by itself, update the man page.

While at it, also amend the `mkimage -h` line to mention the
connection with -E.

The FDT header is a fixed 40 bytes, so its size cannot (and is not)
modified, while its alignment is a property of the address in RAM one
loads the FIT to, so not something mkimage can affect in any way. (In
the file itself, the header is of course at offset 0, which has all
possible alignments already.)

Reported-by: Sean Anderson <seanga2@gmail.com>
Signed-off-by: Rasmus Villemoes <rasmus.villemoes@prevas.dk>
Reviewed-by: Simon Glass <sjg@chromium.org>
2023-10-11 13:22:32 -04:00
Roman Azarenko
0cf1a136d8 tools: ensure zeroed padding in external FIT images
Padding the header of an external FIT image is achieved by truncating
the existing temporary FIT file to match the required alignment before
appending image data. Reusing an existing file this way means that the
padding will likely contain a portion of the original data not
overwritten by the new header.

Zero out any data past the end of the new header, and stop at either
the end of the desired padding, or the end of the old FIT file,
whichever comes first.

Fixes: 7946a814a3 ("Revert "mkimage: fit: Do not tail-pad fitImage with external data"")
Signed-off-by: Roman Azarenko <roman.azarenko@iopsys.eu>
Reviewed-by: Simon Glass <sjg@chromium.org>
2023-10-11 13:22:32 -04:00
Lars Feyaerts
4860ee9b09 mkimage: allow internalization of data-position
Make it possible for data that was externalized using a static external
position (-p) to be internalized. Enables the ability to convert
existing FIT images built with -p to be converted to a FIT image where the
data is internal, to be converted to a FIT image where the data is
external relative to the end of the FIT (-E) or change the initial
static external position to a different static external position (-p).

Removing the original external-data-related properties ensures that
they're not present after conversion. Without this, they would still be
present in the resulting FIT even if the FIT has been, for example,
internalized.

Signed-off-by: Lars Feyaerts <lars@bitbiz.be>
Reviewed-by: Simon Glass <sjg@chromium.org>
2023-10-11 10:35:24 -04:00
Jan Kiszka
47e7f128c4 tools: iot2050-sign-fw.sh: Make localization of tools dir more robust
When building in-tree, there is no source link.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
2023-10-09 15:24:31 -04:00
Tom Rini
25453dcf0d moveconfig: enhance output; rename to qconfig
-----BEGIN PGP SIGNATURE-----
 
 iQFFBAABCgAvFiEEslwAIq+Gp8wWVbYnfxc6PpAIreYFAmUdp2ARHHNqZ0BjaHJv
 bWl1bS5vcmcACgkQfxc6PpAIreb9aggArQ9wh13E/diV35yLa0fRR/tLzfoazheW
 IEIeitXOTO11pmBJnzKkwo/eH8NRvhad/7S0xOOJLcjwyNU8rt1Wleg24ZNXVncn
 z0ryoHphoxmLDbFTcWmHRkaEL8ECtFC8N6gsN3uBnqP43GcWyWGq0FO9/PNZ/ZrH
 FCKh/TORq7Ybi7pnwFVbgewMQgo7nCRkKSWhWV2lL35RtYzKW6FCz6H+70q4gRmR
 J/CFqpyAkEc73fzMxAnLnegTUnPbJpy6+enSYK3ZpnXX4SshbY95lcmMYLEftPMS
 FTizDl/C3WT0mKt61pZa49D+fkfZARrZpL+steP6BWuECnkW4I1Uyw==
 =AOrV
 -----END PGP SIGNATURE-----

Merge tag 'dm-pull-4oct23' of https://source.denx.de/u-boot/custodians/u-boot-dm

moveconfig: enhance output; rename to qconfig
2023-10-04 18:49:58 -04:00
Simon Glass
519637929b qconfig: Rename the database file
Use qconfig.db as the new name, to reflect the tool's purpose.

Signed-off-by: Simon Glass <sjg@chromium.org>
2023-10-04 09:25:22 -06:00
Simon Glass
ea4d6dead3 moveconfig: Rename the tool to qconfig
This does not move configs anymore, but queries them, based on a database
it can build. Rename the tool to better reflect its purpose.

Signed-off-by: Simon Glass <sjg@chromium.org>
2023-10-04 09:25:21 -06:00
Simon Glass
94e2ed7c8e moveconfig: Move summaries to the end
Write the summary for -s and -b at the end, using a unified format.

Signed-off-by: Simon Glass <sjg@chromium.org>
2023-10-04 09:25:21 -06:00
Simon Glass
fc07d99e6a moveconfig: Drop the initial output
Since moveconfig now just does what it is told (build database or sync
defconfigs) we don't need to print what it is doing. Drop this info, which
is of very little use.

Signed-off-by: Simon Glass <sjg@chromium.org>
2023-10-04 09:25:21 -06:00
Simon Glass
dc1d2e6c7f moveconfig: Show a summary at the end
Rather than printing all the failed boards, which are now easily visible
on the terminal, just show a summary. Sort it by defconfig and drop the
'_defconfig' suffix.

Signed-off-by: Simon Glass <sjg@chromium.org>
2023-10-04 09:25:21 -06:00
Simon Glass
6b25d21c86 moveconfig: Show failures in progress
Show the number of accumulated failures when processing. Use a shorter
format with colour.

An unwanted space appears before the defconfig name on every item except
the last. Fix that while we are here.

Signed-off-by: Simon Glass <sjg@chromium.org>
2023-10-04 09:25:21 -06:00
Simon Glass
15f19ab501 moveconfig: Use u_boot_pylib for terminal colour
Use the existing terminal code to handle ANSI colours. Enable colour by
default if the output is going to a terminal.

Signed-off-by: Simon Glass <sjg@chromium.org>
2023-10-04 09:25:21 -06:00
Simon Glass
95f0914ee8 moveconfig: Avoid showing progress at the end
When the process is finished, moveconfig leaves a line saying that all
boards were processed (for better or worse). Drop this, since it is
unncessary.

Future work will provide a summary at the end instead.

Signed-off-by: Simon Glass <sjg@chromium.org>
2023-10-04 09:25:21 -06:00
Simon Glass
9461bf0d65 moveconfig: Reduce the amount of output
Output a single line in the case where the defconfig only has one line
of output. Show the name without the _defconfig suffix, since that is the
same for all boards.

Use a list for the log so it is easier to process at the end.

Signed-off-by: Simon Glass <sjg@chromium.org>
2023-10-04 09:25:21 -06:00
Simon Glass
5aba58cf3b moveconfig: Only show output when there is a reason
There is no point in listing a board if everything went well. It makes it
harder to see the failures, particularly on a fast machine.

Suppress output unless something actually happened.

Drop the 'Syncing by savedefconfig' since this is selected by the -s and
is the same for all boards in this mode.

Signed-off-by: Simon Glass <sjg@chromium.org>
2023-10-04 09:25:21 -06:00
Simon Glass
f297ba33e9 moveconfig: Fix misc pylint warnings
Fix various remaining pylint warnings.

Signed-off-by: Simon Glass <sjg@chromium.org>
2023-10-04 09:25:21 -06:00
Simon Glass
e6c686f405 moveconfig: Use an encoding with open()
Fix pylint warnings about needing an explicit character encoding.

Signed-off-by: Simon Glass <sjg@chromium.org>
2023-10-04 09:25:21 -06:00
Simon Glass
b774ba52c6 moveconfig: Correct list-comprehension warnings
Correct some pylint warnings about needing to use list comprehension.

Signed-off-by: Simon Glass <sjg@chromium.org>
2023-10-04 09:25:21 -06:00
Simon Glass
a6ab4dbd60 moveconfig: Correct use of members not declared in __init__()
Fix these pylint warnings.

Signed-off-by: Simon Glass <sjg@chromium.org>
2023-10-04 09:25:21 -06:00
Simon Glass
a4c9d178bc moveconfig: Correct non-snake variables names
Correct some variable names that do not conform to snake case, with the
three-character minimum.

Signed-off-by: Simon Glass <sjg@chromium.org>
2023-10-04 09:25:21 -06:00
Simon Glass
62fae4bf66 moveconfig: Correct unused variables
Fix pylint warnings about unused variables.

Signed-off-by: Simon Glass <sjg@chromium.org>
2023-10-04 09:25:21 -06:00
Simon Glass
1bd43060b3 moveconfig: Use f strings where possible
Avoid pylint warnings by using 'f' strings where possible.

Signed-off-by: Simon Glass <sjg@chromium.org>
2023-10-04 09:25:20 -06:00
Simon Glass
549d42230c moveconfig: Correct parameter-type warnings
Fix pylint warnings related to parameter types.

Signed-off-by: Simon Glass <sjg@chromium.org>
2023-10-04 09:25:20 -06:00
Simon Glass
9827571240 moveconfig: Correct some regular-expression strings
Use the 'r' prefix for these strings to avoid pylint warnings.

Signed-off-by: Simon Glass <sjg@chromium.org>
2023-10-04 09:25:20 -06:00
Simon Glass
03137421f5 moveconfig: Drop suspicious boards
This code isn't needed anymore. Drop it.

Signed-off-by: Simon Glass <sjg@chromium.org>
2023-10-04 09:25:20 -06:00
Simon Glass
c734561563 moveconfig: Drop check_defconfig() and update_dotconfig()
These functions are not needed anymore. Drop them.

Signed-off-by: Simon Glass <sjg@chromium.org>
2023-10-04 09:25:20 -06:00
Simon Glass
882c8e479f moveconfig: Drop CONFIG-moving code
As a step towards cleaning out old code, drop most of the code that moves
CONFIG options to Kconfig. This includes parse_one_config().

Drop the ACTION_... values as well, since they are no-longer used.

Signed-off-by: Simon Glass <sjg@chromium.org>
2023-10-04 09:25:20 -06:00
Simon Glass
3481e89d96 moveconfig: Drop unused cleanup options
Cleaning up the README and config.h files are not needed now, since we
don't have any CONFIG options to convert. Drop this code.

Signed-off-by: Simon Glass <sjg@chromium.org>
2023-10-04 09:25:20 -06:00
Simon Glass
b5aa5a32e9 moveconfig: Correct ordering of asteval import
This should be after the standard imports. Move it to avoid a lot of
pylint warnings.

Signed-off-by: Simon Glass <sjg@chromium.org>
2023-10-04 09:25:20 -06:00