Skip to content

Commit

Permalink
Add target to generate initial environment
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
sbabic authored and trini committed Apr 22, 2019
1 parent 792dd57 commit bdaa73a
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -1977,6 +1977,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
# ---------------------------------------------------------------------------

Expand Down

0 comments on commit bdaa73a

Please sign in to comment.