[PATCH v4] tools: fit_image: Fallback to 8-byte alignment for flat_dt images
Marek Vasut
marek.vasut at mailbox.org
Wed Jan 28 17:35:02 CET 2026
On 1/28/26 5:11 PM, Tom Rini wrote:
[...]
>>>> Maybe simply call round_up(8) on the align_size , to align to the next
>>>> 8-byte aligned offset , but somewhat respect user wishes ?
>>>>
>>>> But looking at this code one more time , look at the calloc() in this
>>>> function, I think you might also have to allocate a bit more memory to
>>>> really hold all the newly aligned DTs, right ?
>>>>
>>>> Also, don't you need to align the buf_ptr as well ? Consider a scenario
>>>> where the fitImage contains two images, one ends at 4-byte aligned address,
>>>> followed by a DT. The users passes -B 4 to mkimage, and I think buf_ptr
>>>> would then be 4-byte aligned, so will the DT, no ?
>>>
>>> I'm confused. Where did we go from "default should be 8 not 4, for
>>> device trees" to "take what the user passed, make sure is 8b aligned" ?
>>> If the user tells us to do something, we should do it, and they can
>>> suffer the potential consequences. If the user doesn't tell us to do
>>> something, we should pick a reasonable default.
>> You can remove the "the user passes -B 4" part from my example, keep the
>> rest, the DT will likely end up 4-byte aligned, no ?
>
> And 4-byte aligned is not a reasonable default.
4 is the default, unless specified otherwise:
617 align_size = params->bl_len ? params->bl_len : 4;
Which is fine for most images, not for DTs, so DTs should be aligned to
increments of 8 ... or fixed 8 ?
More information about the U-Boot
mailing list