installer scripts: cover case where U-Boot env does not exist

The U-Boot environment resides on a UBI volume. The uuu script
relies on the environment to save part of the commands that
U-Boot needs to execute after reboot in the middle of the
installation. If the UBI volume 'uboot_config' does not exist
the installer fails.

This commit:
- Creates a function -on the uuu script only- for obtaining
  the result of running any U-Boot command (0=success, 1=error).
- Checks the existance of 'uboot_config' volume.
- Runs 'ubivolscript' script to create the UBI volumes layout
  that generates the environment volume if it doesn't exist.
- Increases the timeout for running the 'ubivolscript' since
  there are occasions in which 'ubi part' (which is part of the
  script) takes more time (if it cannot find the fastmap).

Signed-off-by: Hector Palacios <hector.palacios@digi.com>
This commit is contained in:
Hector Palacios 2022-11-15 11:51:50 +01:00
parent 26535326f9
commit 2cf902f8d7
3 changed files with 35 additions and 1 deletions

View File

@ -119,6 +119,14 @@ if test $? -eq 1; then
exit;
fi
# Check if uboot_config volume exists (U-Boot env)
ubi part UBI
ubi check uboot_config
if test $? -eq 1; then
# Create volumes layout (including U-Boot env)
run ubivolscript;
fi
# Set 'bootcmd' to the second part of the script that will
# - Reset environment to defaults
# - Restore 'dualboot' if previously set

View File

@ -119,6 +119,14 @@ if test $? -eq 1; then
exit;
fi
# Check if uboot_config volume exists (U-Boot env)
ubi part UBI
ubi check uboot_config
if test $? -eq 1; then
# Create volumes layout (including U-Boot env)
run ubivolscript;
fi
# Set 'bootcmd' to the second part of the script that will
# - Reset environment to defaults
# - Restore 'dualboot' if previously set

View File

@ -27,6 +27,12 @@ getenv()
uuu -v fb: ucmd printenv "${1}" | sed -ne "s,^${1}=,,g;T;p"
}
check_cmd()
{
uuu -v fb: acmd ${1} > /dev/null 2> /dev/null
uuu -v fb: ucmd echo retval=\$? | sed -ne "s,^retval=,,g;T;p"
}
show_usage()
{
echo "Usage: $0 [options]"
@ -93,6 +99,13 @@ if [ "${dualboot}" = "yes" ]; then
DUALBOOT=true;
fi
# Check if uboot_config volume exists (U-Boot env)
uuu "fb[-t 15000]:" ucmd ubi part UBI
check=$(check_cmd "ubi check uboot_config")
if [ "${check}" = "1" ]; then
RUNVOLS=true
fi
# remove redirect
uuu fb: ucmd setenv stdout serial
@ -193,6 +206,11 @@ part_update "fsbl2" "${INSTALL_ATF_FILENAME}" 5000
part_update "fip-a" "${INSTALL_FIP_FILENAME}" 5000
part_update "fip-b" "${INSTALL_FIP_FILENAME}" 5000
# Environment volume does not exist and needs to be created
if [ "${RUNVOLS}" = true ]; then
# Create UBI volumes
uuu "fb[-t 45000]:" ucmd run ubivolscript
fi
# Set 'bootcmd' for the second part of the script that will
# - Reset environment to defaults
@ -223,7 +241,7 @@ sleep 8
uuu fb: ucmd setenv fastboot_buffer \${loadaddr}
# Create UBI volumes
uuu "fb[-t 20000]:" ucmd run ubivolscript
uuu "fb[-t 45000]:" ucmd run ubivolscript
if [ "${DUALBOOT}" = true ]; then
# Update Linux A