[PATCH] distro_bootcmd: Add support for loading user environment
Jon Hunter
jonathanh at nvidia.com
Fri Jan 31 11:59:17 CET 2020
U-Boot supports loading a user environment from a file in the
file-system. Therefore to make it easier for users to override the
default environment, add support to the 'distro_bootcmd' to look for
and load a user environment in a file called 'uEnv.txt' in the same
locations where an extlinux.conf or boot script might be found.
Note that by importing the environment with the '-t' option, the current
environment is appended/updated rather than replaced completely.
Signed-off-by: Jon Hunter <jonathanh at nvidia.com>
---
include/config_distro_bootcmd.h | 14 ++++++++++++++
1 file changed, 14 insertions(+)
diff --git a/include/config_distro_bootcmd.h b/include/config_distro_bootcmd.h
index fc0935fa21af..5607f382ad73 100644
--- a/include/config_distro_bootcmd.h
+++ b/include/config_distro_bootcmd.h
@@ -422,6 +422,19 @@
"boot_script_dhcp=boot.scr.uimg\0" \
BOOTENV_BOOT_TARGETS \
\
+ "load_user_env=" \
+ "load ${devtype} ${devnum}:${distro_bootpart} " \
+ "${scriptaddr} ${prefix}uEnv.txt; " \
+ "env import -t ${scriptaddr} ${filesize}\0" \
+ \
+ "scan_dev_for_user_env=" \
+ "if test -e ${devtype} " \
+ "${devnum}:${distro_bootpart} " \
+ "${prefix}uEnv.txt; then " \
+ "echo Found ${prefix}uEnv.txt; " \
+ "run load_user_env; " \
+ "fi\0" \
+ \
"boot_syslinux_conf=extlinux/extlinux.conf\0" \
"boot_extlinux=" \
"sysboot ${devtype} ${devnum}:${distro_bootpart} any " \
@@ -457,6 +470,7 @@
"echo Scanning ${devtype} " \
"${devnum}:${distro_bootpart}...; " \
"for prefix in ${boot_prefixes}; do " \
+ "run scan_dev_for_user_env; " \
"run scan_dev_for_extlinux; " \
"run scan_dev_for_scripts; " \
"done;" \
--
2.17.1
More information about the U-Boot
mailing list