[PATCH 5/9] PBL: fdt: make minimum fdt size configurable

Sascha Hauer s.hauer at pengutronix.de
Mon May 26 23:41:16 PDT 2025


On Mon, May 26, 2025 at 04:38:11PM +0200, Michael Tretter wrote:
> Adding or modifying nodes in the fdt may change the size of the fdt.
> This needs some reserved space in the fdt to avoid overriding memory
> that comes after the fdt and is already used.
> 
> Signed-off-by: Michael Tretter <m.tretter at pengutronix.de>
> ---
>  pbl/Kconfig          | 11 +++++++++++
>  scripts/Makefile.lib |  2 ++
>  2 files changed, 13 insertions(+)
> 
> diff --git a/pbl/Kconfig b/pbl/Kconfig
> index 6e3581829d589c7b06ed878b09bf74e16a0c3086..489b2001a855d62e11a2159311332b0e67f3a754 100644
> --- a/pbl/Kconfig
> +++ b/pbl/Kconfig
> @@ -60,6 +60,17 @@ config PBL_VERIFY_PIGGY
>  config PBL_CLOCKSOURCE
>  	bool
>  
> +config PBL_FDT_MIN_SIZE
> +	hex
> +	default 0x0
> +	prompt "Minimum size of the FDT blob"
> +	help
> +	  The TF-A or OP-TEE may modify the FDT or add nodes to the FDT. This
> +	  may increases the size of the device tree. This may override the
> +	  barebox binary.
> +
> +	  The minimum size should be at least CFG_DTB_MAX_SIZE for OP-TEE.
> +
>  config BOARD_GENERIC_DT
>  	bool
>  	select LIBFDT
> diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib
> index b10119797686ea31fe927d29a7849ad525c8c835..f50006f57200a76a86c7e29175dd7e35ab138e26 100644
> --- a/scripts/Makefile.lib
> +++ b/scripts/Makefile.lib
> @@ -396,6 +396,8 @@ ifeq ($(CONFIG_OF_OVERLAY_LIVE), y)
>  DTC_FLAGS.dtb += -@
>  endif
>  
> +DTC_FLAGS.dtb += --space $(CONFIG_PBL_FDT_MIN_SIZE)

--space sets the minimum fdt size. The fdt size will vary over time and
different boards. Isn't --pad more suitable for what you want to
archieve?

Sascha

-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |



More information about the barebox mailing list