From mboxrd@z Thu Jan 1 00:00:00 1970 From: Soeren Moch Date: Fri, 31 Jan 2020 13:42:22 +0100 Subject: [PATCH] distro_bootcmd: Add support for loading user environment In-Reply-To: <20200131105917.10118-1-jonathanh@nvidia.com> References: <20200131105917.10118-1-jonathanh@nvidia.com> Message-ID: List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de On 31.01.20 11:59, Jon Hunter wrote: > 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. We already have boot script support, which can easily be used to modify the environment. Do we really need to bloat the distro_boot machinery further with environment import, that is quite limited in contrast to boot scripts? Soeren > 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 > --- > 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;" \ >