uboot-zynq: fix build by adding comparabilities for old dtc

The patch is taken from commit 367ee3274d.

Signed-off-by: Tianling Shen <cnsztl@immortalwrt.org>
This commit is contained in:
Tianling Shen 2021-09-14 03:32:22 +08:00
parent 8d9ab9fe0d
commit 9aeff45240
No known key found for this signature in database
GPG Key ID: 6850B6345C862176

View File

@ -0,0 +1,56 @@
Revert the commit c0e032e0090d65 ("scripts/dtc: Update to upstream
version v1.4.3")
OpenWrt uses the dtc from the kernel also in u-boot, but when we compile
against kernel 4.9 we run into some errors because it is too old now.
Add the options only when they are supported to make it compatible with
dtc from kernel 4.9.
--- a/scripts/Kbuild.include
+++ b/scripts/Kbuild.include
@@ -173,6 +173,11 @@ ld-version = $(shell $(LD) --version | $
# Usage: $(call ld-ifversion, -ge, 22252, y)
ld-ifversion = $(shell [ $(ld-version) $(1) $(2) ] && echo $(3) || echo $(4))
+# dtc-option
+# Usage: DTC_FLAGS += $(call dtc-option,-Wno-unit_address_vs_reg)
+dtc-option = $(call try-run,\
+ echo '/dts-v1/; / {};' | $(DTC) $(1),$(1),$(2))
+
######
###
--- a/scripts/Makefile.extrawarn
+++ b/scripts/Makefile.extrawarn
@@ -56,8 +56,8 @@ endif
KBUILD_CFLAGS += $(warning)
-dtc-warning-2 += -Wnode_name_chars_strict
-dtc-warning-2 += -Wproperty_name_chars_strict
+dtc-warning-2 += $(call dtc-option,-Wnode_name_chars_strict)
+dtc-warning-2 += $(call dtc-option,-Wproperty_name_chars_strict)
dtc-warning := $(dtc-warning-$(findstring 1, $(KBUILD_ENABLE_EXTRA_GCC_CHECKS)))
dtc-warning += $(dtc-warning-$(findstring 2, $(KBUILD_ENABLE_EXTRA_GCC_CHECKS)))
@@ -68,13 +68,13 @@ DTC_FLAGS += $(dtc-warning)
else
# Disable noisy checks by default
-DTC_FLAGS += -Wno-unit_address_vs_reg
-DTC_FLAGS += -Wno-simple_bus_reg
-DTC_FLAGS += -Wno-unit_address_format
-DTC_FLAGS += -Wno-pci_bridge
-DTC_FLAGS += -Wno-pci_device_bus_num
-DTC_FLAGS += -Wno-pci_device_reg
-DTC_FLAGS += -Wno-avoid_unnecessary_addr_size
-DTC_FLAGS += -Wno-alias_paths
+DTC_FLAGS += $(call dtc-option,-Wno-unit_address_vs_reg)
+DTC_FLAGS += $(call dtc-option,-Wno-simple_bus_reg)
+DTC_FLAGS += $(call dtc-option,-Wno-unit_address_format)
+DTC_FLAGS += $(call dtc-option,-Wno-pci_bridge)
+DTC_FLAGS += $(call dtc-option,-Wno-pci_device_bus_num)
+DTC_FLAGS += $(call dtc-option,-Wno-pci_device_reg)
+DTC_FLAGS += $(call dtc-option,-Wno-avoid_unnecessary_addr_size)
+DTC_FLAGS += $(call dtc-option,-Wno-alias_paths)
endif