Skip to content

Commit d3c6f0f

Browse files
d3zd3zAnas Nashif
authored andcommitted
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 <[email protected]>
1 parent 1a6c4b1 commit d3c6f0f

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

scripts/Makefile.lib

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -264,6 +264,9 @@ cmd_gzip = (cat $(filter-out FORCE,$^) | gzip -n -f -9 > $@) || \
264264
# DTC
265265
# ---------------------------------------------------------------------------
266266

267+
DTC_OVERLAY_DIR ?= $(PROJECT_BASE)
268+
DTC_OVERLAY_FILE = $(abspath $(DTC_OVERLAY_DIR)/$(BOARD_NAME).overlay)
269+
267270
# Generate an assembly file to wrap the output of the device tree compiler
268271
quiet_cmd_dt_S_dtb= DTB $@
269272
cmd_dt_S_dtb= \
@@ -282,12 +285,10 @@ cmd_dt_S_dtb= \
282285
$(obj)/%.dtb.S: $(obj)/%.dtb
283286
$(call cmd,dt_S_dtb)
284287

285-
DTS_OVERLAY ?= $(PROJECT_BASE)/$(BOARD_NAME).overlay
286-
287288
quiet_cmd_dtc = DTC $@
288289
cmd_dtc = echo '\#include "$(notdir $<)"' > dts/$(ARCH)/$(notdir $<)_pre_compiled ; \
289-
if test -e $(DTS_OVERLAY); then \
290-
echo '\#include "$(BOARD_NAME).overlay"' >> dts/$(ARCH)/$(notdir $<)_pre_compiled ; \
290+
if test -e $(DTC_OVERLAY_FILE); then \
291+
echo '\#include "$(DTC_OVERLAY_FILE)"' >> dts/$(ARCH)/$(notdir $<)_pre_compiled ; \
291292
fi ; \
292293
$(CPP) $(dtc_cpp_flags) -x assembler-with-cpp -o $(dtc-tmp) dts/$(ARCH)/$(notdir $<)_pre_compiled ; \
293294
$(DTC) -O dts -o $@ -b 0 \
@@ -298,7 +299,7 @@ cmd_dtc = echo '\#include "$(notdir $<)"' > dts/$(ARCH)/$(notdir $<)_pre_compile
298299
$(obj)/%.dtb: $(src)/%.dts FORCE
299300
$(call if_changed_dep,dtc)
300301

301-
$(obj)/%.dts_compiled: $(src)/%.dts $(DTS_OVERLAY) FORCE
302+
$(obj)/%.dts_compiled: $(src)/%.dts $(wildcard $(DTC_OVERLAY_FILE)) FORCE
302303
$(call if_changed_dep,dtc)
303304

304305
dtc-tmp = $(subst $(comma),_,$(dot-target).dts.tmp)

0 commit comments

Comments
 (0)