boot/uboot: allow taking the entire default environment from a text file
By default U-Boot builds a default environment from its own configuration and a board-specific set of variables. However it also allows to bypass this entirely and define the entire default environment from a text file. Expose this feature to Buildroot. This allows to have a file e.g. in board/.../uboot.env which contains an easy to maintain text file with the wanted default environment, without patching the U-Boot source code. Signed-off-by: Luca Ceresoli <luca.ceresoli@bootlin.com> Signed-off-by: Arnout Vandecappelle <arnout@mind.be>
This commit is contained in:
committed by
Arnout Vandecappelle
parent
99381a141e
commit
9ba1fa13e4
@@ -136,6 +136,35 @@ config BR2_TARGET_UBOOT_CONFIG_FRAGMENT_FILES
|
||||
that will be merged to the main U-Boot configuration file.
|
||||
endif
|
||||
|
||||
config BR2_TARGET_UBOOT_DEFAULT_ENV_FILE
|
||||
string "Text file with default environment"
|
||||
select BR2_TARGET_UBOOT_NEEDS_XXD
|
||||
help
|
||||
Text file containing the variables to be used as the default
|
||||
environment in U-Boot.
|
||||
|
||||
If empty, let U-Boot generate the default enviromnent from the
|
||||
source code and other U-Boot configuration values, which is
|
||||
the default behaviour.
|
||||
|
||||
If set to the path to a file, instructs U-Boot to define the
|
||||
entire U-Boot default environment from the provided file,
|
||||
disabling all the default behaviour.
|
||||
|
||||
From the U-Boot documentation:
|
||||
|
||||
The format is the same as accepted by the mkenvimage tool,
|
||||
with lines containing key=value pairs. Blank lines and
|
||||
lines beginning with '#' are ignored.
|
||||
|
||||
Based on the USE_DEFAULT_ENV_FILE and DEFAULT_ENV_FILE U-Boot
|
||||
configuration variables.
|
||||
|
||||
For more info see:
|
||||
https://docs.u-boot.org/en/latest/usage/environment.html#external-environment-file
|
||||
|
||||
Requires U-Boot >= v2018.05.
|
||||
|
||||
config BR2_TARGET_UBOOT_NEEDS_DTC
|
||||
bool "U-Boot needs dtc"
|
||||
select BR2_PACKAGE_HOST_DTC
|
||||
|
||||
@@ -390,6 +390,14 @@ UBOOT_KCONFIG_EDITORS = menuconfig xconfig gconfig nconfig
|
||||
# override again. In addition, host-ccache is not ready at kconfig
|
||||
# time, so use HOSTCC_NOCCACHE.
|
||||
UBOOT_KCONFIG_OPTS = $(UBOOT_MAKE_OPTS) HOSTCC="$(HOSTCC_NOCCACHE)" HOSTLDFLAGS=""
|
||||
|
||||
UBOOT_DEFAULT_ENV_FILE = $(call qstrip,$(BR2_TARGET_UBOOT_DEFAULT_ENV_FILE))
|
||||
ifneq ($(UBOOT_DEFAULT_ENV_FILE),)
|
||||
define UBOOT_KCONFIG_DEFAULT_ENV_FILE
|
||||
$(call KCONFIG_SET_OPT,CONFIG_USE_DEFAULT_ENV_FILE,y)
|
||||
$(call KCONFIG_SET_OPT,CONFIG_DEFAULT_ENV_FILE,"$(shell readlink -f $(UBOOT_DEFAULT_ENV_FILE))")
|
||||
endef
|
||||
endif
|
||||
endif # BR2_TARGET_UBOOT_BUILD_SYSTEM_LEGACY
|
||||
|
||||
UBOOT_CUSTOM_DTS_PATH = $(call qstrip,$(BR2_TARGET_UBOOT_CUSTOM_DTS_PATH))
|
||||
@@ -530,6 +538,7 @@ define UBOOT_KCONFIG_FIXUP_CMDS
|
||||
$(UBOOT_ZYNQMP_KCONFIG_PMUFW)
|
||||
$(UBOOT_ZYNQMP_KCONFIG_PM_CFG)
|
||||
$(UBOOT_ZYNQMP_KCONFIG_PSU_INIT)
|
||||
$(UBOOT_KCONFIG_DEFAULT_ENV_FILE)
|
||||
endef
|
||||
|
||||
ifeq ($(BR2_TARGET_UBOOT)$(BR_BUILDING),yy)
|
||||
|
||||
Reference in New Issue
Block a user