recipes-bsp: u-boot: boot-scripts: update boot scripts to use new 'bootcount' mechanism

The 'bootcount' value is now incremented and stored in the system on every boot and
not only then the 'upgrade_available' flag is set. Also, ensure the value is cleared
when the 'altboot' script is executed by running the new U-Boot command 'bootcount reset'.

https://onedigi.atlassian.net/browse/DEL-8506

Signed-off-by: David Escalona <david.escalona@digi.com>
This commit is contained in:
David Escalona 2023-07-25 17:15:25 +02:00
parent 32078060f7
commit 88f74279b1
15 changed files with 217 additions and 259 deletions

View File

@ -10,7 +10,6 @@
# * run the regular boot command
if test "${dualboot}" = "yes" && test "${upgrade_available}" = "1"; then
echo "## Update failed; Rolling back to previous version."
if test "${active_system}" = "linux_a"; then
setenv active_system linux_b
part number mmc ${mmcbootdev} linux_b linux_b_index
@ -33,5 +32,6 @@ if test "${dualboot}" = "yes" && test "${upgrade_available}" = "1"; then
setenv upgrade_available
setenv bootcount 0
saveenv
echo "## System boot failed; Switching active partitions bank to ${active_system}..."
fi
run bootcmd

View File

@ -1,16 +1,15 @@
#
# U-Boot bootscript for altbootcmd (dual boot fallback after retries)
# U-Boot bootscript for altbootcmd (boot fallback after N failed boot retries)
#
# After an upgrade, active_system has changed. U-Boot tries to boot this system
# for a number of tries. If the limit is reached, altbootcmd is run instead.
# This is the script that it will run. It has to:
# * switch back to previous system
# * reset the firmware update flag
# * run the regular boot command
# U-Boot tries to boot the active system for a number of tries. If the limit
# is reached, altbootcmd is run instead. This is the script that it will run.
# It has to:
# * switch active partitions bank in case of dual boot systems
# * reset the 'bootcount' number
# * reboot the system
if test "${dualboot}" = "yes" && test "${upgrade_available}" = "1"; then
echo "## Update failed; Rolling back to previous version."
if test "${dualboot}" = "yes"; then
if test "${active_system}" = "linux_a"; then
setenv active_system linux_b
setenv mtdbootpart ${active_system}
@ -22,8 +21,8 @@ if test "${dualboot}" = "yes" && test "${upgrade_available}" = "1"; then
setenv mtdrootfspart ${rootfsvol_a}
setenv rootfsvol ${rootfsvol_a}
fi
setenv upgrade_available
setenv bootcount 0
saveenv
echo "## System boot failed; Switching active partitions bank to ${active_system}..."
fi
run bootcmd
bootcount reset
reset

View File

@ -2,29 +2,25 @@
# U-Boot bootscript for NAND images created by Yocto.
#
# As the first step in the boot script, check if we are using DualBoot and
# if an upgrade is available. This requires the script to change some variables
# and save them, while the rest of the script changes variables only temporarily
# without saving them.
# As the first step in the boot script, check if we are using DualBoot. This
# requires the script to change some variables and save them, while the rest
# of the script changes variables only temporarily without saving them.
# Dual boot update verification
# Dual boot verification
if test "${dualboot}" = "yes"; then
if test "${upgrade_available}" = "1"; then
echo "Update detected; Booting new system in ${active_system} (try ${bootcount})"
if test "${active_system}" = "linux_a"; then
echo "Booting from system A (try ${bootcount})"
setenv mtdbootpart ${active_system}
setenv mtdrootfspart ${rootfsvol_a}
setenv rootfsvol ${rootfsvol_a}
else
if test "${active_system}" = "linux_a"; then
echo "Booting from system A"
setenv mtdbootpart ${active_system}
setenv mtdrootfspart ${rootfsvol_a}
setenv rootfsvol ${rootfsvol_a}
else
echo "Booting from system B"
setenv mtdbootpart ${active_system}
setenv mtdrootfspart ${rootfsvol_b}
setenv rootfsvol ${rootfsvol_b}
fi
echo "Booting from system B (try ${bootcount})"
setenv mtdbootpart ${active_system}
setenv mtdrootfspart ${rootfsvol_b}
setenv rootfsvol ${rootfsvol_b}
fi
else
echo "Booting system (try ${bootcount})"
if test "${mtdbootpart}" = "recovery"; then
setenv boot_initrd true
setenv initrd_file uramdisk-recovery.img

