dualboot: move the logic of fallback boot to altbootcmd

U-Boot has embedded support to handle bootcount tries.
When the limit of tries is reached, U-Boot runs the script
in `altbootcmd` rather than the usual `bootcmd`.
This other script resides on meta-digi-dualboot layer.

Signed-off-by: Hector Palacios <hector.palacios@digi.com>
Signed-off-by: Francisco Gil <francisco.gilmartinez@digi.com>
This commit is contained in:
Francisco Gil 2021-10-08 12:51:45 +02:00 committed by Hector Palacios
parent 825dd6a555
commit e67ed06dd5
8 changed files with 0 additions and 178 deletions

View File

@ -11,30 +11,6 @@
if test "${dualboot}" = "yes"; then
if test "${upgrade_available}" = "1"; then
echo "Update detected; Booting new system (try ${bootcount})"
if test "${bootcount}" = "${bootlimit}"; then
echo "## Update failed; Rolling back to previous version."
if test "${active_system}" = "linux_a"; then
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}
setenv active_system linux_b
else
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}
setenv active_system linux_a
fi
setenv upgrade_available
saveenv
fi
else
if test "${active_system}" = "linux_a"; then
echo "Booting from system A"

View File

@ -11,30 +11,6 @@
if test "${dualboot}" = "yes"; then
if test "${upgrade_available}" = "1"; then
echo "Update detected; Booting new system (try ${bootcount})"
if test "${bootcount}" = "${bootlimit}"; then
echo "## Update failed; Rolling back to previous version."
if test "${active_system}" = "linux_a"; then
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}
setenv active_system linux_b
else
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}
setenv active_system linux_a
fi
setenv upgrade_available
saveenv
fi
else
if test "${active_system}" = "linux_a"; then
echo "Booting from system A"

View File

@ -11,23 +11,6 @@
if test "${dualboot}" = "yes"; then
if test "${upgrade_available}" = "1"; then
echo "Update detected; Booting new system (try ${bootcount})"
if test "${bootcount}" = "${bootlimit}"; then
echo "## Update failed; Rolling back to previous version."
if test "${mtdbootpart}" = "linux_a"; then
setenv mtdbootpart linux_b
setenv mtdlinuxindex ${mtdlinux_b_index}
setenv mtdrootfsindex ${mtdrootfs_b_index}
setenv rootfsvol ${rootfsvol_b}
else
setenv mtdbootpart linux_a
setenv mtdlinuxindex ${mtdlinux_a_index}
setenv mtdrootfsindex ${mtdrootfs_a_index}
setenv rootfsvol ${rootfsvol_a}
fi
setenv active_system ${mtdbootpart}
setenv upgrade_available
saveenv
fi
else
if test "${active_system}" = "linux_a"; then
echo "Booting from system A"

View File

@ -11,23 +11,6 @@
if test "${dualboot}" = "yes"; then
if test "${upgrade_available}" = "1"; then
echo "Update detected; Booting new system (try ${bootcount})"
if test "${bootcount}" = "${bootlimit}"; then
echo "## Update failed; Rolling back to previous version."
if test "${mtdbootpart}" = "linux_a"; then
setenv mtdbootpart linux_b
setenv mtdlinuxindex ${mtdlinux_b_index}
setenv mtdrootfsindex ${mtdrootfs_b_index}
setenv rootfsvol ${rootfsvol_b}
else
setenv mtdbootpart linux_a
setenv mtdlinuxindex ${mtdlinux_a_index}
setenv mtdrootfsindex ${mtdrootfs_a_index}
setenv rootfsvol ${rootfsvol_a}
fi
setenv active_system ${mtdbootpart}
setenv upgrade_available
saveenv
fi
else
if test "${active_system}" = "linux_a"; then
echo "Booting from system A"

View File

@ -11,30 +11,6 @@
if test "${dualboot}" = "yes"; then
if test "${upgrade_available}" = "1"; then
echo "Update detected; Booting new system (try ${bootcount})"
if test "${bootcount}" = "${bootlimit}"; then
echo "## Update failed; Rolling back to previous version."
if test "${active_system}" = "linux_a"; then
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}
setenv active_system linux_b
else
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}
setenv active_system linux_a
fi
setenv upgrade_available
saveenv
fi
else
if test "${active_system}" = "linux_a"; then
echo "Booting from system A"

View File

@ -11,30 +11,6 @@
if test "${dualboot}" = "yes"; then
if test "${upgrade_available}" = "1"; then
echo "Update detected; Booting new system (try ${bootcount})"
if test "${bootcount}" = "${bootlimit}"; then
echo "## Update failed; Rolling back to previous version."
if test "${active_system}" = "linux_a"; then
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}
setenv active_system linux_b
else
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}
setenv active_system linux_a
fi
setenv upgrade_available
saveenv
fi
else
if test "${active_system}" = "linux_a"; then
echo "Booting from system A"

View File

@ -11,30 +11,6 @@
if test "${dualboot}" = "yes"; then
if test "${upgrade_available}" = "1"; then
echo "Update detected; Booting new system (try ${bootcount})"
if test "${bootcount}" = "${bootlimit}"; then
echo "## Update failed; Rolling back to previous version."
if test "${active_system}" = "linux_a"; then
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}
setenv active_system linux_b
else
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}
setenv active_system linux_a
fi
setenv upgrade_available
saveenv
fi
else
if test "${active_system}" = "linux_a"; then
echo "Booting from system A"

View File

@ -11,30 +11,6 @@
if test "${dualboot}" = "yes"; then
if test "${upgrade_available}" = "1"; then
echo "Update detected; Booting new system (try ${bootcount})"
if test "${bootcount}" = "${bootlimit}"; then
echo "## Update failed; Rolling back to previous version."
if test "${active_system}" = "linux_a"; then
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}
setenv active_system linux_b
else
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}
setenv active_system linux_a
fi
setenv upgrade_available
saveenv
fi
else
if test "${active_system}" = "linux_a"; then
echo "Booting from system A"