mirror of
https://github.com/Fishwaldo/u-boot.git
synced 2025-04-10 08:21:31 +00:00
distro: not taint environment variables if possible
The aim of this patch is not to have temporary variables used in distro_bootcmd left as environment variables after run something. See the discussion[1]. Without this patch, saveenv command also saves those variables, too. While they are apparently safe, scsi_need_init can be harmful. Please note that, in most cases, a variable should be converted to hush's local variable, while "devplist" cannot because it is created by "part" command as an environment variable. [1] https://lists.denx.de/pipermail/u-boot/2018-December/350209.html Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org> Signed-off-by: Alexander Graf <agraf@suse.de>
This commit is contained in:
parent
d178836bd2
commit
13dd6665ed
1 changed files with 7 additions and 6 deletions
|
@ -27,7 +27,7 @@
|
||||||
|
|
||||||
#define BOOTENV_SHARED_BLKDEV_BODY(devtypel) \
|
#define BOOTENV_SHARED_BLKDEV_BODY(devtypel) \
|
||||||
"if " #devtypel " dev ${devnum}; then " \
|
"if " #devtypel " dev ${devnum}; then " \
|
||||||
"setenv devtype " #devtypel "; " \
|
"devtype=" #devtypel "; " \
|
||||||
"run scan_dev_for_boot_part; " \
|
"run scan_dev_for_boot_part; " \
|
||||||
"fi\0"
|
"fi\0"
|
||||||
|
|
||||||
|
@ -37,7 +37,7 @@
|
||||||
|
|
||||||
#define BOOTENV_DEV_BLKDEV(devtypeu, devtypel, instance) \
|
#define BOOTENV_DEV_BLKDEV(devtypeu, devtypel, instance) \
|
||||||
"bootcmd_" #devtypel #instance "=" \
|
"bootcmd_" #devtypel #instance "=" \
|
||||||
"setenv devnum " #instance "; " \
|
"devnum=" #instance "; " \
|
||||||
"run " #devtypel "_boot\0"
|
"run " #devtypel "_boot\0"
|
||||||
|
|
||||||
#define BOOTENV_DEV_NAME_BLKDEV(devtypeu, devtypel, instance) \
|
#define BOOTENV_DEV_NAME_BLKDEV(devtypeu, devtypel, instance) \
|
||||||
|
@ -77,7 +77,7 @@
|
||||||
"if ubi part ${bootubipart} && " \
|
"if ubi part ${bootubipart} && " \
|
||||||
"ubifsmount ubi${devnum}:${bootubivol}; " \
|
"ubifsmount ubi${devnum}:${bootubivol}; " \
|
||||||
"then " \
|
"then " \
|
||||||
"setenv devtype ubi; " \
|
"devtype=ubi; " \
|
||||||
"run scan_dev_for_boot; " \
|
"run scan_dev_for_boot; " \
|
||||||
"fi\0"
|
"fi\0"
|
||||||
#define BOOTENV_DEV_UBIFS BOOTENV_DEV_BLKDEV
|
#define BOOTENV_DEV_UBIFS BOOTENV_DEV_BLKDEV
|
||||||
|
@ -205,11 +205,11 @@
|
||||||
|
|
||||||
#ifdef CONFIG_SCSI
|
#ifdef CONFIG_SCSI
|
||||||
#define BOOTENV_RUN_SCSI_INIT "run scsi_init; "
|
#define BOOTENV_RUN_SCSI_INIT "run scsi_init; "
|
||||||
#define BOOTENV_SET_SCSI_NEED_INIT "setenv scsi_need_init; "
|
#define BOOTENV_SET_SCSI_NEED_INIT "scsi_need_init=; "
|
||||||
#define BOOTENV_SHARED_SCSI \
|
#define BOOTENV_SHARED_SCSI \
|
||||||
"scsi_init=" \
|
"scsi_init=" \
|
||||||
"if ${scsi_need_init}; then " \
|
"if ${scsi_need_init}; then " \
|
||||||
"setenv scsi_need_init false; " \
|
"scsi_need_init=false; " \
|
||||||
"scsi scan; " \
|
"scsi scan; " \
|
||||||
"fi\0" \
|
"fi\0" \
|
||||||
\
|
\
|
||||||
|
@ -444,7 +444,8 @@
|
||||||
"bootfstype; then " \
|
"bootfstype; then " \
|
||||||
"run scan_dev_for_boot; " \
|
"run scan_dev_for_boot; " \
|
||||||
"fi; " \
|
"fi; " \
|
||||||
"done\0" \
|
"done; " \
|
||||||
|
"setenv devplist\0" \
|
||||||
\
|
\
|
||||||
BOOT_TARGET_DEVICES(BOOTENV_DEV) \
|
BOOT_TARGET_DEVICES(BOOTENV_DEV) \
|
||||||
\
|
\
|
||||||
|
|
Loading…
Add table
Reference in a new issue