View File

@ -2,29 +2,25 @@
# U-Boot bootscript for NAND images created by Yocto.
#
# As the first step in the boot script, check if we are using DualBoot and
# if an upgrade is available. This requires the script to change some variables
# and save them, while the rest of the script changes variables only temporarily
# without saving them.
# As the first step in the boot script, check if we are using DualBoot. This
# requires the script to change some variables and save them, while the rest
# of the script changes variables only temporarily without saving them.
# Dual boot update verification
# Dual boot verification
if test "${dualboot}" = "yes"; then
if test "${upgrade_available}" = "1"; then
echo "Update detected; Booting new system in ${active_system} (try ${bootcount})"
if test "${active_system}" = "linux_a"; then
echo "Booting from system A (try ${bootcount})"
setenv mtdbootpart ${active_system}
setenv mtdrootfspart ${rootfsvol_a}
setenv rootfsvol ${rootfsvol_a}
else
if test "${active_system}" = "linux_a"; then
echo "Booting from system A"
setenv mtdbootpart ${active_system}
setenv mtdrootfspart ${rootfsvol_a}
setenv rootfsvol ${rootfsvol_a}
else
echo "Booting from system B"
setenv mtdbootpart ${active_system}
setenv mtdrootfspart ${rootfsvol_b}
setenv rootfsvol ${rootfsvol_b}
fi
echo "Booting from system B (try ${bootcount})"
setenv mtdbootpart ${active_system}
setenv mtdrootfspart ${rootfsvol_b}
setenv rootfsvol ${rootfsvol_b}
fi
else
echo "Booting system (try ${bootcount})"
if test "${mtdbootpart}" = "recovery"; then
setenv boot_initrd true
setenv initrd_file uramdisk-recovery.img

View File

@ -1,16 +1,15 @@
#
# U-Boot bootscript for altbootcmd (dual boot fallback after retries)
# U-Boot bootscript for altbootcmd (boot fallback after N failed boot retries)
#
# After an upgrade, active_system has changed. U-Boot tries to boot this system
# for a number of tries. If the limit is reached, altbootcmd is run instead.
# This is the script that it will run. It has to:
# * switch back to previous system
# * reset the firmware update flag
# * run the regular boot command
# U-Boot tries to boot the active system for a number of tries. If the limit
# is reached, altbootcmd is run instead. This is the script that it will run.
# It has to:
# * switch active partitions bank in case of dual boot systems
# * reset the 'bootcount' number
# * reboot the system
if test "${dualboot}" = "yes" && test "${upgrade_available}" = "1"; then
echo "## Update failed; Rolling back to previous version."
if test "${dualboot}" = "yes"; then
if test "${active_system}" = "linux_a"; then
setenv active_system linux_b
part number mmc ${mmcbootdev} linux_b linux_b_index
@ -30,8 +29,8 @@ if test "${dualboot}" = "yes" && test "${upgrade_available}" = "1"; then
part uuid mmc ${mmcbootdev}:${rootfs_a_index} mmcroot_a
setenv mmcroot PARTUUID=${mmcroot_a}
fi
setenv upgrade_available
setenv bootcount 0
saveenv
echo "## System boot failed; Switching active partitions bank to ${active_system}..."
fi
run bootcmd
bootcount reset
reset

View File

