Ensure device tree DTS is compiled
authorJames Balean <james@balean.com.au>
Thu, 16 Mar 2017 04:11:31 +0000 (23:11 -0500)
committerSimon Glass <sjg@chromium.org>
Sun, 26 Mar 2017 19:22:58 +0000 (13:22 -0600)
Enables custom DTS files, or those not associated with a specific target, to be compiled into a boot image.

Signed-off-by: James Balean <james@balean.com.au>
Cc: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Cc: Simon Glass <sjg@chromium.org>
dts/Makefile

index c4ac153ef3602bf6f2a66128d3bb63a3ffbcb416..3a93dafb5164ed6e8e4318071cd6612350b09b27 100644 (file)
@@ -12,10 +12,14 @@ ifeq ($(DEVICE_TREE),)
 DEVICE_TREE := unset
 endif
 
+ARCH_PATH := arch/$(ARCH)/dts
+dtb_depends := arch-dtbs
+
 ifneq ($(EXT_DTB),)
 DTB := $(EXT_DTB)
 else
-DTB := arch/$(ARCH)/dts/$(DEVICE_TREE).dtb
+DTB := $(ARCH_PATH)/$(DEVICE_TREE).dtb
+dtb_depends += $(DTB:.dtb=.dts)
 endif
 
 $(obj)/dt.dtb: $(DTB) FORCE
@@ -23,7 +27,10 @@ $(obj)/dt.dtb: $(DTB) FORCE
 
 targets += dt.dtb
 
-$(DTB): arch-dtbs
+$(DTB): $(dtb_depends)
+ifeq ($(EXT_DTB),)
+       $(Q)$(MAKE) $(build)=$(ARCH_PATH) $@
+endif
        $(Q)test -e $@ || (                                             \
        echo >&2;                                                       \
        echo >&2 "Device Tree Source is not correctly specified.";      \
@@ -33,7 +40,7 @@ $(DTB): arch-dtbs
        /bin/false)
 
 arch-dtbs:
-       $(Q)$(MAKE) $(build)=arch/$(ARCH)/dts dtbs
+       $(Q)$(MAKE) $(build)=$(ARCH_PATH) dtbs
 
 .SECONDARY: $(obj)/dt.dtb.S