[PATCH v2 6/6] fdtdec: apply DT overlays from bloblist
Raymond Mao
raymond.mao at linaro.org
Fri Jul 11 19:36:12 CEST 2025
Hi Tom,
On Fri, 11 Jul 2025 at 11:45, Tom Rini <trini at konsulko.com> wrote:
>
> On Fri, Jul 04, 2025 at 06:42:05AM -0700, Raymond Mao wrote:
>
> > During FDT setup, apply all existing DT overlays from the bloblist
> > to the base FDT if bloblist is being used for handoff from previous
> > boot stage.
> > According to the spec update for DT overlay handoff[1], an overlay
> > must have the same top-level compatible string as its target base
> > DT has.
> > Before applying the DTO, it checks whether sufficient space is
> > reserved in the base FDT region. A margin (0x400) is used during
> > estimating the space size required by the merged DT.
> > A resizing happens if the reserved space is insufficient.
> > After all overlays are applied, it resizes to the actual size of the
> > merged DT.
> > Note that the margin (0x400) is arbitrary from experience, it might
> > not cover all possible scenarios as complex overlays with many
> > properties might require extra spaces and lead to FDT_ERR_NOSPACE
> > error.
> >
> > [1] Add Transfer Entry for Devicetree Overlay
> > https://github.com/FirmwareHandoff/firmware_handoff/pull/74
> [snip]
> > + actual_size = fdt_totalsize(*blob);
> > + /* Add margin for extra size growth after merging */
> > + new_fdt_size = fdt_totalsize(live_fdt) + actual_size + 0x400;
>
> This is still a fixed value and still not the right way to handle it. I
> think now that we expose configuring the amount of extra space we have
> for the tree it should possibly even just fail out with an error message
> that points to SYS_FDT_PAD?
>
Shall we do it following the steps below?
1. Expand to "fdt_totalsize() + SYS_FDT_PAD" without conditions.
2. Apply each overlay and out if any errors are returned.
3. Shrink to fdt_totalsize().
In this case, the expansion is only once at the beginning. Is it good?
Regards,
Raymond
> --
> Tom
More information about the U-Boot
mailing list