@ -2,37 +2,33 @@
# U-Boot bootscript for EMMC/SD images created by Yocto.
#
# As the first step in the boot script, check if we are using DualBoot and
# if an upgrade is available. This requires the script to change some variables
# and save them, while the rest of the script changes variables only temporarily
# without saving them.
# As the first step in the boot script, check if we are using DualBoot. This
# requires the script to change some variables and save them, while the rest
# of the script changes variables only temporarily without saving them.
# Dual boot update verification
# Dual boot verification
if test "${dualboot}" = "yes"; then
if test "${upgrade_available}" = "1"; then
echo "Update detected; Booting new system in ${active_system} (try ${bootcount})"
if test "${active_system}" = "linux_a"; then
echo "Booting from system A (try ${bootcount})"
part number mmc ${mmcbootdev} linux_a pi
setenv mmcpart ${pi}
# Save the partition index on variable rootfs_a_index
part number mmc ${mmcbootdev} rootfs_a rootfs_a_index
# Save the rootfs_a UUID into mmcroot_a
part uuid mmc ${mmcbootdev}:${rootfs_a_index} mmcroot_a
setenv mmcroot PARTUUID=${mmcroot_a}
else
if test "${active_system}" = "linux_a"; then
echo "Booting from system A"
part number mmc ${mmcbootdev} linux_a pi
setenv mmcpart ${pi}
# Save the partition index on variable rootfs_a_index
part number mmc ${mmcbootdev} rootfs_a rootfs_a_index
# Save the rootfs_a UUID into mmcroot_a
part uuid mmc ${mmcbootdev}:${rootfs_a_index} mmcroot_a
setenv mmcroot PARTUUID=${mmcroot_a}
else
echo "Booting from system B"
part number mmc ${mmcbootdev} linux_b pi
setenv mmcpart ${pi}
# Save the partition index on variable rootfs_b_index
part number mmc ${mmcbootdev} rootfs_b rootfs_b_index
# Save the rootfs_b UUID into mmcroot_b
part uuid mmc ${mmcbootdev}:${rootfs_b_index} mmcroot_b
setenv mmcroot PARTUUID=${mmcroot_b}
fi
echo "Booting from system B (try ${bootcount})"
part number mmc ${mmcbootdev} linux_b pi
setenv mmcpart ${pi}
# Save the partition index on variable rootfs_b_index
part number mmc ${mmcbootdev} rootfs_b rootfs_b_index
# Save the rootfs_b UUID into mmcroot_b
part uuid mmc ${mmcbootdev}:${rootfs_b_index} mmcroot_b
setenv mmcroot PARTUUID=${mmcroot_b}
fi
else
echo "Booting system (try ${bootcount})"
# Get the UUID of the configured boot partition.
part uuid mmc ${mmcbootdev}:${mmcpart} bootpart
# Check the boot source.

View File

@ -2,37 +2,33 @@
# U-Boot bootscript for EMMC/SD images created by Yocto.
#
# As the first step in the boot script, check if we are using DualBoot and
# if an upgrade is available. This requires the script to change some variables
# and save them, while the rest of the script changes variables only temporarily
# without saving them.
# As the first step in the boot script, check if we are using DualBoot. This
# requires the script to change some variables and save them, while the rest
# of the script changes variables only temporarily without saving them.
# Dual boot update verification
# Dual boot verification
if test "${dualboot}" = "yes"; then
if test "${upgrade_available}" = "1"; then
echo "Update detected; Booting new system in ${active_system} (try ${bootcount})"
if test "${active_system}" = "linux_a"; then
echo "Booting from system A (try ${bootcount})"
part number mmc ${mmcbootdev} linux_a pi
setenv mmcpart ${pi}
# Save the partition index on variable rootfs_a_index
part number mmc ${mmcbootdev} rootfs_a rootfs_a_index
# Save the rootfs_a UUID into mmcroot_a
part uuid mmc ${mmcbootdev}:${rootfs_a_index} mmcroot_a
setenv mmcroot PARTUUID=${mmcroot_a}
else
if test "${active_system}" = "linux_a"; then
echo "Booting from system A"
part number mmc ${mmcbootdev} linux_a pi
setenv mmcpart ${pi}
# Save the partition index on variable rootfs_a_index
part number mmc ${mmcbootdev} rootfs_a rootfs_a_index
# Save the rootfs_a UUID into mmcroot_a
part uuid mmc ${mmcbootdev}:${rootfs_a_index} mmcroot_a
setenv mmcroot PARTUUID=${mmcroot_a}
else
echo "Booting from system B"
part number mmc ${mmcbootdev} linux_b pi
setenv mmcpart ${pi}
# Save the partition index on variable rootfs_b_index
part number mmc ${mmcbootdev} rootfs_b rootfs_b_index
# Save the rootfs_b UUID into mmcroot_b
part uuid mmc ${mmcbootdev}:${rootfs_b_index} mmcroot_b
setenv mmcroot PARTUUID=${mmcroot_b}
fi
echo "Booting from system B (try ${bootcount})"
part number mmc ${mmcbootdev} linux_b pi
setenv mmcpart ${pi}
# Save the partition index on variable rootfs_b_index
part number mmc ${mmcbootdev} rootfs_b rootfs_b_index
# Save the rootfs_b UUID into mmcroot_b
part uuid mmc ${mmcbootdev}:${rootfs_b_index} mmcroot_b
setenv mmcroot PARTUUID=${mmcroot_b}
fi
else
echo "Booting system (try ${bootcount})"
# Get the UUID of the configured boot partition.
part uuid mmc ${mmcbootdev}:${mmcpart} bootpart
# Check the boot source.

