u-boot-dey: add support for dualboot to boot scripts

The support for dualboot was integrated on meta-digi-dualboot layer, but it
really depends only on environment variable 'dualboot' so we'd better
integrate the support on the scripts in meta-digi, to avoid synchonization
problems between both layers.
This also allows to be able to easily enable dualboot in U-Boot with the
variable, without needing to update the script on the linux partition.

Signed-off-by: Hector Palacios <hector.palacios@digi.com>
This commit is contained in:
Hector Palacios 2021-08-23 13:26:24 +02:00
parent 91bfa01a52
commit f00ce5ca9b
8 changed files with 496 additions and 80 deletions

View File

@ -25,19 +25,70 @@ else
fi
fi
# Get the UUID of the configured boot partition.
part uuid mmc ${mmcbootdev}:${mmcpart} bootpart
# Check the boot source.
if test "${bootpart}" = "${part1_uuid}"; then
# We are booting from the eMMC using 'linux'.
true
elif test "${bootpart}" = "${part2_uuid}"; then
# We are booting from the eMMC using 'recovery'.
setenv boot_initrd true
setenv initrd_file uramdisk-recovery.img
# Dual boot update verification
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"
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
fi
else
# We are booting from the SD card.
setenv mmcroot /dev/mmcblk${mmcbootdev}p2
# Get the UUID of the configured boot partition.
part uuid mmc ${mmcbootdev}:${mmcpart} bootpart
# Check the boot source.
if test "${bootpart}" = "${part1_uuid}"; then
# We are booting from the eMMC using 'linux'.
true
elif test "${bootpart}" = "${part2_uuid}"; then
# We are booting from the eMMC using 'recovery'.
setenv boot_initrd true
setenv initrd_file uramdisk-recovery.img
else
# We are booting from the SD card.
setenv mmcroot /dev/mmcblk${mmcbootdev}p2
fi
fi
setenv extra_bootargs fbcon=logo-pos:center ${extra_bootargs}
dboot linux mmc ${mmcbootdev}:${mmcpart}

View File

@ -53,19 +53,70 @@ else
fi
fi
# Get the UUID of the configured boot partition.
part uuid mmc ${mmcbootdev}:${mmcpart} bootpart
# Check the boot source.
if test "${bootpart}" = "${part1_uuid}"; then
# We are booting from the eMMC using 'linux'.
true
elif test "${bootpart}" = "${part2_uuid}"; then
# We are booting from the eMMC using 'recovery'.
setenv boot_initrd true
setenv initrd_file uramdisk-recovery.img
# Dual boot update verification
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"
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
fi
else
# We are booting from the SD card.
setenv mmcroot /dev/mmcblk${mmcbootdev}p2
# Get the UUID of the configured boot partition.
part uuid mmc ${mmcbootdev}:${mmcpart} bootpart
# Check the boot source.
if test "${bootpart}" = "${part1_uuid}"; then
# We are booting from the eMMC using 'linux'.
true
elif test "${bootpart}" = "${part2_uuid}"; then
# We are booting from the eMMC using 'recovery'.
setenv boot_initrd true
setenv initrd_file uramdisk-recovery.img
else
# We are booting from the SD card.
setenv mmcroot /dev/mmcblk${mmcbootdev}p2
fi
fi
setenv extra_bootargs fbcon=logo-pos:center ${extra_bootargs}
dboot linux mmc ${mmcbootdev}:${mmcpart}

View File

@ -37,11 +37,45 @@ else
fi
fi
if test "${mtdbootpart}" = "recovery"; then
setenv boot_initrd true
setenv initrd_file uramdisk-recovery.img
# Dual boot update verification
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}
else
setenv mtdbootpart linux_a
setenv mtdlinuxindex ${mtdlinux_a_index}
setenv mtdrootfsindex ${mtdrootfs_a_index}
fi
setenv active_system ${mtdbootpart}
setenv upgrade_available
saveenv
fi
else
if test "${active_system}" = "linux_a"; then
echo "Booting from system A"
setenv mtdbootpart ${active_system}
setenv mtdlinuxindex ${mtdlinux_a_index}
setenv mtdrootfsindex ${mtdrootfs_a_index}
else
echo "Booting from system B"
setenv mtdbootpart ${active_system}
setenv mtdlinuxindex ${mtdlinux_b_index}
setenv mtdrootfsindex ${mtdrootfs_b_index}
fi
fi
else
true
if test "${mtdbootpart}" = "recovery"; then
setenv boot_initrd true
setenv initrd_file uramdisk-recovery.img
else
true
fi
fi
setenv extra_bootargs fbcon=logo-pos:center ${extra_bootargs}
dboot linux nand ${mtdbootpart}

View File

