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

Tom Rini trini at konsulko.com
Mon Jun 9 16:56:10 CEST 2025


On Mon, Jun 09, 2025 at 01:56:26PM +0530, Anshul Dalal wrote:
> 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.

That could be an interesting follow-up patch, yes.

-- 
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/20250609/8c58de27/attachment.sig>


More information about the U-Boot mailing list