View File

@ -2,37 +2,33 @@
# U-Boot bootscript for EMMC/SD images created by Yocto.
#
# As the first step in the boot script, check if we are using DualBoot and
# if an upgrade is available. This requires the script to change some variables
# and save them, while the rest of the script changes variables only temporarily
# without saving them.
# As the first step in the boot script, check if we are using DualBoot. This
# requires the script to change some variables and save them, while the rest
# of the script changes variables only temporarily without saving them.
# Dual boot update verification
# Dual boot verification
if test "${dualboot}" = "yes"; then
if test "${upgrade_available}" = "1"; then
echo "Update detected; Booting new system in ${active_system} (try ${bootcount})"
if test "${active_system}" = "linux_a"; then
echo "Booting from system A (try ${bootcount})"
part number mmc ${mmcbootdev} linux_a pi
setenv mmcpart ${pi}
# Save the partition index on variable rootfs_a_index
part number mmc ${mmcbootdev} rootfs_a rootfs_a_index
# Save the rootfs_a UUID into mmcroot_a
part uuid mmc ${mmcbootdev}:${rootfs_a_index} mmcroot_a
setenv mmcroot PARTUUID=${mmcroot_a}
else
if test "${active_system}" = "linux_a"; then
echo "Booting from system A"
part number mmc ${mmcbootdev} linux_a pi
setenv mmcpart ${pi}
# Save the partition index on variable rootfs_a_index
part number mmc ${mmcbootdev} rootfs_a rootfs_a_index
# Save the rootfs_a UUID into mmcroot_a
part uuid mmc ${mmcbootdev}:${rootfs_a_index} mmcroot_a
setenv mmcroot PARTUUID=${mmcroot_a}
else
echo "Booting from system B"
part number mmc ${mmcbootdev} linux_b pi
setenv mmcpart ${pi}
# Save the partition index on variable rootfs_b_index
part number mmc ${mmcbootdev} rootfs_b rootfs_b_index
# Save the rootfs_b UUID into mmcroot_b
part uuid mmc ${mmcbootdev}:${rootfs_b_index} mmcroot_b
setenv mmcroot PARTUUID=${mmcroot_b}
fi
echo "Booting from system B (try ${bootcount})"
part number mmc ${mmcbootdev} linux_b pi
setenv mmcpart ${pi}
# Save the partition index on variable rootfs_b_index
part number mmc ${mmcbootdev} rootfs_b rootfs_b_index
# Save the rootfs_b UUID into mmcroot_b
part uuid mmc ${mmcbootdev}:${rootfs_b_index} mmcroot_b
setenv mmcroot PARTUUID=${mmcroot_b}
fi
else
echo "Booting system (try ${bootcount})"
# Get the UUID of the configured boot partition.
part uuid mmc ${mmcbootdev}:${mmcpart} bootpart
# Check the boot source.

View File

