[PATCH 1/1] image: fit: Apply overlays on a writable FDT copy

James Hilliard james.hilliard1 at gmail.com
Mon Feb 9 08:57:18 CET 2026


On Sun, Feb 8, 2026 at 4:19 PM Marek Vasut <marek.vasut at mailbox.org> wrote:
>
> On 2/8/26 11:37 PM, James Hilliard wrote:
> > boot_get_fdt_fit() relocates the base FDT with boot_relocate_fdt()
> > before applying overlays. That uses the bootm memory map and can
> > overlap with the FIT buffer when the FIT is loaded into RAM, corrupting
> > data needed to load the kernel and ramdisk.
> >
> > Allocate a writable copy of the base FDT with memalign() and
> > fdt_open_into(), grow it as needed for each overlay, and apply the
> > overlays to this buffer. Also check fdt_pack() errors and free the
> > temporary overlay copy after each application.
> >
> > Fixes: 881f0b77dc8c ("image: apply FDTOs on FDT node")
> > Signed-off-by: James Hilliard <james.hilliard1 at gmail.com>
> This code is starting to be super-convoluted. Can you please have a look
> at [1] and see if that can be somehow extended to cover this ? I think
> it should trim the complexity, but it likely needs a bit more work.

Hmm, that kinda looks like it's solving a different issue? At least I'm
not really seeing an obvious way an alignment refactor like that
would help with this issue with a bad relocation corrupting the FIT
buffer.

I agree the code here is a bit convoluted, so maybe I'm missing the
relation between the fdt alignment and the relocation location issues.

>
> Thank you
>
> [1]
> https://lore.kernel.org/u-boot/9e498de5-d114-485e-840e-1395e153edc3@mailbox.org/
>


More information about the U-Boot mailing list