[PATCH] kbuild: Respect CONFIG_SYS_DTC_PAD_BYTES after fdtgrep

Marek Vasut marek.vasut+renesas at mailbox.org
Mon Apr 20 03:23:26 CEST 2026


The fdtgrep command will reduce the DT to minimum size, thus eliminating
the extra padding configured via CONFIG_SYS_DTC_PAD_BYTES. Reinstate the
extra padding by running the output DTB from fdtgrep through DTC with the
-p CONFIG_SYS_DTC_PAD_BYTES flag again in case CONFIG_SYS_DTC_PAD_BYTES
is not zero.

Signed-off-by: Marek Vasut <marek.vasut+renesas at mailbox.org>
---
Cc: Adriano Cordova <adrianox at gmail.com>
Cc: Ilias Apalodimas <ilias.apalodimas at linaro.org>
Cc: Peter Robinson <pbrobinson at gmail.com>
Cc: Quentin Schulz <quentin.schulz at cherry.de>
Cc: Sughosh Ganu <sughosh.ganu at arm.com>
Cc: Tom Rini <trini at konsulko.com>
Cc: u-boot at lists.denx.de
---
 scripts/Makefile.lib | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib
index 7386353e0cc..443d6cd09cf 100644
--- a/scripts/Makefile.lib
+++ b/scripts/Makefile.lib
@@ -806,9 +806,16 @@ quiet_cmd_fdtgrep = FDTGREP $@
 # ---------------------------------------------------------------------------
 # Pass the original device tree file through fdtgrep. This removes various
 # unused properties. The output is typically a smaller device tree file.
+ifeq ($(CONFIG_SYS_DTC_PAD_BYTES),0)
 quiet_cmd_fdt_rm_props = FDTGREP $@
 	cmd_fdt_rm_props = cat $< | $(objtree)/tools/fdtgrep -r -O dtb - -o $@ \
 			$(addprefix -P ,$(subst $\",,$(CONFIG_OF_REMOVE_PROPS)))
+else
+quiet_cmd_fdt_rm_props = FDTGREP $@
+	cmd_fdt_rm_props = cat $< | $(objtree)/tools/fdtgrep -r -O dtb - \
+			$(addprefix -P ,$(subst $\",,$(CONFIG_OF_REMOVE_PROPS))) | \
+			$(DTC) -I dtb -O dtb $(DTC_FLAGS) -p $(CONFIG_SYS_DTC_PAD_BYTES) -o $@
+endif
 
 # ASM offsets
 # ---------------------------------------------------------------------------
-- 
2.53.0



More information about the U-Boot mailing list