X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;f=dts%2FMakefile;h=785104e6d6409aa1b956db10107e17ddc6257a6d;hb=b04eb342af72d5dbcc29ccd7f3f9475044113361;hp=5792afd2719aecbcf886f1eda7b069c4d0a2f850;hpb=bbb0b128c3956ac549471addc314702fbe0ace63;p=u-boot diff --git a/dts/Makefile b/dts/Makefile index 5792afd271..785104e6d6 100644 --- a/dts/Makefile +++ b/dts/Makefile @@ -36,7 +36,9 @@ $(error Your architecture does not have device tree support enabled. \ Please define CONFIG_ARCH_DEVICE_TREE)) # We preprocess the device tree file provide a useful define -DTS_CPPFLAGS := -DARCH_CPU_DTS=\"../arch/$(ARCH)/dts/$(CONFIG_ARCH_DEVICE_TREE).dtsi\" +DTS_CPPFLAGS := -ansi \ + -DARCH_CPU_DTS=\"$(SRCTREE)/arch/$(ARCH)/dts/$(CONFIG_ARCH_DEVICE_TREE).dtsi\" \ + -DBOARD_DTS=\"$(SRCTREE)/board/$(VENDOR)/$(BOARD)/dts/$(DEVICE_TREE).dts\" all: $(obj).depend $(LIB) @@ -46,9 +48,13 @@ all: $(obj).depend $(LIB) DT_BIN := $(obj)dt.dtb $(DT_BIN): $(TOPDIR)/board/$(VENDOR)/dts/$(DEVICE_TREE).dts - cat $< | $(CPP) -P $(DTS_CPPFLAGS) - >$@.tmp - $(DTC) -R 4 -p 0x1000 -O dtb -o ${DT_BIN} $@.tmp - rm $@.tmp + rc=$$( \ + cat $< | $(CPP) -P $(DTS_CPPFLAGS) - | \ + { { $(DTC) -R 4 -p 0x1000 -O dtb -o ${DT_BIN} - 2>&1 ; \ + echo $$? >&3 ; } | \ + grep -v '^DTC: dts->dtb on file' ; \ + } 3>&1 1>&2 ) ; \ + exit $$rc process_lds = \ $(1) | sed -r -n 's/^OUTPUT_$(2)[ ("]*([^")]*).*/\1/p' @@ -62,8 +68,9 @@ $(obj)dt.o: $(DT_BIN) # We look in the LDSCRIPT first. # Then try the linker which should give us the answer. # Then check it worked. - oformat=`$(call process_lds,cat $(LDSCRIPT),FORMAT)` ;\ - oarch=`$(call process_lds,cat $(LDSCRIPT),ARCH)` ;\ + [ -n "$(LDSCRIPT)" ] && \ + oformat=`$(call process_lds,cat $(LDSCRIPT),FORMAT)` && \ + oarch=`$(call process_lds,cat $(LDSCRIPT),ARCH)` ;\ \ [ -z $${oformat} ] && \ oformat=`$(call process_lds,$(GET_LDS),FORMAT)` ;\