@ -2,37 +2,33 @@
# U-Boot bootscript for EMMC/SD images created by Yocto.
#
# As the first step in the boot script, check if we are using DualBoot and
# if an upgrade is available. This requires the script to change some variables
# and save them, while the rest of the script changes variables only temporarily
# without saving them.
# As the first step in the boot script, check if we are using DualBoot. This
# requires the script to change some variables and save them, while the rest
# of the script changes variables only temporarily without saving them.
# Dual boot update verification
# Dual boot verification
if test "${dualboot}" = "yes"; then
if test "${upgrade_available}" = "1"; then
echo "Update detected; Booting new system in ${active_system} (try ${bootcount})"
if test "${active_system}" = "linux_a"; then
echo "Booting from system A (try ${bootcount})"
part number mmc ${mmcbootdev} linux_a pi
setenv mmcpart ${pi}
# Save the partition index on variable rootfs_a_index
part number mmc ${mmcbootdev} rootfs_a rootfs_a_index
# Save the rootfs_a UUID into mmcroot_a
part uuid mmc ${mmcbootdev}:${rootfs_a_index} mmcroot_a
setenv mmcroot PARTUUID=${mmcroot_a}
else
if test "${active_system}" = "linux_a"; then
echo "Booting from system A"
part number mmc ${mmcbootdev} linux_a pi
setenv mmcpart ${pi}
# Save the partition index on variable rootfs_a_index
part number mmc ${mmcbootdev} rootfs_a rootfs_a_index
# Save the rootfs_a UUID into mmcroot_a
part uuid mmc ${mmcbootdev}:${rootfs_a_index} mmcroot_a
setenv mmcroot PARTUUID=${mmcroot_a}
else
echo "Booting from system B"
part number mmc ${mmcbootdev} linux_b pi
setenv mmcpart ${pi}
# Save the partition index on variable rootfs_b_index
part number mmc ${mmcbootdev} rootfs_b rootfs_b_index
# Save the rootfs_b UUID into mmcroot_b
part uuid mmc ${mmcbootdev}:${rootfs_b_index} mmcroot_b
setenv mmcroot PARTUUID=${mmcroot_b}
fi
echo "Booting from system B (try ${bootcount})"
part number mmc ${mmcbootdev} linux_b pi
setenv mmcpart ${pi}
# Save the partition index on variable rootfs_b_index
part number mmc ${mmcbootdev} rootfs_b rootfs_b_index
# Save the rootfs_b UUID into mmcroot_b
part uuid mmc ${mmcbootdev}:${rootfs_b_index} mmcroot_b
setenv mmcroot PARTUUID=${mmcroot_b}
fi
else
echo "Booting system (try ${bootcount})"
# Get the UUID of the configured boot partition.
part uuid mmc ${mmcbootdev}:${mmcpart} bootpart
# Check the boot source.

View File

@ -1,16 +1,15 @@
#
# U-Boot bootscript for altbootcmd (dual boot fallback after retries)
# U-Boot bootscript for altbootcmd (boot fallback after N failed boot retries)
#
# After an upgrade, active_system has changed. U-Boot tries to boot this system
# for a number of tries. If the limit is reached, altbootcmd is run instead.
# This is the script that it will run. It has to:
# * switch back to previous system
# * reset the firmware update flag
# * run the regular boot command
# U-Boot tries to boot the active system for a number of tries. If the limit
# is reached, altbootcmd is run instead. This is the script that it will run.
# It has to:
# * switch active partitions bank in case of dual boot systems
# * reset the 'bootcount' number
# * reboot the system
if test "${dualboot}" = "yes" && test "${upgrade_available}" = "1"; then
echo "## Update failed; Rolling back to previous version."
if test "${dualboot}" = "yes"; then
if test "${active_system}" = "linux_a"; then
setenv active_system linux_b
part number mmc ${mmcbootdev} linux_b linux_b_index
@ -30,8 +29,8 @@ if test "${dualboot}" = "yes" && test "${upgrade_available}" = "1"; then
part uuid mmc ${mmcbootdev}:${rootfs_a_index} mmcroot_a
setenv mmcroot PARTUUID=${mmcroot_a}
fi
setenv upgrade_available
setenv bootcount 0
saveenv
echo "## System boot failed; Switching active partitions bank to ${active_system}..."
fi
run bootcmd
bootcount reset
reset

View File

