4313 Commits

Author SHA1 Message Date
Quentin Schulz
b3ab77345e mkimage: fit: erase data-size property when importing data
When importing data, the data-offset property is removed and the data
content is imported inside the data property of the node.

When mkimage is run twice on the same FIT, data-size property is already
set in the second run, from the first run (via the fit_export_data
function). If we don't remove the data-size property, nothing guarantees
it matches the actual size of data within the data property. To avoid
possible mistakes when handling the data property, let's simply remove
the data-size property as well.

This also fixes an ordering issue of the data-size and data-offset
properties in FIT when comparing the FIT after one run of mkimage and a
second run. This is due to fit_export_data setting data-offset property
first (it doesn't exist so it's added) and then data-size (it doesn't
exist so it's added) for the first run, while it sets data-offset
property first (removed in fit_import_data, so it doesn't exist so it's
added) and then data-size (it exists already from the first run, so it's
simply modified) for the second run.

Signed-off-by: Quentin Schulz <quentin.schulz@cherry.de>
2025-10-10 13:28:36 -06:00
Quentin Schulz
abab733fc2 mkimage: fit: do not ignore fdt_setprop return code
All explicit calls to fdt_setprop* in tools/ are checked except those
three. Let's add a check for the return code of fdt_setprop_u32() calls.

Signed-off-by: Quentin Schulz <quentin.schulz@cherry.de>
2025-10-10 13:28:36 -06:00
Quentin Schulz
6209ce58c3 mkimage: fit: do not overwrite fdt_setprop return value
The return code of fdt_setprop is overwritten by the one from
fdt_delprop meaning we could very well have an issue when setting the
property that would be ignored if the deletion of the property that
comes right after passes.

Let's add a separate check for each.

Fixes: 4860ee9b09e0 ("mkimage: allow internalization of data-position")
Signed-off-by: Quentin Schulz <quentin.schulz@cherry.de>
2025-10-10 13:28:36 -06:00
Marek Vasut
e560735558 mkimage: Add help text for bundling TFA BL31 in mkimage -f auto
Add missing help text for the -y and -Y parameters of mkimage.

Fixes: 6dfd14e1228e ("mkimage: Add support for bundling TFA BL31 in mkimage -f auto")
Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org>
2025-10-07 17:49:15 -06:00
Tom Rini
e482fdbbca Revert "Merge patch series "mkimage: Detect FIT image load address overlaps and fix related test/DTS issues""
This reverts commit 4d84fa1261eb27d57687f2e4c404a78b8653c183, reversing
changes made to b82a1fa7ddc7f3be2f3b75898d5dc44c34420bdd.

I had missed some feedback on this series from earlier, and we have
since had reports of regressions due to this as well. For now, revert
this.

Signed-off-by: Tom Rini <trini@konsulko.com>
2025-09-24 07:50:44 -06:00
Tom Rini
4d84fa1261 Merge patch series "mkimage: Detect FIT image load address overlaps and fix related test/DTS issues"
Aristo Chen <jj251510319013@gmail.com> says:

This patch series enhances FIT image robustness by adding **memory
region overlap detection** to `mkimage` and fixing existing overlaps
in DTS files and `binman` tests.

The primary goal is to prevent runtime memory corruption from
conflicting load addresses in FIT images.

Key Changes:

1.  `mkimage` Overlap Detection: A new validation in
    `tools/fit_image.c` checks for overlapping load addresses
    within FIT configurations. `mkimage` now errors out with
    detailed info on conflicts, preventing bad FIT image creation.

2.  New Test Case: A Python test verifies the new detection.
    It intentionally creates an overlap (kernel and FDT)
    to confirm correct error handling.

3.  Fixes for Existing Overlaps:
    * Board DTS (k3-am6xx): Adjusted load addresses for TI
      firmware stubs to prevent conflicts. This resolves
      previously undetected overlaps.
    * `binman` Tests: Fixed several tests. U-Boot load
      addresses were shifted to avoid ATF conflicts. A new
      linker script for TEE ELF sections ensures distinct
      memory layouts.

4.  Documentation: Added guidance for developers on how to
    determine ELF load addresses using readelf, linker scripts,
    and objdump when working with binman FIT images.

Impact:

This series improves FIT image reliability by catching overlaps
at build time, helping developers resolve issues before runtime
failures.

Link: https://lore.kernel.org/r/20250914110021.4103-1-aristo.chen@canonical.com
2025-09-23 13:41:16 -06:00
Aristo Chen
4907a920e8 doc: binman: Add guidance for determining ELF load addresses
Add documentation to help users understand how to determine where ELF
files will be loaded when using binman's 'fit,load' property. This
addresses the common confusion about how load addresses are determined
from ELF files.

The documentation explains three methods:
1. Using readelf to examine program headers
2. Checking the linker script (.lds file)
3. Using objdump to see section addresses

Also includes a specific example from binman tests showing how
elf_sections.lds sets ATF load address to 0x00000010 and
elf_sections_tee.lds sets TEE load address to 0x00100010 to avoid
memory overlap conflicts.

This helps users debug memory layout conflicts more efficiently when
working with FIT images containing multiple ELF components.

Signed-off-by: Aristo Chen <aristo.chen@canonical.com>
2025-09-23 13:35:22 -06:00
Aristo Chen
588094f2c8 tools: mkimage: detect overlapping load regions in FIT configurations
This patch adds a validation step in mkimage to detect memory region
overlaps between images specified in the same configuration of a
FIT image. If any overlaps are found, the tool prints an error and
aborts the build.

This helps prevent runtime memory corruption caused by conflicting
load addresses between images.

Signed-off-by: Aristo Chen <aristo.chen@canonical.com>
2025-09-23 13:35:22 -06:00
Aristo Chen
a06733fc83 binman: Fix FIT image overlap issues for testFitSplitElf
Fix one binman test that has memory region overlap issue, the test case
needed to be updated to use non-overlapping memory layouts.

* Tests fixed:
  - testFitSplitElf

* Changes made:
  1. ELF section layouts: added elf_sections_tee.lds with different
     address for TEE to avoid overlap with ATF address defined in
     elf_sections.lds
  2. Makefile to properly build elf_sections_tee binary
  3. Updat ftest.py to use separate ELF files for TEE vs ATF components
     in split-elf operations.

An upcoming commit will validate if the memory region is overlapped

Signed-off-by: Aristo Chen <aristo.chen@canonical.com>
2025-09-23 13:35:22 -06:00
Aristo Chen
dade54edaf binman: Fix FIT image overlap issues
Fix three binman tests that has memory region overlap issue, the test
cases needed to be updated to use non-overlapping memory layouts.

* Tests fixed:
  - testFitFirmwareLoadables
  - testFitSignSimple
  - testFitSignNoSignatureNodes

* Changes made:
  Updated DTB test files to change U-Boot load addresses from 0x0 to
  0x2000 to avoid overlapping with ATF in the 0x10-0xfc range:
  - 276_fit_firmware_loadables.dts
  - 340_fit_signature.dts
  - 342_fit_signature.dts

An upcoming commit will validate if the memory region is overlapped

Signed-off-by: Aristo Chen <aristo.chen@canonical.com>
Reviewed-by: Neha Malcom Francis <n-francis@ti.com>
2025-09-23 13:35:22 -06:00
Aristo Chen
88392a59bf binman: Fix typo for the test case name
Fix typo from `Singature` to `Signature`

Signed-off-by: Aristo Chen <aristo.chen@canonical.com>
Reviewed-by: Dhruva Gole <d-gole@ti.com>
2025-09-23 13:35:22 -06:00
Tom Rini
b82a1fa7dd Prepare v2025.10-rc5
-----BEGIN PGP SIGNATURE-----
 
 iHUEABYKAB0WIQTzzqh0PWDgGS+bTHor4qD1Cr/kCgUCaNKh1AAKCRAr4qD1Cr/k
 CnQgAQD5TlXCGlBUqvpBo8Q4eoWQb+bIjP7UJlquO3nB9vrqAgD/cpKwXDBZ88fL
 7UwAs2FAuE21eJ/SwZ/NQImwR0CkNAk=
 =N0hy
 -----END PGP SIGNATURE-----

Merge tag 'v2025.10-rc5' into next

Prepare v2025.10-rc5
2025-09-23 08:24:59 -06:00
Alice Guo
5c389e6190 binman: add a new entry type to support .bin file generation for the i.MX95 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 <alice.guo@nxp.com>
2025-09-17 08:16:04 -03:00
Tom Rini
ab11aca3a1 Merge patch series "Modernize U-Boot code formatting with clang-format"
Javier Tia <javier.tia@linaro.org> says:

This patch series modernizes U-Boot's code formatting infrastructure by
with current Linux kernel practices and providing a more robust and
comprehensive formatting solution.

Link: https://lore.kernel.org/r/20250905205349.127333-1-javier.tia@linaro.org
2025-09-16 13:45:08 -06:00
Javier Tia
aa711ac815 tools: zynqmp_psu_init_minimize.sh: Switch to clang-format
Replace the use of scripts/Lindent with clang-format in
zynqmp_psu_init_minimize.sh. This change is made to align with the rest
of the codebase that uses clang-format for code formatting. This ensures
consistency across all scripts in terms of code style and formatting.

Tested-by: Michal Simek <michal.simek@amd.com>
Signed-off-by: Javier Tia <javier.tia@linaro.org>
2025-09-16 13:45:00 -06:00
Marek Vasut
6dfd14e122 mkimage: Add support for bundling TFA BL31 in mkimage -f auto
Introduce two new parameters to be used with mkimage -f auto to bundle
TFA BL31 image into fitImage, using auto-generated fitImage. Add -y to
specify TFA BL31 file name and -Y to specify TFA BL31 load and entry
point address. This is meant to be used with systems which boot all of
TFA BL31, Linux and its DT from a single fitImage, all booted by U-Boot.

Example invocation:
"
$ mkimage -E -A arm64 -C none -e 0x50200000 -a 0x50200000 -f auto \
          -d arch/arm64/boot/Image \
	  -b arch/arm64/boot/dts/renesas/r8a779g3-sparrow-hawk.dtb \
	  -y ../tfa/build/rcar_gen4/release/bl31.bin -Y 0x46400000 \
	  /path/to/output/fitImage
"

Documentation update and test are also included, the test validates
both positive and negative test cases, where fitImage does not include
TFA BL31 and does include TFA BL31 blobs.

Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org>
2025-09-12 14:35:36 -06:00
Jan Kiszka
371a76e845 tools: Do not generate logo when cross-building
This cannot work (unless qemu-user is registered in binfmt_misc) as the
tools will be for a different architecture.

Fixes "make cross_tools" in case CONFIG_VIDEO_LOGO is enabled.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Reviewed-by: Tom Rini <trini@konsulko.com>
2025-09-10 10:38:50 -06:00
Tom Rini
7d921410ef Merge patch series "tools: fdtgrep: Mark util_version() as static"
This series from Ilias Apalodimas <ilias.apalodimas@linaro.org> lays
some of the groundwork for being able to enable the -Wmissing-prototypes
compiler flag while building U-Boot by fixing the obvious problems in
the tools directory.

Link: https://lore.kernel.org/r/20250829081628.2327372-1-ilias.apalodimas@linaro.org
2025-09-09 12:44:23 -06:00
Ilias Apalodimas
1e73651a71 tools: imx8image: Mark imx8mimage_check_params() as static
The function is only used locally. Enabling -Wmissing-prototypes
triggers a warning. Mark it as static.

Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
2025-09-09 12:44:07 -06:00
Ilias Apalodimas
f006837ead tools: imx8mimage: Mark build_image() as static
The function is only used locally. Enabling -Wmissing-prototypes
triggers a warning. Mark it as static.

Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
2025-09-09 12:44:07 -06:00
Ilias Apalodimas
39f7af39bb tools: fit_check_sign: Mark usage() as static
The function is only used locally. Enabling -Wmissing-prototypes
triggers a warning. Mark it as static.

Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
2025-09-09 12:44:07 -06:00
Ilias Apalodimas
5ab15814e8 tool: fit_info: Mark usage() as static
The function is only used locally. Enabling -Wmissing-prototypes
triggers a warning. Mark it as static.

Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
2025-09-09 12:44:07 -06:00
Ilias Apalodimas
3ae031135d tools: rkcommon: Mark rkcommon_is_header_v2() as static
The function is only used locally. Enabling -Wmissing-prototypes
triggers a warning. Mark it as static.

Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Reviewed-by: Quentin Schulz <quentin.schulz@cherry.de>
2025-09-09 12:44:07 -06:00
Ilias Apalodimas
867d762bc5 tools: mkimage: Mark copy_datafile() as static
The function is only used locally. Enabling -Wmissing-prototypes
triggers a warning. Mark it as static.

Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
2025-09-09 12:44:07 -06:00
Ilias Apalodimas
9fe4e088f3 tools: fdtgrep: Mark util_usage() as static
The function is only used locally. Enabling -Wmissing-prototypes
triggers a warning. Mark it as static.

Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
2025-09-09 12:44:07 -06:00
Ilias Apalodimas
3c34fd46b6 tools: fdtgrep: Mark util_version() as static
The function is only used locally. Enabling -Wmissing-prototypes
triggers a warning. Mark it as static.

Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
2025-09-09 12:44:07 -06:00
Jan Kiszka
ae84ef8c62 tools: Drop meaningless comment from Makefile
Introduced by 245b1029e1af, probably a debug left-over.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Reviewed-by: Heiko Schocher <hs@nabladev.com>
2025-09-09 11:04:16 -06:00
Tom Rini
d4a106f005 Prepare v2025.10-rc4
-----BEGIN PGP SIGNATURE-----
 
 iHUEABYKAB0WIQTzzqh0PWDgGS+bTHor4qD1Cr/kCgUCaL8CMgAKCRAr4qD1Cr/k
 Cp/9AQC9q8c8gGygrpAEXA6ANfi4PmU9gCO1BTMmKuKnUpDlFAD/XDal22rTlB2W
 c/lwlB/1OOsbbMQ7AV9b4wTH2SlaPQQ=
 =hR6U
 -----END PGP SIGNATURE-----

Merge tag 'v2025.10-rc4' into next

Prepare v2025.10-rc4
2025-09-08 10:37:22 -06:00
Ilias Apalodimas
d95c4bebf4 tools: imx8image: Make imx8image_check_params() static
We are trying to enable -Wmissing-prototypes and this functiion is only
used locally. Mark it as static.

Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Acked-by: Peng Fan <peng.fan@nxp.com>
2025-09-05 09:03:45 -03:00
Adriano Carvalho
1041ce48a9 doc: Capitalize the word Buildman whenever it's used as a proper noun
This consistency reads a bit nicer.

Signed-off-by: Adriano Carvalho <adrianocarvalho.pt@gmail.com>
2025-08-30 20:45:33 +02:00
Adriano Carvalho
0492657c74 doc: Rephrase to be more precise and less confusing (build)
It was "... doing the same build ... will not trigger a rebuild".

Signed-off-by: Adriano Carvalho <adrianocarvalho.pt@gmail.com>
2025-08-30 20:45:33 +02:00
Adriano Carvalho
01bf38a05e doc: Rephrase to read a bit nicer
Reads better.

Signed-off-by: Adriano Carvalho <adrianocarvalho.pt@gmail.com>
2025-08-30 20:45:33 +02:00
Adriano Carvalho
ac0e3d2541 doc: Rephrase to be more clear
It might not be clear what is meant with "to make sure the shell leaves it alone".

Signed-off-by: Adriano Carvalho <adrianocarvalho.pt@gmail.com>
2025-08-30 20:45:33 +02:00
Adriano Carvalho
77c72bcb0d doc: Rephrase in a simpler way
It reads a bit nicer.

Signed-off-by: Adriano Carvalho <adrianocarvalho.pt@gmail.com>
2025-08-30 20:45:33 +02:00
Adriano Carvalho
b14d24af40 doc: Add riscv and unfold the list with the architecture/code name
riscv was missing from the list.
To some, the architecture's name may not be obvious from the code name.

Signed-off-by: Adriano Carvalho <adrianocarvalho.pt@gmail.com>
2025-08-30 20:45:33 +02:00
Adriano Carvalho
76733999b0 doc: Use "supports" instead of "has"
Strictly speaking, "has" doesn't make sense.
"supports" seems like a better word and it probably was what the original author meant.

Signed-off-by: Adriano Carvalho <adrianocarvalho.pt@gmail.com>
2025-08-30 20:45:33 +02:00
Adriano Carvalho
45d32d2911 doc: Quote all long form options using double backticks/grave accents
Otherwise, the two dashes are rendered as just one.

Signed-off-by: Adriano Carvalho <adrianocarvalho.pt@gmail.com>
2025-08-30 20:45:33 +02:00
Adriano Carvalho
6a006c56ee doc: Fix obvious typos and minor improvements
These are fixes to what looks like obvious typos.
Some minor improvments are also included, such as:
- Write "symbolic link" instead of symlink
- Correct capitalization for LLVM (all caps)
- Remove dead link and surrounding sentence

Signed-off-by: Adriano Carvalho <adrianocarvalho.pt@gmail.com>
2025-08-30 20:45:33 +02:00
Ilias Apalodimas
544bf0aa59 tools: aisimage: Make aisimage_check_params() static
We are trying to enable -Wmissing-prototypes and this functiion is only
used locally. Mark it as static.

Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
2025-08-19 11:25:23 -06:00
Ilias Apalodimas
6139d5f252 tools: fit_info: Make usage() static
The function is only used locally so declare it as static.

Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
2025-08-19 11:25:20 -06:00
Heinrich Schuchardt
e16646c0ad tools: mkeficapsule: resource leak in read_bin_file()
Free the allocated buffer in case of an error.

Fixes: 9e63786e2b4b ("tools: mkeficapsule: rework the code a little bit")
Addresses-Coverity-ID: 345917 Resource leak
Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
2025-08-08 08:44:52 +02:00
Tom Rini
09974c7a64 Merge patch series "bintool fixes"
Jerome Forissier <jerome.forissier@linaro.org> says:

Two small fixes for binman (bintool). The first patch avoids a warning,
the second one makes sure the APT package list is up-to-date when
running apt_install(). That one fixes a CI issue I encountered.

Link: https://lore.kernel.org/r/20250724091342.59902-1-jerome.forissier@linaro.org
2025-07-29 17:00:14 -06:00
Jerome Forissier
252a2b2750 binman: bintool: run 'apt-get update -y' on first invocation of apt_install()
'apt-get update -y' may be required to make sure that the list of
packages is up-to-date and that the subsequent 'apt-get install'
operations can find the requested packages.

Fixes the following CI error:

 Fetch: zstd
 - trying method: binary download
 - sudo apt-get install -y zstd
 Exception: Error 100 running 'sudo apt-get install -y zstd': E: Unable to locate package zstd

Signed-off-by: Jerome Forissier <jerome.forissier@linaro.org>
Reviewed-by: Bryan Brattlof <bb@ti.com>
2025-07-29 17:00:07 -06:00
Jerome Forissier
2babd34eac binman: bintool: use apt-get instead of apt
The 'apt' command is not meant to be used in scripts or tools. Please
see the man page [1] for details. Therefore, use 'apt-get' instead.
This avoids the following warning:

WARNING: apt does not have a stable CLI interface. Use with caution in scripts.

[1] https://manpages.debian.org/bookworm/apt/apt.8.en.html#SCRIPT_USAGE_AND_DIFFERENCES_FROM_OTHER_APT_TOOLS

Signed-off-by: Jerome Forissier <jerome.forissier@linaro.org>
Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Bryan Brattlof <bb@ti.com>
2025-07-29 17:00:07 -06:00
Justin Swartz
bb04b7bcf6 tools: mips-relocs: replace format string introducers
The statement that prints the ELF object type value assumes that "%lx"
(long unsigned int, hexadecimal) is suitable for printing a uint64_t
typed value. While this may seem to work for some machines, ie. amd64,
it isn't ideal on a 32-bit system, such as x86 where uint64_t is likely
to be equivalent to a long long unsigned int, as indicated by:

  ../tools/mips-relocs.c:275:34:
  warning: format '%lx' expects argument of type 'long unsigned int',
           but argument 2 has type 'uint64_t'
           {aka 'long long unsigned int'} [-Wformat=]
  275 |                 printf("type 0x%lx\n", ehdr_field(e_type));
      |                                ~~^
      |                                  |
      |                                  long unsigned int
      |                                %llx

As the ehdr_field function-like macro expands to a uint64_t value,
it is better to use the PRIx64 macro in place of "%lx" to ensure that
the correct format string introducer is specified for the actual type
hiding behind uint64_t.

A similar issue is also present in the report of .rel section overflow,
where "%lx" is used to print a few size_t typed values, and would be
better served by "%zx" instead.

Signed-off-by: Justin Swartz <justin.swartz@risingedge.co.za>
Fixes: 963014641117 ("MIPS: make size of relocation table fixed but configurable")
Fixes: 703ec9ddf965 ("MIPS: Stop building position independent code")
Cc: Paul Burton <paulburton@kernel.org>
Cc: Daniel Schwierzeck <daniel.schwierzeck@gmail.com>
Cc: Masahiro Yamada <masahiroy@kernel.org>
2025-07-29 16:48:10 -06:00
Tom Rini
1d782a3f22 Docker, CI: Update to latest Ubuntu and Dockerfile
- Update to Ubuntu "Jammy" 20250714 tag
- Update to current Dockerfile which brings us QEMU 10.0.2 and newer
  coreboot and pulls in lz4 via the non-legacy package name.

Signed-off-by: Tom Rini <trini@konsulko.com>
2025-07-25 13:03:01 -06:00
Tom Rini
2a19fc236f Merge patch series "CI: Disable sifive_unleashed_sdcard QEMU testing"
This series from myself brings CI up to using QEMU 10.0.2 for platforms.
We need to disable one test for now while a report to upstream QEMU is
resolved and also need to now update coreboot in order to be able to
build a version of it non-interactively (source locations have changed).

Link: https://lore.kernel.org/r/20250716001539.2483390-1-trini@konsulko.com
2025-07-25 10:55:45 -06:00
Tom Rini
0fabedfcde CI: Update to coreboot 25.03
At this point there's problems rebuilding coreboot-24.08 without manual
intervention. Let us upgrade to a newer version.

Signed-off-by: Tom Rini <trini@konsulko.com>
2025-07-25 10:55:40 -06:00
Tom Rini
910aa6c1ef Dockerfile: Update to QEMU 10.0.2
As QEMU 10.0.2 is the current release, update to that so that we can
update other features within CI.

Signed-off-by: Tom Rini <trini@konsulko.com>
2025-07-25 10:55:40 -06:00
Tom Rini
67c791dcdf patman: Update test for Anatolij's new email address
This test was failing due to matching on Anatolij's old email address.
Switch to the new one.

Signed-off-by: Tom Rini <trini@konsulko.com>
2025-07-23 13:36:37 -06:00