[PATCH] fdtgrep: Add option to reserve free space in the output FDT
Quentin Schulz
quentin.schulz at cherry.de
Mon Apr 27 14:22:06 CEST 2026
Hi Marek,
On 4/27/26 12:11 PM, Marek Vasut wrote:
> On 4/27/26 11:13 AM, Quentin Schulz wrote:
>> Hi Simon, Marek,
>>
>> On 4/22/26 4:31 AM, Simon Glass wrote:
>>> When producing a DTB from fdtgrep, there is no way to reserve extra
>>> space so that more nodes/properties can be added at runtime without
>>> growing totalsize first.
>>>
>>
>> Ok but why is that an issue? What is the actual usecase? What I'm
>> afraid of is that you pad enough and you hit random bugs because you
>> forget that adding enough properties can now hit the size limit and
>> you forgot to add the logic to resize/grow the fdt when it's too small
>> to fit new properties.
> This is needed to prevent fdtgrep from inhibiting this and stripping the
> pad bytes again:
>
> scripts/Makefile.dts:DTC_FLAGS += -p $(CONFIG_SYS_DTC_PAD_BYTES)
>
> That ^ is used by early U-Boot stages in place of 'fdt resize' , it
> provides enough space to add basic modifications to the DT at those stages.
It'd have been soooo nice to explain what CONFIG_SYS_DTC_PAD_BYTES is
useful for. The default for arm64 is 4096 but it doesn't explain where
it came from and if we can have more, or less and what's the impact on
the system.
But ok, the commit log should be updated to add this additional piece of
information (and also in the same series have whatever's going to use
this new option). Something like "This is the counterpart to DTC_FLAGS
+= -p $(CONFIG_SYS_DTC_PAD_BYTES) in scripts/Makefile.dts because xPL
device trees are passed through fdtgrep which packs the DTB after
stripping nodes and properties and therefore do not respect this for
now. In the next commit(s), we'll make use of that new property such
that xPL devices also respect that."
Now I'm wondering if we want the same value for xPL DTB padding as some
systems are heavily size-constrained (and next stages may not allow
enough space for storing the new DTB with that much padding; TF-A on
Rockchip for example was notorious for only allowing very small DTBs).
Cheers,
Quentin
More information about the U-Boot
mailing list