@ -2,41 +2,36 @@
# U-Boot bootscript for EMMC/SD images created by Yocto.
#
# As the first step in the boot script, check if we are using DualBoot and
# if an upgrade is available. This requires the script to change some variables
# and save them, while the rest of the script changes variables only temporarily
# without saving them.
# As the first step in the boot script, check if we are using DualBoot. This
# requires the script to change some variables and save them, while the rest
# of the script changes variables only temporarily without saving them.
# Pre step: check if we boot from uSD.
if test "${mmcbootdev}" = "1"; then
# We are booting from the SD card.
setenv mmcroot /dev/mmcblk${mmcbootdev}p2
elif test "${dualboot}" = "yes"; then
# Dual boot update verification
if test "${upgrade_available}" = "1"; then
echo "Update detected; Booting new system in ${active_system} (try ${bootcount})"
if test "${active_system}" = "linux_a"; then
echo "Booting from system A (try ${bootcount})"
part number mmc ${mmcbootdev} linux_a pi
setenv mmcpart ${pi}
# Save the partition index on variable rootfs_a_index
part number mmc ${mmcbootdev} rootfs_a rootfs_a_index
# Save the rootfs_a UUID into mmcroot_a
part uuid mmc ${mmcbootdev}:${rootfs_a_index} mmcroot_a
setenv mmcroot PARTUUID=${mmcroot_a}
else
if test "${active_system}" = "linux_a"; then
echo "Booting from system A"
part number mmc ${mmcbootdev} linux_a pi
setenv mmcpart ${pi}
# Save the partition index on variable rootfs_a_index
part number mmc ${mmcbootdev} rootfs_a rootfs_a_index
# Save the rootfs_a UUID into mmcroot_a
part uuid mmc ${mmcbootdev}:${rootfs_a_index} mmcroot_a
setenv mmcroot PARTUUID=${mmcroot_a}
else
echo "Booting from system B"
part number mmc ${mmcbootdev} linux_b pi
setenv mmcpart ${pi}
# Save the partition index on variable rootfs_b_index
part number mmc ${mmcbootdev} rootfs_b rootfs_b_index
# Save the rootfs_b UUID into mmcroot_b
part uuid mmc ${mmcbootdev}:${rootfs_b_index} mmcroot_b
setenv mmcroot PARTUUID=${mmcroot_b}
fi
echo "Booting from system B (try ${bootcount})"
part number mmc ${mmcbootdev} linux_b pi
setenv mmcpart ${pi}
# Save the partition index on variable rootfs_b_index
part number mmc ${mmcbootdev} rootfs_b rootfs_b_index
# Save the rootfs_b UUID into mmcroot_b
part uuid mmc ${mmcbootdev}:${rootfs_b_index} mmcroot_b
setenv mmcroot PARTUUID=${mmcroot_b}
fi
else
echo "Booting system (try ${bootcount})"
# Get the UUID of the configured boot partition.
part uuid mmc ${mmcbootdev}:${mmcpart} bootpart
# Check the boot source.

View File

@ -1,16 +1,15 @@
#
# U-Boot bootscript for altbootcmd (dual boot fallback after retries)
# U-Boot bootscript for altbootcmd (boot fallback after N failed boot retries)
#
# After an upgrade, active_system has changed. U-Boot tries to boot this system
# for a number of tries. If the limit is reached, altbootcmd is run instead.
# This is the script that it will run. It has to:
# * switch back to previous system
# * reset the firmware update flag
# * run the regular boot command
# U-Boot tries to boot the active system for a number of tries. If the limit
# is reached, altbootcmd is run instead. This is the script that it will run.
# It has to:
# * switch active partitions bank in case of dual boot systems
# * reset the 'bootcount' number
# * reboot the system
if test "${dualboot}" = "yes" && test "${upgrade_available}" = "1"; then
echo "## Update failed; Rolling back to previous version."
if test "${dualboot}" = "yes"; then
if test "${active_system}" = "linux_a"; then
setenv active_system linux_b
part number mmc ${mmcbootdev} linux_b linux_b_index
@ -30,8 +29,8 @@ if test "${dualboot}" = "yes" && test "${upgrade_available}" = "1"; then
part uuid mmc ${mmcbootdev}:${rootfs_a_index} mmcroot_a
setenv mmcroot PARTUUID=${mmcroot_a}
fi
setenv upgrade_available
setenv bootcount 0
saveenv
echo "## System boot failed; Switching active partitions bank to ${active_system}..."
fi
run bootcmd
bootcount reset
reset

View File