@ -37,11 +37,45 @@ else
fi
fi
if test "${mtdbootpart}" = "recovery"; then
setenv boot_initrd true
setenv initrd_file uramdisk-recovery.img
# Dual boot update verification
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}
else
setenv mtdbootpart linux_a
setenv mtdlinuxindex ${mtdlinux_a_index}
setenv mtdrootfsindex ${mtdrootfs_a_index}
fi
setenv active_system ${mtdbootpart}
setenv upgrade_available
saveenv
fi
else
if test "${active_system}" = "linux_a"; then
echo "Booting from system A"
setenv mtdbootpart ${active_system}
setenv mtdlinuxindex ${mtdlinux_a_index}
setenv mtdrootfsindex ${mtdrootfs_a_index}
else
echo "Booting from system B"
setenv mtdbootpart ${active_system}
setenv mtdlinuxindex ${mtdlinux_b_index}
setenv mtdrootfsindex ${mtdrootfs_b_index}
fi
fi
else
true
if test "${mtdbootpart}" = "recovery"; then
setenv boot_initrd true
setenv initrd_file uramdisk-recovery.img
else
true
fi
fi
setenv extra_bootargs fbcon=logo-pos:center ${extra_bootargs}
dboot linux nand ${mtdbootpart}

View File

@ -6,6 +6,19 @@
setenv ORIG_overlays ${overlays}
setenv ORIG_extra_bootargs ${extra_bootargs}
# Set SOC type to "imx8mm" if not already defined by U-Boot
if test ! -n "${soc_type}"; then
setenv soc_type "imx8mm"
fi
# Reset overlays when using dualboot mode, because we need to
# save the environment in case of an installation fall back.
if test "${dual_boot}" = "yes"; then
if test -n "${overlays}"; then
setenv overlays
fi
fi
#
# Determine overlays to apply depending on the hardware capabilities
# described by the HWID, SOM version, and carrier board version.
@ -28,19 +41,70 @@ if test -n "${module_ram}"; then
fi
fi
# Get the UUID of the configured boot partition.
part uuid mmc ${mmcbootdev}:${mmcpart} bootpart
# Check the boot source.
if test "${bootpart}" = "${part1_uuid}"; then
# We are booting from the eMMC using 'linux'.
true
elif test "${bootpart}" = "${part2_uuid}"; then
# We are booting from the eMMC using 'recovery'.
setenv boot_initrd true
setenv initrd_file uramdisk-recovery.img
# Dual boot update verification
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"
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
fi
else
# We are booting from the SD card.
setenv mmcroot /dev/mmcblk${mmcbootdev}p2
# Get the UUID of the configured boot partition.
part uuid mmc ${mmcbootdev}:${mmcpart} bootpart
# Check the boot source.
if test "${bootpart}" = "${part1_uuid}"; then
# We are booting from the eMMC using 'linux'.
true
elif test "${bootpart}" = "${part2_uuid}"; then
# We are booting from the eMMC using 'recovery'.
setenv boot_initrd true
setenv initrd_file uramdisk-recovery.img
else
# We are booting from the SD card.
setenv mmcroot /dev/mmcblk${mmcbootdev}p2
fi
fi
setenv extra_bootargs fbcon=logo-pos:center ${extra_bootargs}
dboot linux mmc ${mmcbootdev}:${mmcpart}

View File

@ -6,6 +6,19 @@
setenv ORIG_overlays ${overlays}
setenv ORIG_extra_bootargs ${extra_bootargs}
# Set SOC type to "imx8mn" if not already defined by U-Boot
if test ! -n "${soc_type}"; then
setenv soc_type "imx8mn"
fi
# Reset overlays when using dualboot mode, because we need to
# save the environment in case of an installation fall back.
if test "${dual_boot}" = "yes"; then
if test -n "${overlays}"; then
setenv overlays
fi
fi
#
# Determine overlays to apply depending on the hardware capabilities
# described by the HWID, SOM version, and carrier board version.
@ -37,19 +50,70 @@ if test "${board_version}" -lt "3"; then
setenv overlays _ov_board_v1-v2_ccimx8mn-dvk.dtbo,${overlays}
fi
# Get the UUID of the configured boot partition.
part uuid mmc ${mmcbootdev}:${mmcpart} bootpart
# Check the boot source.
if test "${bootpart}" = "${part1_uuid}"; then
# We are booting from the eMMC using 'linux'.
true
elif test "${bootpart}" = "${part2_uuid}"; then
# We are booting from the eMMC using 'recovery'.
setenv boot_initrd true
setenv initrd_file uramdisk-recovery.img
# Dual boot update verification
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_b_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"
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
fi
else
# We are booting from the SD card.
setenv mmcroot /dev/mmcblk${mmcbootdev}p2
# Get the UUID of the configured boot partition.
part uuid mmc ${mmcbootdev}:${mmcpart} bootpart
# Check the boot source.
if test "${bootpart}" = "${part1_uuid}"; then
# We are booting from the eMMC using 'linux'.
true
elif test "${bootpart}" = "${part2_uuid}"; then
# We are booting from the eMMC using 'recovery'.
setenv boot_initrd true
setenv initrd_file uramdisk-recovery.img
else
# We are booting from the SD card.
setenv mmcroot /dev/mmcblk${mmcbootdev}p2
fi
fi
setenv extra_bootargs fbcon=logo-pos:center ${extra_bootargs}
dboot linux mmc ${mmcbootdev}:${mmcpart}

