public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Jon Hunter <jonathanh@nvidia.com>
To: u-boot@lists.denx.de
Subject: [PATCH] distro_bootcmd: Add support for loading user environment
Date: Fri, 31 Jan 2020 10:59:17 +0000	[thread overview]
Message-ID: <20200131105917.10118-1-jonathanh@nvidia.com> (raw)

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

             reply	other threads:[~2020-01-31 10:59 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-01-31 10:59 Jon Hunter [this message]
2020-01-31 12:42 ` [PATCH] distro_bootcmd: Add support for loading user environment 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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200131105917.10118-1-jonathanh@nvidia.com \
    --to=jonathanh@nvidia.com \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox