Uboot builds failure with 2020.01 for openwrt-18.06

I am trying build u-boot for tegra with openwrt-18.06 branch, while I got failures at the last step:

OBJCOPY examples/standalone/hello_world.srec
OBJCOPY examples/standalone/hello_world.bin
LDS u-boot.lds
LD u-boot
OBJCOPY u-boot.srec
OBJCOPY u-boot-nodtb.bin
DTC arch/arm/dts/tegra20-harmony.dtb
FATAL ERROR: Unrecognized check name "avoid_unnecessary_addr_size"
make[5]: *** [scripts/Makefile.lib:308: arch/arm/dts/tegra20-harmony.dtb] Error 1
make[4]: *** [dts/Makefile:38: arch-dtbs] Error 2
make[3]: *** [Makefile:1087: dts/dt.dtb] Error 2

while when I build the same u-boot with arm-none-eabi-, which is the default arm none gcc, it works.

Now I fixed this issue with the patch from uboot-sunxi:

which fixed the compatible old dtc format. but we have to add more warnings fix to /scripts/Makefile.extrawarn for u-boot v2020.01 version:

DTC_FLAGS += $(call dtc-option,-Wno-avoid_unnecessary_addr_size)
DTC_FLAGS += $(call dtc-option,-Wno-alias_paths)

1 Like

Corrected the patch according to your message.

221-compatible-old-dtc.patch
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 +70,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

Uboot build from 2020.04 for openwrt-19.07.7 was successful.

I think the changes to correct the uboot problem broke other things. As of Monday April 10 - I am unable to build fresh OpenWRT images, whereas last week, I had no issues.

The output I'm getting now while running ./scripts feeds - install includes a new WARNING: which I've not seen before. This WARNING prevents preceding make menuconfig from successfully starting up. WARNING is repeated 3 times and is as follows:

WARNING: Makefile 'package/boot/uboot-sunxi/Makefile' has a dependency on 'arm-trusted-firmware-sunxi', which does not exist

I'm running Ubuntu 20.04.2 desktop, and have installed all previously required dependencies.