summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefano Babic <sbabic@denx.de>2019-03-13 09:46:45 +0100
committerStefan Agner <stefan.agner@toradex.com>2019-05-09 09:54:48 +0200
commita766688516690d9e29b40419fee6a429fe7596d3 (patch)
tree2c7f1c680451e23a97b41ea9f86c2f00e7b8e889
parent5c677c463c09cdd34eebcd7bfbd74563b16facdb (diff)
Add target to generate initial environment
The initial environment is linked to the u-boot binary. Modifying the environment from User Space with the env tools requires that the tools are always built together with the bootloader to be sure that they contain the initial environment in case no environment is stored into persistent storage or when a board boots with just the default environment. This makes difficult for distros to provide a general package to access the environment. A simpler way is if the tools are generic for all boards and a configuration file is given to provide the initial environment. The patch just generates the initial environment by extracting it from the compiled object. This file can then be used for tools in user space to initialize the environment. Signed-off-by: Stefano Babic <sbabic@denx.de> (cherry picked from commit bdaa73a5b3923257add182b4ab8058dbfa33421b)
-rw-r--r--Makefile7
1 files changed, 7 insertions, 0 deletions
diff --git a/Makefile b/Makefile
index 3743b54a61..162485c420 100644
--- a/Makefile
+++ b/Makefile
@@ -1721,6 +1721,13 @@ endif
$(build)=$(build-dir) $(@:.ko=.o)
$(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modpost
+quiet_cmd_genenv = GENENV $@
+cmd_genenv = $(OBJCOPY) --dump-section .rodata.default_environment=$@ env/common.o; \
+ sed --in-place -e 's/\x00/\x0A/g' $@
+
+u-boot-initial-env: u-boot.bin
+ $(call if_changed,genenv)
+
# Consistency checks
# ---------------------------------------------------------------------------