summaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
authorMichal Simek <michal.simek@xilinx.com>2020-02-18 15:03:13 +0100
committerMichal Simek <michal.simek@xilinx.com>2020-04-06 12:51:31 +0200
commitdacec83ce0f8c80b35ed9b4e18f4468ff8552069 (patch)
treee4c9a3da24517a733da9a4dcce089b2ed5138c8d /Makefile
parentf5a122e2abe9a4a589a4ae30145b1fdf4f5207d1 (diff)
Makefile: Add environment variable DEVICE_TREE to header
Users have option to overwrite default device tree (CONFIG_DEFAULT_DEVICE_TREE) via environment variable DEVICE_TREE. Feature has been added long time ago by commit 74de8c9a1672 ("dts/Makefile: Build the user specified dts") for a little bit different reason. But this variable can be also used for different purpose like choosing proper configuration from FIT image in SPL. And this is the functionality I would like to use on Xilinx Zynq devices that current u-boot.img can be composed in the same way based on OF_LIST and different configuration is taken based on platform specific SPL. SPL requires low level ps7_init_gpl configuration that's why different boards require different SPL with fixed board_fit_config_name_match(). Signed-off-by: Michal Simek <michal.simek@xilinx.com> Reviewed-by: Tom Rini <trini@konsulko.com> Reviewed-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile14
1 files changed, 13 insertions, 1 deletions
diff --git a/Makefile b/Makefile
index 0db44d4249..c9ae31c80d 100644
--- a/Makefile
+++ b/Makefile
@@ -483,6 +483,7 @@ endif
version_h := include/generated/version_autogenerated.h
timestamp_h := include/generated/timestamp_autogenerated.h
defaultenv_h := include/generated/defaultenv_autogenerated.h
+dt_h := include/generated/dt.h
no-dot-config-targets := clean clobber mrproper distclean \
help %docs check% coccicheck \
@@ -1767,7 +1768,7 @@ endif
# prepare2 creates a makefile if using a separate output directory
prepare2: prepare3 outputmakefile cfg
-prepare1: prepare2 $(version_h) $(timestamp_h) \
+prepare1: prepare2 $(version_h) $(timestamp_h) $(dt_h) \
include/config/auto.conf
ifeq ($(wildcard $(LDSCRIPT)),)
@echo >&2 " Could not find linker script."
@@ -1833,12 +1834,23 @@ define filechk_defaultenv.h
xxd -i ; echo ", 0x00" ; )
endef
+define filechk_dt.h
+ (if test -n "$${DEVICE_TREE}"; then \
+ echo \#define DEVICE_TREE \"$(DEVICE_TREE)\"; \
+ else \
+ echo \#define DEVICE_TREE CONFIG_DEFAULT_DEVICE_TREE; \
+ fi)
+endef
+
$(version_h): include/config/uboot.release FORCE
$(call filechk,version.h)
$(timestamp_h): $(srctree)/Makefile FORCE
$(call filechk,timestamp.h)
+$(dt_h): $(srctree)/Makefile FORCE
+ $(call filechk,dt.h)
+
$(defaultenv_h): $(CONFIG_DEFAULT_ENV_FILE:"%"=%) FORCE
$(call filechk,defaultenv.h)