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")

Add the -B 0x8 flag to mkimage to enforce 8-byte alignment for all DTB
entries within the multidtb FIT image.

Reported-by: Anshul Dalal <[email protected]>
Closes: https://lore.kernel.org/u-boot/[email protected]
Fixes: 0535e46d55d7 ("scripts/dtc: Update to upstream version 
v1.7.2-35-g52f07dcca47c")
Signed-off-by: Beleswar Padhi <[email protected]>
Reviewed-by: Tom Rini <[email protected]>
Reviewed-by: Marek Vasut <[email protected]>
Reviewed-by: Anshul Dalal <[email protected]>
---
v2: Changelog:
1. Carry R/B, Reported-by, Closes and Fixes tag.

Link to v1:
https://lore.kernel.org/all/[email protected]/

 scripts/Makefile.xpl | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/scripts/Makefile.xpl b/scripts/Makefile.xpl
index 5e65d7b2498..1183f5180ba 100644
--- a/scripts/Makefile.xpl
+++ b/scripts/Makefile.xpl
@@ -602,7 +602,7 @@ $(SHRUNK_ARCH_DTB): $$(patsubst $(obj)/dts/%, $(dt_dir)/%, 
$$@) $(dir $(SHRUNK_A
 targets += $(SPL_OF_LIST_TARGETS)
 
 MKIMAGEFLAGS_$(SPL_BIN).multidtb.fit = -f auto -A $(ARCH) -T firmware -C none 
-O u-boot \
-       -n "Multi DTB fit image for $(SPL_BIN)" -E \
+       -n "Multi DTB fit image for $(SPL_BIN)" -B 0x8 -E \
        $(patsubst %,-b %,$(SHRUNK_ARCH_DTB))
 
 $(obj)/$(SPL_BIN).multidtb.fit: /dev/null $(SHRUNK_ARCH_DTB) FORCE
-- 
2.34.1

Reply via email to