[PATCH] dtc: Add Kconfig option to pad device tree blob

Tom Rini trini at konsulko.com
Tue Jun 3 00:31:01 CEST 2025


On Tue, May 20, 2025 at 01:23:05PM -0500, Eric Schikschneit wrote:

> This will allow arch(s) that use device tree blobs to pad the end of the
> device tree so they can be modified by board files at run time. This will
> help prevent errors such as FDT_ERR_NOSPACE from occuring.
> 
> Signed-off-by: Eric Schikschneit <eric.schikschneit at novatechautomation.com>

I was testing merging this and I found a few problems, sorry.

> ---
>  arch/Kconfig                   | 7 +++++++
>  arch/arc/dts/Makefile          | 2 +-
>  arch/m68k/dts/Makefile         | 2 +-
>  arch/microblaze/dts/Makefile   | 2 +-
>  arch/nios2/dts/Makefile        | 2 +-
>  arch/riscv/dts/Makefile        | 2 +-
>  arch/sandbox/dts/Makefile      | 2 +-
>  arch/x86/dts/Makefile          | 2 +-
>  doc/board/broadcom/bcm7xxx.rst | 6 ++----
>  doc/develop/makefiles.rst      | 5 ++++-
>  scripts/Makefile.dts           | 4 ++++
>  11 files changed, 24 insertions(+), 12 deletions(-)
> 
> diff --git a/arch/Kconfig b/arch/Kconfig
> index ea33d07c086..a683af3d591 100644
> --- a/arch/Kconfig
> +++ b/arch/Kconfig
> @@ -63,6 +63,13 @@ config SYS_CACHELINE_SIZE
>  	default 64 if RISCV
>  	default 32 if MIPS
>  
> +config SYS_DTC_PAD_BYTES
> +	int "Size in bytes to pad device tree blob"
> +	default 4096 if ARC || ARM || M68K || MICROBLAZE || NIOS2 \
> +		|| RISCV || SANDBOX || X86
> +	default 32768 if X86 && EFI_APP
> +	default 0

I believe this is the logic I suggested and so the problem is on me. For
ARM && ARM64, this is right. But for 32bit ARM, we should be 0 and let
individual boards set this as needed (none today but your board does
need it). This leads to size growth and then failure on a few platforms
is how I noticed this.

The second problem is that the Makefiles in dts/upstream are confusingly
not 100% upstream things and so also need to have -p 0x1000 taken out of
them as they'll get the value this way instead.

-- 
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 659 bytes
Desc: not available
URL: <https://lists.denx.de/pipermail/u-boot/attachments/20250602/42aa74ac/attachment.sig>


More information about the U-Boot mailing list