Since DTC 7c78c8542d73 ("Added empty node name check") , U-Boot binman
use of placeholder node names such as @fdt-SEQ and @config-SEQ triggers
DTC ERROR (node_name_not_empty). Inhibit the error, as these placeholder
nodes are updated by binman and replaced by proper nodes, the encoding
in DTB is temporary. Since -Eno-node_name_not_empty is only available in
DTC 1.8.0 and newer, introduce "dtc-option" make function which is very
similar to "cc-option" and other such Kbuild functions, and add the DTC
option conditionally.

This can be triggered on e.g. Debian Testing (as of 2026-09-07) when
using system DTC to build a DT which include binman placeholder nodes:

$ export DTC=/usr/bin/dtc
$ $DTC --version
Version: DTC 1.8.1
$ r8a779g3_sparrowhawk_defconfig
$ make -j$(nproc)
...
./arch/arm/dts/r8a779g0-u-boot.dtsi:61.16-70.9: ERROR (node_name_not_empty): 
/binman/section/u-boot/fit/images/@fdt-SEQ: Empty node name
./arch/arm/dts/r8a779g0-u-boot.dtsi:76.19-80.9: ERROR (node_name_not_empty): 
/binman/section/u-boot/fit/configurations/@config-SEQ: Empty node name
ERROR: Input tree has errors, aborting (use -f to force output)
Check 
/path/to/dts/upstream/src/arm64/renesas/.r8a779g3-sparrow-hawk.dtb.pre.tmp for 
errors

Signed-off-by: Marek Vasut <[email protected]>
---
Cc: David Gibson <[email protected]>
Cc: Héctor Orón Martínez <[email protected]>
Cc: Mattia Maldini <[email protected]>
Cc: Rasmus Villemoes <[email protected]>
Cc: Simon Glass <[email protected]>
Cc: Tom Rini <[email protected]>
Cc: Vagrant Cascadian <[email protected]>
Cc: [email protected]
---
 scripts/Makefile.lib | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib
index 122c8e78204..330ab3892e9 100644
--- a/scripts/Makefile.lib
+++ b/scripts/Makefile.lib
@@ -378,6 +378,19 @@ DTC_FLAGS += $(DTC_FLAGS_$(basetarget))
 # Set -@ if the target is a base DTB that overlay is applied onto
 DTC_FLAGS += $(if $(filter $(patsubst $(obj)/%,%,$@), $(base-dtb-y)), -@)
 
+# dtc-option
+# Usage: DTC_FLAGS += $(call dtc-option,-Eno-node_name_not_empty)
+dtc-option = $(call try-run,\
+       printf '/dts-v1/; / {};' | $(DTC) $(1) -I dts -O dtb -o 
/dev/null,$(1),$(2))
+
+# Since DTC 7c78c8542d73 ("Added empty node name check") , U-Boot binman
+# use of placeholder node names such as @fdt-SEQ and @config-SEQ triggers
+# DTC ERROR (node_name_not_empty). Inhibit the error, as these placeholder
+# nodes are updated by binman and replaced by proper nodes, the encoding
+# in DTB is temporary. Since -Eno-node_name_not_empty is only available in
+# DTC 1.8.0 and newer, add the option conditionally.
+DTC_FLAGS += $(call dtc-option, -Eno-node_name_not_empty)
+
 # Generate an assembly file to wrap the output of the device tree compiler
 quiet_cmd_dt_S_dtb= DTBS    $@
 # Modified for U-Boot
-- 
2.53.0

Reply via email to