[PATCH] boot: image-fit.c: check target, not source, for 8-byte alignment when loading FDT
Simon Glass
sjg at chromium.org
Thu May 7 17:30:58 CEST 2026
Hi Rasmus,
On 2026-05-04T14:44:55, Rasmus Villemoes <ravi at prevas.dk> wrote:
> boot: image-fit.c: check target, not source, for 8-byte alignment when loading FDT
>
> A number of our boards no longer boot with v2026.04, ironically as a
> result of the effort to ensure 8-byte alignment of the dtb passed to
> the kernel and getting rid of the fdt_high=0xffffffff.
>
> The problem exists when the FIT image does specify a (properly
> aligned) load address to use for the fdt. For example, we have
>
> fdt-am335x-boneblack.dtb {
> description = "Flattened Device Tree blob";
> data = /incbin/(...);
> ...
> load = <0x88000000>;
> }
>
> Now, with v2026.04 and depending on just exactly where that data ends
> up, in a good case we see
>
> Loading fdt from 0x8a8c6e10 to 0x88000000
> [...]
>
> boot/image-fit.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
> diff --git a/boot/image-fit.c b/boot/image-fit.c
> @@ -2311,7 +2311,7 @@ int fit_image_load(struct bootm_headers *images, ulong addr,
> }
> len = load_end - load;
> } else if (load_op != FIT_LOAD_IGNORED && image_type == IH_TYPE_FLATDT &&
> - ((uintptr_t)buf & 7)) {
> + (load & 7)) {
> loadbuf = aligned_alloc(8, len);
> load = map_to_sysmem(loadbuf);
> memcpy(loadbuf, buf, len);
Fixes: 8fbcc0e0e839 ("boot: Assure FDT is always at 8-byte aligned address")
BTW the file already uses IS_ALIGNED(x, 8) a few lines up in
boot_get_fdt_fit_into_buffer() so you could use !IS_ALIGNED(load, 8)
Reviewed-by: Simon Glass <sjg at chromium.org>
Regards,
Simon
More information about the U-Boot
mailing list