View File

@ -11,6 +11,14 @@ if test ! -n "${soc_type}"; then
setenv soc_type "imx8qxp"
fi
# Reset overlays when using dualboot mode, because we need to
# save the environment in case of an installation fall back.
if test "${dual_boot}" = "yes"; then
if test -n "${overlays}"; then
setenv overlays
fi
fi
#
# Determine overlays to apply depending on the hardware capabilities
# described by the HWID, SOM version, and carrier board version.
@ -45,19 +53,70 @@ if test "${soc_type}" = "imx8qxp"; then
setenv overlays _ov_som_quad_ccimx8x.dtbo,${overlays}
fi
# Get the UUID of the configured boot partition.
part uuid mmc ${mmcbootdev}:${mmcpart} bootpart
# Check the boot source.
if test "${bootpart}" = "${part1_uuid}"; then
# We are booting from the eMMC using 'linux'.
true
elif test "${bootpart}" = "${part2_uuid}"; then
# We are booting from the eMMC using 'recovery'.
setenv boot_initrd true
setenv initrd_file uramdisk-recovery.img
# Dual boot update verification
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"
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
fi
else
# We are booting from the SD card.
setenv mmcroot /dev/mmcblk${mmcbootdev}p2
# Get the UUID of the configured boot partition.
part uuid mmc ${mmcbootdev}:${mmcpart} bootpart
# Check the boot source.
if test "${bootpart}" = "${part1_uuid}"; then
# We are booting from the eMMC using 'linux'.
true
elif test "${bootpart}" = "${part2_uuid}"; then
# We are booting from the eMMC using 'recovery'.
setenv boot_initrd true
setenv initrd_file uramdisk-recovery.img
else
# We are booting from the SD card.
setenv mmcroot /dev/mmcblk${mmcbootdev}p2
fi
fi
setenv extra_bootargs fbcon=logo-pos:center ${extra_bootargs}
dboot linux mmc ${mmcbootdev}:${mmcpart}

View File

@ -11,6 +11,14 @@ if test ! -n "${soc_type}"; then
setenv soc_type "imx8qxp"
fi
# Reset overlays when using dualboot mode, because we need to
# save the environment in case of an installation fall back.
if test "${dual_boot}" = "yes"; then
if test -n "${overlays}"; then
setenv overlays
fi
fi
#
# Determine overlays to apply depending on the hardware capabilities
# described by the HWID, SOM version, and carrier board version.
@ -50,19 +58,70 @@ if test "${board_version}" -le "3"; then
setenv overlays _ov_board_v1-v3_ccimx8x-sbc-pro.dtbo,${overlays}
fi
# Get the UUID of the configured boot partition.
part uuid mmc ${mmcbootdev}:${mmcpart} bootpart
# Check the boot source.
if test "${bootpart}" = "${part1_uuid}"; then
# We are booting from the eMMC using 'linux'.
true
elif test "${bootpart}" = "${part2_uuid}"; then
# We are booting from the eMMC using 'recovery'.
setenv boot_initrd true
setenv initrd_file uramdisk-recovery.img
# Dual boot update verification
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"
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
fi
else
# We are booting from the SD card.
setenv mmcroot /dev/mmcblk${mmcbootdev}p2
# Get the UUID of the configured boot partition.
part uuid mmc ${mmcbootdev}:${mmcpart} bootpart
# Check the boot source.
if test "${bootpart}" = "${part1_uuid}"; then
# We are booting from the eMMC using 'linux'.
true
elif test "${bootpart}" = "${part2_uuid}"; then
# We are booting from the eMMC using 'recovery'.
setenv boot_initrd true
setenv initrd_file uramdisk-recovery.img
else
# We are booting from the SD card.
setenv mmcroot /dev/mmcblk${mmcbootdev}p2
fi
fi
setenv extra_bootargs fbcon=logo-pos:center ${extra_bootargs}
dboot linux mmc ${mmcbootdev}:${mmcpart}