On 12/01/26 11:26, Anshul Dalal wrote:
> On Sat Jan 10, 2026 at 12:30 AM IST, Beleswar Padhi wrote:
>> 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")
> Is a fixes tag justified in this case? Technically the commit
> 0535e46d55d7 did cause the regression[1].
>
> [1]: https://lore.kernel.org/u-boot/[email protected]/


Originally I didn't consider this a regression because the commit
0535e46d55d7 only enforced the alignment check. The alignment
requirement was part of DT spec since long... But doesn't hurt to
add the fixes tag I guess. Will do in v2.

>
>> Add the -B 0x8 flag to mkimage to enforce 8-byte alignment for all DTB
>> entries within the multidtb FIT image.
>>
>> Signed-off-by: Beleswar Padhi <[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 \
> The patch looks alright to me though I wonder if as a next step we
> should put the logic to ensure device-tree alignment directly into
> mkimage since it already knows which blob is the device-tree (the one
> passed with -b option)?
>
> Reviewed-by: Anshul Dalal <[email protected]>
>
>>      $(patsubst %,-b %,$(SHRUNK_ARCH_DTB))
>>  
>>  $(obj)/$(SPL_BIN).multidtb.fit: /dev/null $(SHRUNK_ARCH_DTB) FORCE

Reply via email to