@ -1,16 +1,15 @@
#
# U-Boot bootscript for altbootcmd (dual boot fallback after retries)
# U-Boot bootscript for altbootcmd (boot fallback after N failed boot retries)
#
# After an upgrade, active_system has changed. U-Boot tries to boot this system
# for a number of tries. If the limit is reached, altbootcmd is run instead.
# This is the script that it will run. It has to:
# * switch back to previous system
# * reset the firmware update flag
# * run the regular boot command
# U-Boot tries to boot the active system for a number of tries. If the limit
# is reached, altbootcmd is run instead. This is the script that it will run.
# It has to:
# * switch active partitions bank in case of dual boot systems
# * reset the 'bootcount' number
# * reboot the system
if test "${dualboot}" = "yes" && test "${upgrade_available}" = "1"; then
echo "## Update failed; Rolling back to previous version."
if test "${dualboot}" = "yes"; then
if test "${active_system}" = "linux_a"; then
setenv active_system linux_b
setenv mtdbootpart ${active_system}
@ -20,8 +19,8 @@ if test "${dualboot}" = "yes" && test "${upgrade_available}" = "1"; then
setenv mtdbootpart ${active_system}
setenv rootfsvol ${rootfsvol_a}
fi
setenv upgrade_available
setenv bootcount 0
saveenv
echo "## System boot failed; Switching active partitions bank to ${active_system}..."
fi
run bootcmd
bootcount reset
reset

View File

@ -2,27 +2,23 @@
# U-Boot bootscript for NAND/SD images created by Yocto.
#
# As the first step in the boot script, check if we are using DualBoot and
# if an upgrade is available. This requires the script to change some variables
# and save them, while the rest of the script changes variables only temporarily
# without saving them.
# As the first step in the boot script, check if we are using DualBoot. This
# requires the script to change some variables and save them, while the rest
# of the script changes variables only temporarily without saving them.
# Dual boot update verification
# Dual boot verification
if test "${dualboot}" = "yes"; then
if test "${upgrade_available}" = "1"; then
echo "Update detected; Booting new system in ${active_system} (try ${bootcount})"
if test "${active_system}" = "linux_a"; then
echo "Booting from system A (try ${bootcount})"
setenv mtdbootpart ${active_system}
setenv rootfsvol ${rootfsvol_a}
else
if test "${active_system}" = "linux_a"; then
echo "Booting from system A"
setenv mtdbootpart ${active_system}
setenv rootfsvol ${rootfsvol_a}
else
echo "Booting from system B"
setenv mtdbootpart ${active_system}
setenv rootfsvol ${rootfsvol_b}
fi
echo "Booting from system B (try ${bootcount})"
setenv mtdbootpart ${active_system}
setenv rootfsvol ${rootfsvol_b}
fi
else
echo "Booting system (try ${bootcount})"
# Check the boot source.
if test "${mtdbootpart}" = "linux"; then
# We are booting from the NAND using 'linux'.

View File

@ -2,27 +2,23 @@
# U-Boot bootscript for NAND/SD images created by Yocto.
#
# As the first step in the boot script, check if we are using DualBoot and
# if an upgrade is available. This requires the script to change some variables
# and save them, while the rest of the script changes variables only temporarily
# without saving them.
# As the first step in the boot script, check if we are using DualBoot. This
# requires the script to change some variables and save them, while the rest
# of the script changes variables only temporarily without saving them.
# Dual boot update verification
# Dual boot verification
if test "${dualboot}" = "yes"; then
if test "${upgrade_available}" = "1"; then
echo "Update detected; Booting new system in ${active_system} (try ${bootcount})"
if test "${active_system}" = "linux_a"; then
echo "Booting from system A (try ${bootcount})"
setenv mtdbootpart ${active_system}
setenv rootfsvol ${rootfsvol_a}
else
if test "${active_system}" = "linux_a"; then
echo "Booting from system A"
setenv mtdbootpart ${active_system}
setenv rootfsvol ${rootfsvol_a}
else
echo "Booting from system B"
setenv mtdbootpart ${active_system}
setenv rootfsvol ${rootfsvol_b}
fi
echo "Booting from system B (try ${bootcount})"
setenv mtdbootpart ${active_system}
setenv rootfsvol ${rootfsvol_b}
fi
else
echo "Booting system (try ${bootcount})"
# Check the boot source.
if test "${mtdbootpart}" = "linux"; then
# We are booting from the NAND using 'linux'.