u-boot-dey: restore modified env vars in case of error on bootscript
The boot script appends values to certain variables such as $extra_bootargs and $overlays. If the final instruction of the boot script (dboot command) fails, these variables contain the new values, plus the original one. Since the user recovers the prompt, he may do a 'saveenv' to save the environment, and the modified variables will be saved, only to be enlarged again on the next boot. This can lead to repeated strings on such variables. Save the original value and restore it in case of failure on the dboot command. Signed-off-by: Hector Palacios <hector.palacios@digi.com>
This commit is contained in:
parent
23b7815c17
commit
2ade93d8eb
|
|
@ -2,6 +2,9 @@
|
||||||
# U-Boot bootscript for EMMC/SD images created by Yocto.
|
# U-Boot bootscript for EMMC/SD images created by Yocto.
|
||||||
#
|
#
|
||||||
|
|
||||||
|
# Back up environment variables
|
||||||
|
setenv ORIG_extra_bootargs ${extra_bootargs}
|
||||||
|
|
||||||
#
|
#
|
||||||
# Set device tree filename depending on the board ID (if defined)
|
# Set device tree filename depending on the board ID (if defined)
|
||||||
#
|
#
|
||||||
|
|
@ -34,3 +37,11 @@ else
|
||||||
fi
|
fi
|
||||||
setenv extra_bootargs fbcon=logo-pos:center ${extra_bootargs}
|
setenv extra_bootargs fbcon=logo-pos:center ${extra_bootargs}
|
||||||
dboot linux mmc ${mmcbootdev}:${mmcpart}
|
dboot linux mmc ${mmcbootdev}:${mmcpart}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# We only get here in case of an error on the dboot command.
|
||||||
|
|
||||||
|
# Undo changes to environment variables
|
||||||
|
setenv extra_bootargs ${ORIG_extra_bootargs}
|
||||||
|
setenv ORIG_extra_bootargs
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,9 @@
|
||||||
# U-Boot bootscript for EMMC/SD images created by Yocto.
|
# U-Boot bootscript for EMMC/SD images created by Yocto.
|
||||||
#
|
#
|
||||||
|
|
||||||
|
# Back up environment variables
|
||||||
|
setenv ORIG_extra_bootargs ${extra_bootargs}
|
||||||
|
|
||||||
#
|
#
|
||||||
# Set device tree filename depending on the board ID (if defined)
|
# Set device tree filename depending on the board ID (if defined)
|
||||||
#
|
#
|
||||||
|
|
@ -64,3 +67,11 @@ else
|
||||||
fi
|
fi
|
||||||
setenv extra_bootargs fbcon=logo-pos:center ${extra_bootargs}
|
setenv extra_bootargs fbcon=logo-pos:center ${extra_bootargs}
|
||||||
dboot linux mmc ${mmcbootdev}:${mmcpart}
|
dboot linux mmc ${mmcbootdev}:${mmcpart}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# We only get here in case of an error on the dboot command.
|
||||||
|
|
||||||
|
# Undo changes to environment variables
|
||||||
|
setenv extra_bootargs ${ORIG_extra_bootargs}
|
||||||
|
setenv ORIG_extra_bootargs
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,9 @@
|
||||||
# U-Boot bootscript for NAND images created by Yocto.
|
# U-Boot bootscript for NAND images created by Yocto.
|
||||||
#
|
#
|
||||||
|
|
||||||
|
# Back up environment variables
|
||||||
|
setenv ORIG_extra_bootargs ${extra_bootargs}
|
||||||
|
|
||||||
#
|
#
|
||||||
# Set device tree filename depending on the board ID (if defined)
|
# Set device tree filename depending on the board ID (if defined)
|
||||||
#
|
#
|
||||||
|
|
@ -28,3 +31,11 @@ else
|
||||||
fi
|
fi
|
||||||
setenv extra_bootargs fbcon=logo-pos:center ${extra_bootargs}
|
setenv extra_bootargs fbcon=logo-pos:center ${extra_bootargs}
|
||||||
dboot linux nand ${mtdbootpart}
|
dboot linux nand ${mtdbootpart}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# We only get here in case of an error on the dboot command.
|
||||||
|
|
||||||
|
# Undo changes to environment variables
|
||||||
|
setenv extra_bootargs ${ORIG_extra_bootargs}
|
||||||
|
setenv ORIG_extra_bootargs
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,9 @@
|
||||||
# U-Boot bootscript for NAND images created by Yocto.
|
# U-Boot bootscript for NAND images created by Yocto.
|
||||||
#
|
#
|
||||||
|
|
||||||
|
# Back up environment variables
|
||||||
|
setenv ORIG_extra_bootargs ${extra_bootargs}
|
||||||
|
|
||||||
#
|
#
|
||||||
# Set device tree filename depending on the board ID (if defined)
|
# Set device tree filename depending on the board ID (if defined)
|
||||||
#
|
#
|
||||||
|
|
@ -28,3 +31,11 @@ else
|
||||||
fi
|
fi
|
||||||
setenv extra_bootargs fbcon=logo-pos:center ${extra_bootargs}
|
setenv extra_bootargs fbcon=logo-pos:center ${extra_bootargs}
|
||||||
dboot linux nand ${mtdbootpart}
|
dboot linux nand ${mtdbootpart}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# We only get here in case of an error on the dboot command.
|
||||||
|
|
||||||
|
# Undo changes to environment variables
|
||||||
|
setenv extra_bootargs ${ORIG_extra_bootargs}
|
||||||
|
setenv ORIG_extra_bootargs
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,10 @@
|
||||||
# U-Boot bootscript for EMMC/SD images created by Yocto.
|
# U-Boot bootscript for EMMC/SD images created by Yocto.
|
||||||
#
|
#
|
||||||
|
|
||||||
|
# Back up environment variables
|
||||||
|
setenv ORIG_overlays ${overlays}
|
||||||
|
setenv ORIG_extra_bootargs ${extra_bootargs}
|
||||||
|
|
||||||
# Set SOC type to "imx8mn" if not already defined by U-Boot
|
# Set SOC type to "imx8mn" if not already defined by U-Boot
|
||||||
if test ! -n "${soc_type}"; then
|
if test ! -n "${soc_type}"; then
|
||||||
setenv soc_type "imx8mn"
|
setenv soc_type "imx8mn"
|
||||||
|
|
@ -54,3 +58,13 @@ else
|
||||||
fi
|
fi
|
||||||
setenv extra_bootargs fbcon=logo-pos:center ${extra_bootargs}
|
setenv extra_bootargs fbcon=logo-pos:center ${extra_bootargs}
|
||||||
dboot linux mmc ${mmcbootdev}:${mmcpart}
|
dboot linux mmc ${mmcbootdev}:${mmcpart}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# We only get here in case of an error on the dboot command.
|
||||||
|
|
||||||
|
# Undo changes to environment variables
|
||||||
|
setenv overlays ${ORIG_overlays}
|
||||||
|
setenv ORIG_overlays
|
||||||
|
setenv extra_bootargs ${ORIG_extra_bootargs}
|
||||||
|
setenv ORIG_extra_bootargs
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,10 @@
|
||||||
# U-Boot bootscript for EMMC/SD images created by Yocto.
|
# U-Boot bootscript for EMMC/SD images created by Yocto.
|
||||||
#
|
#
|
||||||
|
|
||||||
|
# Back up environment variables
|
||||||
|
setenv ORIG_overlays ${overlays}
|
||||||
|
setenv ORIG_extra_bootargs ${extra_bootargs}
|
||||||
|
|
||||||
# Set SOC type to "imx8qxp" if not already defined by U-Boot
|
# Set SOC type to "imx8qxp" if not already defined by U-Boot
|
||||||
if test ! -n "${soc_type}"; then
|
if test ! -n "${soc_type}"; then
|
||||||
setenv soc_type "imx8qxp"
|
setenv soc_type "imx8qxp"
|
||||||
|
|
@ -57,3 +61,13 @@ else
|
||||||
fi
|
fi
|
||||||
setenv extra_bootargs fbcon=logo-pos:center ${extra_bootargs}
|
setenv extra_bootargs fbcon=logo-pos:center ${extra_bootargs}
|
||||||
dboot linux mmc ${mmcbootdev}:${mmcpart}
|
dboot linux mmc ${mmcbootdev}:${mmcpart}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# We only get here in case of an error on the dboot command.
|
||||||
|
|
||||||
|
# Undo changes to environment variables
|
||||||
|
setenv overlays ${ORIG_overlays}
|
||||||
|
setenv ORIG_overlays
|
||||||
|
setenv extra_bootargs ${ORIG_extra_bootargs}
|
||||||
|
setenv ORIG_extra_bootargs
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue