Makefile: avoid dtc warnings on re-compiling DTB

When we add the PSCI nodes to the provided DTB, we use dtc to de-compile
the blob first, then re-compile it with our nodes and properties added.

In our input DTB the proper phandle references have already been lost,
all we see in the DTB is phandle properties in the target node, and some
numbers in the clocks and gpios properties:
	clk24mhz {
		compatible = "fixed-clock";
		#clock-cells = <0x00>;
		clock-frequency = <0x16e3600>;
		clock-output-names = "v2m:clk24mhz";
->		phandle = <0x05>;
	serial@90000 {
		compatible = "arm,pl011", "arm,primecell";
		reg = <0x90000 0x1000>;
		interrupts = <0x05>;
->		clocks = <0x05 0x05>;
		clock-names = "uartclk", "apb_pclk";
dtc warns that those numbers might be wrong:
<stdin>:177.6-27: Warning (clocks_property):
   clocks: cell 0 is not a phandle reference
The proper solution would be to use references (&v2m_clk24mhz) instead,
as there are in the source .dts file, but we don't have that information
anymore, and cannot easily recover it.

To avoid the lengthy list of warnings, just drop those checks from the
dtc compilation run. This disables more checks than we want or need, but
we somewhat trust in the original DTB to be sane, so that should be
Since those warning options are not supported by older dtc versions,
introduce a compatiblity check before using them.

Signed-off-by: Andre Przywara <>
Tested-by: Vladimir Murzin <>
Signed-off-by: Mark Rutland <>
diff --git a/ b/
index 40bc5d6..08e304a 100644
--- a/
+++ b/
@@ -162,8 +162,16 @@ $(LD_SCRIPT) Makefile
+# Run dtc with an given command line option to check support for it.
+define test-dtc-option
+$(if $(shell echo "/dts-v1/;/{};" | $(DTC) $(1) -o /dev/null 2>&1),,$(1))
+DTC_NOWARN  = $(call test-dtc-option,-Wno-clocks_property)
+DTC_NOWARN += $(call test-dtc-option,-Wno-gpios_property)
 fdt.dtb: $(KERNEL_DTB) Makefile
-	( $(DTC) -O dts -I dtb $(KERNEL_DTB) ; echo "/ { $(CHOSEN_NODE) $(PSCI_NODE) }; $(CPU_NODES)" ) | $(DTC) -O dtb -o $@ -
+	( $(DTC) -O dts -I dtb $(KERNEL_DTB) ; echo "/ { $(CHOSEN_NODE) $(PSCI_NODE) }; $(CPU_NODES)" ) | $(DTC) -O dtb -o $@ $(DTC_NOWARN) -
 # The filesystem archive might not exist if INITRD is not being used
 .PHONY: all clean $(FILESYSTEM)