From e67ed06dd5f40fd311086fe7deca41f57c8a44c8 Mon Sep 17 00:00:00 2001 From: Francisco Gil Date: Fri, 8 Oct 2021 12:51:45 +0200 Subject: [PATCH] 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 Signed-off-by: Francisco Gil --- .../u-boot/u-boot-dey/ccimx6qpsbc/boot.txt | 24 ------------------- .../u-boot/u-boot-dey/ccimx6sbc/boot.txt | 24 ------------------- .../u-boot/u-boot-dey/ccimx6ulsbc/boot.txt | 17 ------------- .../u-boot-dey/ccimx6ulstarter/boot.txt | 17 ------------- .../u-boot/u-boot-dey/ccimx8mm-dvk/boot.txt | 24 ------------------- .../u-boot/u-boot-dey/ccimx8mn-dvk/boot.txt | 24 ------------------- .../u-boot-dey/ccimx8x-sbc-express/boot.txt | 24 ------------------- .../u-boot-dey/ccimx8x-sbc-pro/boot.txt | 24 ------------------- 8 files changed, 178 deletions(-) diff --git a/meta-digi-arm/recipes-bsp/u-boot/u-boot-dey/ccimx6qpsbc/boot.txt b/meta-digi-arm/recipes-bsp/u-boot/u-boot-dey/ccimx6qpsbc/boot.txt index fe794d0c6..f7f6cf7a8 100644 --- a/meta-digi-arm/recipes-bsp/u-boot/u-boot-dey/ccimx6qpsbc/boot.txt +++ b/meta-digi-arm/recipes-bsp/u-boot/u-boot-dey/ccimx6qpsbc/boot.txt @@ -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" diff --git a/meta-digi-arm/recipes-bsp/u-boot/u-boot-dey/ccimx6sbc/boot.txt b/meta-digi-arm/recipes-bsp/u-boot/u-boot-dey/ccimx6sbc/boot.txt index a88f10150..4970fc7f0 100644 --- a/meta-digi-arm/recipes-bsp/u-boot/u-boot-dey/ccimx6sbc/boot.txt +++ b/meta-digi-arm/recipes-bsp/u-boot/u-boot-dey/ccimx6sbc/boot.txt @@ -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" diff --git a/meta-digi-arm/recipes-bsp/u-boot/u-boot-dey/ccimx6ulsbc/boot.txt b/meta-digi-arm/recipes-bsp/u-boot/u-boot-dey/ccimx6ulsbc/boot.txt index 9b45affa5..aebfd6480 100644 --- a/meta-digi-arm/recipes-bsp/u-boot/u-boot-dey/ccimx6ulsbc/boot.txt +++ b/meta-digi-arm/recipes-bsp/u-boot/u-boot-dey/ccimx6ulsbc/boot.txt @@ -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" diff --git a/meta-digi-arm/recipes-bsp/u-boot/u-boot-dey/ccimx6ulstarter/boot.txt b/meta-digi-arm/recipes-bsp/u-boot/u-boot-dey/ccimx6ulstarter/boot.txt index 3fe58e274..0d779540d 100644 --- a/meta-digi-arm/recipes-bsp/u-boot/u-boot-dey/ccimx6ulstarter/boot.txt +++ b/meta-digi-arm/recipes-bsp/u-boot/u-boot-dey/ccimx6ulstarter/boot.txt @@ -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" diff --git a/meta-digi-arm/recipes-bsp/u-boot/u-boot-dey/ccimx8mm-dvk/boot.txt b/meta-digi-arm/recipes-bsp/u-boot/u-boot-dey/ccimx8mm-dvk/boot.txt index 121b71e07..bf886ba02 100644 --- a/meta-digi-arm/recipes-bsp/u-boot/u-boot-dey/ccimx8mm-dvk/boot.txt +++ b/meta-digi-arm/recipes-bsp/u-boot/u-boot-dey/ccimx8mm-dvk/boot.txt @@ -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" diff --git a/meta-digi-arm/recipes-bsp/u-boot/u-boot-dey/ccimx8mn-dvk/boot.txt b/meta-digi-arm/recipes-bsp/u-boot/u-boot-dey/ccimx8mn-dvk/boot.txt index f39b8cfc5..806ec894d 100644 --- a/meta-digi-arm/recipes-bsp/u-boot/u-boot-dey/ccimx8mn-dvk/boot.txt +++ b/meta-digi-arm/recipes-bsp/u-boot/u-boot-dey/ccimx8mn-dvk/boot.txt @@ -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" diff --git a/meta-digi-arm/recipes-bsp/u-boot/u-boot-dey/ccimx8x-sbc-express/boot.txt b/meta-digi-arm/recipes-bsp/u-boot/u-boot-dey/ccimx8x-sbc-express/boot.txt index 836310230..945da1eee 100644 --- a/meta-digi-arm/recipes-bsp/u-boot/u-boot-dey/ccimx8x-sbc-express/boot.txt +++ b/meta-digi-arm/recipes-bsp/u-boot/u-boot-dey/ccimx8x-sbc-express/boot.txt @@ -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" diff --git a/meta-digi-arm/recipes-bsp/u-boot/u-boot-dey/ccimx8x-sbc-pro/boot.txt b/meta-digi-arm/recipes-bsp/u-boot/u-boot-dey/ccimx8x-sbc-pro/boot.txt index 0a6968ea1..bffc67dad 100644 --- a/meta-digi-arm/recipes-bsp/u-boot/u-boot-dey/ccimx8x-sbc-pro/boot.txt +++ b/meta-digi-arm/recipes-bsp/u-boot/u-boot-dey/ccimx8x-sbc-pro/boot.txt @@ -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"