uboot-sunxi: fix build by adding comparabilities for old dtc
[openwrt/openwrt.git] / package / boot / uboot-sunxi / patches / 221-compatible-old-dtc.patch
1 Revert the commit c0e032e0090d65 ("scripts/dtc: Update to upstream
2 version v1.4.3")
3 OpenWrt uses the dtc from the kernel also in u-boot, but when we compile
4 against kernel 4.9 we run into some errors because it is too old now.
5 Add the options only when they are supported to make it compatible with
6 dtc from kernel 4.9.
7
8 --- a/scripts/Kbuild.include
9 +++ b/scripts/Kbuild.include
10 @@ -172,6 +172,11 @@ ld-version = $(shell $(LD) --version | $
11 # Usage: $(call ld-ifversion, -ge, 22252, y)
12 ld-ifversion = $(shell [ $(ld-version) $(1) $(2) ] && echo $(3) || echo $(4))
13
14 +# dtc-option
15 +# Usage: DTC_FLAGS += $(call dtc-option,-Wno-unit_address_vs_reg)
16 +dtc-option = $(call try-run,\
17 + echo '/dts-v1/; / {};' | $(DTC) $(1),$(1),$(2))
18 +
19 ######
20
21 ###
22 --- a/scripts/Makefile.extrawarn
23 +++ b/scripts/Makefile.extrawarn
24 @@ -58,8 +58,8 @@ endif
25
26 KBUILD_CFLAGS += $(warning)
27
28 -dtc-warning-2 += -Wnode_name_chars_strict
29 -dtc-warning-2 += -Wproperty_name_chars_strict
30 +dtc-warning-2 += $(call dtc-option,-Wnode_name_chars_strict)
31 +dtc-warning-2 += $(call dtc-option,-Wproperty_name_chars_strict)
32
33 dtc-warning := $(dtc-warning-$(findstring 1, $(KBUILD_ENABLE_EXTRA_GCC_CHECKS)))
34 dtc-warning += $(dtc-warning-$(findstring 2, $(KBUILD_ENABLE_EXTRA_GCC_CHECKS)))
35 @@ -70,11 +70,11 @@ DTC_FLAGS += $(dtc-warning)
36 else
37
38 # Disable noisy checks by default
39 -DTC_FLAGS += -Wno-unit_address_vs_reg
40 -DTC_FLAGS += -Wno-simple_bus_reg
41 -DTC_FLAGS += -Wno-unit_address_format
42 -DTC_FLAGS += -Wno-pci_bridge
43 -DTC_FLAGS += -Wno-pci_device_bus_num
44 -DTC_FLAGS += -Wno-pci_device_reg
45 +DTC_FLAGS += $(call dtc-option,-Wno-unit_address_vs_reg)
46 +DTC_FLAGS += $(call dtc-option,-Wno-simple_bus_reg)
47 +DTC_FLAGS += $(call dtc-option,-Wno-unit_address_format)
48 +DTC_FLAGS += $(call dtc-option,-Wno-pci_bridge)
49 +DTC_FLAGS += $(call dtc-option,-Wno-pci_device_bus_num)
50 +DTC_FLAGS += $(call dtc-option,-Wno-pci_device_reg)
51
52 endif