From patchwork Fri Jan 31 10:59:17 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jon Hunter X-Patchwork-Id: 240508 List-Id: U-Boot discussion From: jonathanh at nvidia.com (Jon Hunter) Date: Fri, 31 Jan 2020 10:59:17 +0000 Subject: [PATCH] distro_bootcmd: Add support for loading user environment Message-ID: <20200131105917.10118-1-jonathanh@nvidia.com> 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 --- 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;" \