dts: Allow override of dts overlay directory

Instead of requiring the dts overlay files to be at the top level
directory (where make is invoked), allow this default to be overridden
by setting DTS_OVERLAY_DIR.  This is a directory where the overlays
themselves (which are still named $(BOARD_NAME).overlay) will live.

Change-Id: Ie9796afbd27971650b7636a36149c0d1f8e2b9fb
Signed-off-by: David Brown <david.brown@linaro.org>
This commit is contained in:
David Brown 2017-05-25 10:17:33 -06:00 committed by Anas Nashif
commit 7a8380a81d

View file

@ -264,6 +264,9 @@ cmd_gzip = (cat $(filter-out FORCE,$^) | gzip -n -f -9 > $@) || \
# DTC
# ---------------------------------------------------------------------------
DTC_OVERLAY_DIR ?= $(PROJECT_BASE)
DTC_OVERLAY_FILE = $(abspath $(DTC_OVERLAY_DIR)/$(BOARD_NAME).overlay)
# Generate an assembly file to wrap the output of the device tree compiler
quiet_cmd_dt_S_dtb= DTB $@
cmd_dt_S_dtb= \
@ -282,12 +285,10 @@ cmd_dt_S_dtb= \
$(obj)/%.dtb.S: $(obj)/%.dtb
$(call cmd,dt_S_dtb)
DTS_OVERLAY ?= $(PROJECT_BASE)/$(BOARD_NAME).overlay
quiet_cmd_dtc = DTC $@
cmd_dtc = echo '\#include "$(notdir $<)"' > dts/$(ARCH)/$(notdir $<)_pre_compiled ; \
if test -e $(DTS_OVERLAY); then \
echo '\#include "$(BOARD_NAME).overlay"' >> dts/$(ARCH)/$(notdir $<)_pre_compiled ; \
if test -e $(DTC_OVERLAY_FILE); then \
echo '\#include "$(DTC_OVERLAY_FILE)"' >> dts/$(ARCH)/$(notdir $<)_pre_compiled ; \
fi ; \
$(CPP) $(dtc_cpp_flags) -x assembler-with-cpp -o $(dtc-tmp) dts/$(ARCH)/$(notdir $<)_pre_compiled ; \
$(DTC) -O dts -o $@ -b 0 \
@ -298,7 +299,7 @@ cmd_dtc = echo '\#include "$(notdir $<)"' > dts/$(ARCH)/$(notdir $<)_pre_compile
$(obj)/%.dtb: $(src)/%.dts FORCE
$(call if_changed_dep,dtc)
$(obj)/%.dts_compiled: $(src)/%.dts $(DTS_OVERLAY) FORCE
$(obj)/%.dts_compiled: $(src)/%.dts $(wildcard $(DTC_OVERLAY_FILE)) FORCE
$(call if_changed_dep,dtc)
dtc-tmp = $(subst $(comma),_,$(dot-target).dts.tmp)