public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [PATCH] distro_bootcmd: Add support for loading user environment
@ 2020-01-31 10:59 Jon Hunter
  2020-01-31 12:42 ` Soeren Moch
  0 siblings, 1 reply; 11+ messages in thread
From: Jon Hunter @ 2020-01-31 10:59 UTC (permalink / raw)
  To: u-boot

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@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

^ permalink raw reply related	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2020-01-31 18:34 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-01-31 10:59 [PATCH] distro_bootcmd: Add support for loading user environment Jon Hunter
2020-01-31 12:42 ` Soeren Moch
2020-01-31 13:24   ` Jon Hunter
2020-01-31 14:05     ` Tom Rini
2020-01-31 14:42       ` Jon Hunter
2020-01-31 14:54         ` Tom Rini
2020-01-31 18:18           ` Stephen Warren
2020-01-31 18:28             ` Soeren Moch
2020-01-31 18:34               ` Tom Rini
2020-01-31 14:58         ` David Abdurachmanov
2020-01-31 18:14           ` Tom Rini

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox