aboutsummaryrefslogtreecommitdiffstats
path: root/Makefile
diff options
context:
space:
mode:
authorRasmus Villemoes <rasmus.villemoes@prevas.dk>2018-03-20 11:38:45 +0100
committerTom Rini <trini@konsulko.com>2018-04-06 20:45:28 -0400
commitf3d8f7dd73ac5dde258eb786d4a01869395b56d7 (patch)
treeac0438620f8ac9bacd7a390ec03f05f6ad50dd01 /Makefile
parent11dfd1a331e915b17f3dd25c4ca98382d400719e (diff)
downloadu-boot-midas-f3d8f7dd73ac5dde258eb786d4a01869395b56d7.tar.gz
u-boot-midas-f3d8f7dd73ac5dde258eb786d4a01869395b56d7.tar.bz2
u-boot-midas-f3d8f7dd73ac5dde258eb786d4a01869395b56d7.zip
Allow providing default environment from file
Modifying the default environment via CONFIG_EXTRA_ENV_SETTINGS is somewhat inflexible, partly because the cpp language does not allow appending to an existing macro. This prevents reuse of "environment fragments" for different boards, which in turn makes maintaining that environment consistently tedious and error-prone. This implements a Kconfig option for allowing one to define the entire default environment in an external file, which can then, for example, be generated programmatically as part of a Yocto recipe, or simply be kept in version control separately from the U-boot repository. Tested-by: Sean Nyekjaer <sean.nyekjaer@prevas.dk> Signed-off-by: Rasmus Villemoes <rasmus.villemoes@prevas.dk> Reviewed-by: Lukasz Majewski <lukma@denx.de>
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile16
1 files changed, 16 insertions, 0 deletions
diff --git a/Makefile b/Makefile
index 034e5aadce..bfe115cf18 100644
--- a/Makefile
+++ b/Makefile
@@ -423,6 +423,7 @@ endif
version_h := include/generated/version_autogenerated.h
timestamp_h := include/generated/timestamp_autogenerated.h
+defaultenv_h := include/generated/defaultenv_autogenerated.h
no-dot-config-targets := clean clobber mrproper distclean \
help %docs check% coccicheck \
@@ -1391,6 +1392,10 @@ ifeq ($(wildcard $(LDSCRIPT)),)
@/bin/false
endif
+ifeq ($(CONFIG_USE_DEFAULT_ENV_FILE),y)
+prepare1: $(defaultenv_h)
+endif
+
archprepare: prepare1 scripts_basic
prepare0: archprepare FORCE
@@ -1438,12 +1443,23 @@ define filechk_timestamp.h
fi)
endef
+define filechk_defaultenv.h
+ (grep -v '^#' | \
+ grep -v '^$$' | \
+ tr '\n' '\0' | \
+ sed -e 's/\\\x0/\n/' | \
+ xxd -i ; echo ", 0x00" ; )
+endef
+
$(version_h): include/config/uboot.release FORCE
$(call filechk,version.h)
$(timestamp_h): $(srctree)/Makefile FORCE
$(call filechk,timestamp.h)
+$(defaultenv_h): $(CONFIG_DEFAULT_ENV_FILE:"%"=%) FORCE
+ $(call filechk,defaultenv.h)
+
# ---------------------------------------------------------------------------
quiet_cmd_cpp_lds = LDS $@
cmd_cpp_lds = $(CPP) -Wp,-MD,$(depfile) $(cpp_flags) $(LDPPFLAGS) \