summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile16
-rw-r--r--env/Kconfig18
-rw-r--r--include/env_default.h4
3 files changed, 38 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) \
diff --git a/env/Kconfig b/env/Kconfig
index 3bc1a35f65..680441c74c 100644
--- a/env/Kconfig
+++ b/env/Kconfig
@@ -479,4 +479,22 @@ config ENV_SIZE
endif
+config USE_DEFAULT_ENV_FILE
+ bool "Create default environment from file"
+ help
+ Normally, the default environment is automatically generated
+ based on the settings of various CONFIG_* options, as well
+ as the CONFIG_EXTRA_ENV_SETTINGS. By selecting this option,
+ you can instead define the entire default environment in an
+ external file.
+
+config DEFAULT_ENV_FILE
+ string "Path to default environment file"
+ depends on USE_DEFAULT_ENV_FILE
+ help
+ The path containing the default environment. The format is
+ the same as accepted by the mkenvimage tool: lines
+ containing key=value pairs, blank lines and lines beginning
+ with # are ignored.
+
endmenu
diff --git a/include/env_default.h b/include/env_default.h
index dd741315ba..ba1c3c0d74 100644
--- a/include/env_default.h
+++ b/include/env_default.h
@@ -22,6 +22,7 @@ static char default_environment[] = {
#else
const uchar default_environment[] = {
#endif
+#ifndef CONFIG_USE_DEFAULT_ENV_FILE
#ifdef CONFIG_ENV_CALLBACK_LIST_DEFAULT
ENV_CALLBACK_VAR "=" CONFIG_ENV_CALLBACK_LIST_DEFAULT "\0"
#endif
@@ -108,6 +109,9 @@ const uchar default_environment[] = {
CONFIG_EXTRA_ENV_SETTINGS
#endif
"\0"
+#else /* CONFIG_USE_DEFAULT_ENV_FILE */
+#include "generated/defaultenv_autogenerated.h"
+#endif
#ifdef DEFAULT_ENV_INSTANCE_EMBEDDED
}
#endif