[PATCH v3] mkimage: Default to 8-byte alignment for DTBs added via -b argument
Beleswar Padhi
b-padhi at ti.com
Thu Jan 22 18:22:47 CET 2026
When CONFIG_SPL_MULTI_DTB_FIT is enabled, multiple device trees are
packed inside the multidtb.fit FIT image. While the individual DTBs
and the FIT image start address are 8-byte aligned, the DTBs embedded
within the FIT image are not guaranteed to maintain 8-byte alignment.
This misalignment causes -FDT_ERR_ALIGNMENT failure in
setup_multi_dtb_fit() when locating the next available DTB within the
FIT blob and setting gd->fdt_blob, because of the recent libfdt
hardening since commit 0535e46d55d7 ("scripts/dtc: Update to upstream
version v1.7.2-35-g52f07dcca47c")
The mkimage tool already supports enforcing this alignment via the -B
option, but users would have to specify it explicitly. This change
makes 8-byte alignment the default when using -b.
Reported-by: Anshul Dalal <anshuld at ti.com>
Closes: https://lore.kernel.org/u-boot/DFJ950O0QM0D.380U0N16ZO19E@ti.com
Fixes: 0535e46d55d7 ("scripts/dtc: Update to upstream version v1.7.2-35-g52f07dcca47c")
Signed-off-by: Beleswar Padhi <b-padhi at ti.com>
---
Testing Done:
1. Boot tested on all TI K3 platforms.
v3: Changelog:
1. Default to 8-byte alignment for DTBs in mkimage instead of
passing -B 0x8 in build command [Marek]
2. Remove previous R/Bs.
Link to v2:
https://lore.kernel.org/all/20260112101102.1417970-2-b-padhi@ti.com/
v2: Changelog:
1. Carry R/B, Reported-by, Closes and Fixes tag.
Link to v1:
https://lore.kernel.org/all/20260109190026.58464-2-b-padhi@ti.com/
tools/mkimage.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/tools/mkimage.c b/tools/mkimage.c
index 3c43962807d..9ccda2e18e2 100644
--- a/tools/mkimage.c
+++ b/tools/mkimage.c
@@ -240,6 +240,8 @@ static void process_args(int argc, char **argv)
params.cmdname, optarg);
exit(EXIT_FAILURE);
}
+ /* Default to 8-byte alignment for DTBs as per spec */
+ params.bl_len = 0x8;
break;
case 'B':
params.bl_len = strtoull(optarg, &ptr, 16);
--
2.34.1
More information about the U-Boot
mailing list