[PATCH] dtc: Add Kconfig option to pad device tree blob
Anshul Dalal
anshuld at ti.com
Mon Jun 9 10:26:26 CEST 2025
On Tue Jun 3, 2025 at 10:36 PM IST, 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>
> ---
> 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 ++++-
> dts/upstream/src/arm64/Makefile | 2 +-
> dts/upstream/src/riscv/Makefile | 2 +-
> scripts/Makefile.dts | 4 ++++
> 13 files changed, 26 insertions(+), 14 deletions(-)
>
> diff --git a/arch/Kconfig b/arch/Kconfig
> index ea33d07c086..bf4c2c80891 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 || ARM64 || M68K || MICROBLAZE || NIOS2 \
> + || RISCV || SANDBOX || X86
> + default 32768 if X86 && EFI_APP
> + default 0
> +
> config LINKER_LIST_ALIGN
> int
> default 32 if SANDBOX
> diff --git a/arch/arc/dts/Makefile b/arch/arc/dts/Makefile
> index fe6ad7b849a..87c627c01c8 100644
> --- a/arch/arc/dts/Makefile
> +++ b/arch/arc/dts/Makefile
> @@ -11,4 +11,4 @@ dtb-$(CONFIG_TARGET_IOT_DEVKIT) += iot_devkit.dtb
> include $(srctree)/scripts/Makefile.dts
>
> # Add any required device tree compiler flags here
> -DTC_FLAGS += -R 4 -p 0x1000
> +DTC_FLAGS += -R 4
Thanks for the patch Eric, the changes to padding size look good to me
although I wonder if we should expose the -R flag for configuring the
number of /reserved-memory to user under Kconfig as well.
We have it hardcoded to 4 everywhere now, might be useful to expose it
as CONFIG_SYS_DTC_RSVD or similar for users looking to create compact
DTBs (-R 0) or where more reserved regions need to be added at runtime.
Regards,
Anshul
More information about the U-Boot
mailing list