From 127d5d672ec9a72125502243bccbb0578917ceec Mon Sep 17 00:00:00 2001
From: Funda Wang <fundawang@yeah.net>
Date: Tue, 29 Sep 2026 22:37:29 +0800
Subject: [PATCH] scripts: dtc: adapt DTC_FLAGS for external dtc 1.8

Two adjustments needed when building with a system dtc newer than the
in-tree snapshot:

1. The graph_child_address check was removed from upstream dtc
   (v1.7.2+, commit cba90ce82064 "checks: Remove check for graph child
   addresses"). dtc aborts with "FATAL ERROR: Unrecognized check name"
   when passed -Wno- for a check that no longer exists. Drop the flag,
   following the same fix applied in the Linux kernel.

2. The node_name_not_empty check was added in upstream dtc (commit
   7c78c8542d73 "Added empty node name check"). It reports an ERROR on
   binman generator/template nodes like @fdt-SEQ and @config-SEQ, whose
   names are expanded by binman after dtc runs, so the check is a false
   positive here. Use -Eno- to clear only the error level of that check
   and leave the rest untouched, the same way ALT Linux handles it.
---
 scripts/Makefile.lib | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib
index 5440304..4e51eaf 100644
--- a/scripts/Makefile.lib
+++ b/scripts/Makefile.lib
@@ -300,7 +300,6 @@ DTC_FLAGS += -Wno-unit_address_vs_reg \
 	-Wno-unit_address_format \
 	-Wno-avoid_unnecessary_addr_size \
 	-Wno-alias_paths \
-	-Wno-graph_child_address \
 	-Wno-graph_port \
 	-Wno-unique_unit_address \
 	-Wno-simple_bus_reg \
@@ -311,6 +310,10 @@ DTC_FLAGS += -Wno-pci_bridge \
         -Wno-pci_device_bus_num
 endif
 
+# binman template nodes (@fdt-SEQ etc.) have empty names by design;
+# the names are expanded by binman after dtc runs
+DTC_FLAGS += -Eno-node_name_not_empty
+
 ifneq ($(findstring 2,$(KBUILD_ENABLE_EXTRA_GCC_CHECKS)),)
 DTC_FLAGS += -Wnode_name_chars_strict \
 	-Wproperty_name_chars_strict