[PATCH] fdtgrep: Add option to reserve free space in the output FDT

Marek Vasut marek.vasut at mailbox.org
Wed Apr 22 21:08:53 CEST 2026


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.
> 
> Add a -B/--pad option that appends a caller-specified number of free
> bytes after the strings section and grows totalsize accordingly. The
> padding is applied after fdt_pack(), so it is not reclaimed when -r is
> used.
> 
> Suggested-by: Marek Vasut <marek.vasut at mailbox.org>
> Signed-off-by: Simon Glass <sjg at chromium.org>
> ---
> 
>   tools/binman/btool/fdtgrep.py |  3 ++-
>   tools/fdtgrep.c               | 31 ++++++++++++++++++++++++++++++-
>   2 files changed, 32 insertions(+), 2 deletions(-)
> 
> diff --git a/tools/binman/btool/fdtgrep.py b/tools/binman/btool/fdtgrep.py
> index 446b2f4144b..7b393241878 100644
> --- a/tools/binman/btool/fdtgrep.py
> +++ b/tools/binman/btool/fdtgrep.py
> @@ -16,9 +16,10 @@ Output formats are:
>   	dtb - device tree blob (sets -Hmt automatically)
>   	bin - device tree fragment (may not be a valid .dtb)
>   
> -Options: -[haAc:b:C:defg:G:HIlLmn:N:o:O:p:P:rRsStTvhV]
> +Options: -[haAB:c:b:C:defg:G:HIlLmn:N:o:O:p:P:rRsStTvhV]
>     -a, --show-address                 Display address
>     -A, --colour                       Show all nodes/tags, colour those that match
> +  -B, --pad <arg>                    Append free space to the output FDT, for later growth
Shouldn't the parameter at least match the dtc -p parameter ? -p is not 
taken yet.


More information about the U-Boot mailing list