From 910ee4ab44a7c13120d3a3572427bc5a5481e2ef Mon Sep 17 00:00:00 2001 From: David Escalona Date: Mon, 4 Sep 2023 14:05:08 +0200 Subject: [PATCH] u-boot-dey: boot: update all boot scripts to synchronize boot variables for dualboot systems Until now, for dualboot systems, all boot variables were calculated on each boot depending on the value of the 'active_system'. These variables are used to boot the device but were not saved, which could lead to a missmatch between their value in the environment and their required values to correctly boot the system. This commit simplifies a bit the variables calculation and adds a block to synchronize their value in the environment. Signed-off-by: David Escalona --- .../u-boot/u-boot-dey/ccimx6qpsbc/boot.txt | 35 ++++++++++--------- .../u-boot/u-boot-dey/ccimx6sbc/boot.txt | 35 ++++++++++--------- .../u-boot/u-boot-dey/ccimx6ulsbc/boot.txt | 24 ++++++++++--- .../u-boot-dey/ccimx6ulstarter/boot.txt | 24 ++++++++++--- .../u-boot/u-boot-dey/ccimx8mm-dvk/boot.txt | 31 ++++++++-------- .../u-boot/u-boot-dey/ccimx8mn-dvk/boot.txt | 31 ++++++++-------- .../u-boot-dey/ccimx8x-sbc-express/boot.txt | 31 ++++++++-------- .../u-boot-dey/ccimx8x-sbc-pro/boot.txt | 31 ++++++++-------- .../u-boot/u-boot-dey/ccimx93-dvk/boot.txt | 31 ++++++++-------- .../u-boot/u-boot-dey/ccmp13-dvk/boot.txt | 16 +++++++-- .../u-boot/u-boot-dey/ccmp15-dvk/boot.txt | 16 +++++++-- 11 files changed, 187 insertions(+), 118 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 099380233..660614a7e 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 @@ -13,23 +13,26 @@ if test "${dualboot}" = "yes"; then echo "Update detected; Booting new system in ${active_system} (try ${bootcount})" 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} + echo "Booting from system A (try ${bootcount})" + part number mmc ${mmcbootdev} linux_a tmp_mmcpart + part number mmc ${mmcbootdev} rootfs_a tmp_rootfs_index 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} + echo "Booting from system B (try ${bootcount})" + part number mmc ${mmcbootdev} linux_b tmp_mmcpart + part number mmc ${mmcbootdev} rootfs_b tmp_rootfs_index + fi + part uuid mmc ${mmcbootdev}:${tmp_rootfs_index} tmp_mmcroot + if test "${mmcpart}" -ne "${tmp_mmcpart}"; then + setexpr mmcpart ${tmp_mmcpart} + env_save_needed="1" + fi + if test "${mmcroot}" != "PARTUUID=${tmp_mmcroot}"; then + setenv mmcroot PARTUUID=${tmp_mmcroot} + env_save_needed="1" + fi + if test "${env_save_needed}" = "1"; then + env delete tmp_mmcpart tmp_rootfs_index tmp_mmcroot + env save fi fi else 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 a0a1cc0d8..46cff15a2 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 @@ -13,23 +13,26 @@ if test "${dualboot}" = "yes"; then echo "Update detected; Booting new system in ${active_system} (try ${bootcount})" 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} + echo "Booting from system A (try ${bootcount})" + part number mmc ${mmcbootdev} linux_a tmp_mmcpart + part number mmc ${mmcbootdev} rootfs_a tmp_rootfs_index 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} + echo "Booting from system B (try ${bootcount})" + part number mmc ${mmcbootdev} linux_b tmp_mmcpart + part number mmc ${mmcbootdev} rootfs_b tmp_rootfs_index + fi + part uuid mmc ${mmcbootdev}:${tmp_rootfs_index} tmp_mmcroot + if test "${mmcpart}" -ne "${tmp_mmcpart}"; then + setexpr mmcpart ${tmp_mmcpart} + env_save_needed="1" + fi + if test "${mmcroot}" != "PARTUUID=${tmp_mmcroot}"; then + setenv mmcroot PARTUUID=${tmp_mmcroot} + env_save_needed="1" + fi + if test "${env_save_needed}" = "1"; then + env delete tmp_mmcpart tmp_rootfs_index tmp_mmcroot + env save fi fi else 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 41e6489ef..65be2bf99 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 @@ -10,14 +10,28 @@ if test "${dualboot}" = "yes"; then 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} + setenv tmp_mtdrootfspart ${rootfsvol_a} + setenv tmp_rootfsvol ${rootfsvol_a} else echo "Booting from system B (try ${bootcount})" + setenv tmp_mtdrootfspart ${rootfsvol_b} + setenv tmp_rootfsvol ${rootfsvol_b} + fi + if test "${mtdbootpart}" != "${active_system}"; then setenv mtdbootpart ${active_system} - setenv mtdrootfspart ${rootfsvol_b} - setenv rootfsvol ${rootfsvol_b} + env_save_needed="1" + fi + if test "${mtdrootfspart}" != "${tmp_mtdrootfspart}"; then + setenv mtdrootfspart ${tmp_mtdrootfspart} + env_save_needed="1" + fi + if test "${rootfsvol}" != "${tmp_rootfsvol}"; then + setenv rootfsvol ${tmp_rootfsvol} + env_save_needed="1" + fi + if test "${env_save_needed}" = "1"; then + env delete tmp_rootfsvol tmp_mtdrootfspart + env save fi else echo "Booting system (try ${bootcount})" 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 7219c515e..6a9926838 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 @@ -10,14 +10,28 @@ if test "${dualboot}" = "yes"; then 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} + setenv tmp_mtdrootfspart ${rootfsvol_a} + setenv tmp_rootfsvol ${rootfsvol_a} else echo "Booting from system B (try ${bootcount})" + setenv tmp_mtdrootfspart ${rootfsvol_b} + setenv tmp_rootfsvol ${rootfsvol_b} + fi + if test "${mtdbootpart}" != "${active_system}"; then setenv mtdbootpart ${active_system} - setenv mtdrootfspart ${rootfsvol_b} - setenv rootfsvol ${rootfsvol_b} + env_save_needed="1" + fi + if test "${mtdrootfspart}" != "${tmp_mtdrootfspart}"; then + setenv mtdrootfspart ${tmp_mtdrootfspart} + env_save_needed="1" + fi + if test "${rootfsvol}" != "${tmp_rootfsvol}"; then + setenv rootfsvol ${tmp_rootfsvol} + env_save_needed="1" + fi + if test "${env_save_needed}" = "1"; then + env delete tmp_rootfsvol tmp_mtdrootfspart + env save fi else echo "Booting system (try ${bootcount})" 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 398134925..c42e51422 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 @@ -10,22 +10,25 @@ if test "${dualboot}" = "yes"; then 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} + part number mmc ${mmcbootdev} linux_a tmp_mmcpart + part number mmc ${mmcbootdev} rootfs_a tmp_rootfs_index else 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} + part number mmc ${mmcbootdev} linux_b tmp_mmcpart + part number mmc ${mmcbootdev} rootfs_b tmp_rootfs_index + fi + part uuid mmc ${mmcbootdev}:${tmp_rootfs_index} tmp_mmcroot + if test "${mmcpart}" -ne "${tmp_mmcpart}"; then + setexpr mmcpart ${tmp_mmcpart} + env_save_needed="1" + fi + if test "${mmcroot}" != "PARTUUID=${tmp_mmcroot}"; then + setenv mmcroot PARTUUID=${tmp_mmcroot} + env_save_needed="1" + fi + if test "${env_save_needed}" = "1"; then + env delete tmp_mmcpart tmp_rootfs_index tmp_mmcroot + env save fi else echo "Booting system (try ${bootcount})" 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 a27c3f261..62fbaf495 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 @@ -10,22 +10,25 @@ if test "${dualboot}" = "yes"; then 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} + part number mmc ${mmcbootdev} linux_a tmp_mmcpart + part number mmc ${mmcbootdev} rootfs_a tmp_rootfs_index else 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} + part number mmc ${mmcbootdev} linux_b tmp_mmcpart + part number mmc ${mmcbootdev} rootfs_b tmp_rootfs_index + fi + part uuid mmc ${mmcbootdev}:${tmp_rootfs_index} tmp_mmcroot + if test "${mmcpart}" -ne "${tmp_mmcpart}"; then + setexpr mmcpart ${tmp_mmcpart} + env_save_needed="1" + fi + if test "${mmcroot}" != "PARTUUID=${tmp_mmcroot}"; then + setenv mmcroot PARTUUID=${tmp_mmcroot} + env_save_needed="1" + fi + if test "${env_save_needed}" = "1"; then + env delete tmp_mmcpart tmp_rootfs_index tmp_mmcroot + env save fi else echo "Booting system (try ${bootcount})" 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 d36752fb9..ba60afc40 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 @@ -10,22 +10,25 @@ if test "${dualboot}" = "yes"; then 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} + part number mmc ${mmcbootdev} linux_a tmp_mmcpart + part number mmc ${mmcbootdev} rootfs_a tmp_rootfs_index else 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} + part number mmc ${mmcbootdev} linux_b tmp_mmcpart + part number mmc ${mmcbootdev} rootfs_b tmp_rootfs_index + fi + part uuid mmc ${mmcbootdev}:${tmp_rootfs_index} tmp_mmcroot + if test "${mmcpart}" -ne "${tmp_mmcpart}"; then + setexpr mmcpart ${tmp_mmcpart} + env_save_needed="1" + fi + if test "${mmcroot}" != "PARTUUID=${tmp_mmcroot}"; then + setenv mmcroot PARTUUID=${tmp_mmcroot} + env_save_needed="1" + fi + if test "${env_save_needed}" = "1"; then + env delete tmp_mmcpart tmp_rootfs_index tmp_mmcroot + env save fi else echo "Booting system (try ${bootcount})" 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 057bbf1de..4ee3d440f 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 @@ -10,22 +10,25 @@ if test "${dualboot}" = "yes"; then 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} + part number mmc ${mmcbootdev} linux_a tmp_mmcpart + part number mmc ${mmcbootdev} rootfs_a tmp_rootfs_index else 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} + part number mmc ${mmcbootdev} linux_b tmp_mmcpart + part number mmc ${mmcbootdev} rootfs_b tmp_rootfs_index + fi + part uuid mmc ${mmcbootdev}:${tmp_rootfs_index} tmp_mmcroot + if test "${mmcpart}" -ne "${tmp_mmcpart}"; then + setexpr mmcpart ${tmp_mmcpart} + env_save_needed="1" + fi + if test "${mmcroot}" != "PARTUUID=${tmp_mmcroot}"; then + setenv mmcroot PARTUUID=${tmp_mmcroot} + env_save_needed="1" + fi + if test "${env_save_needed}" = "1"; then + env delete tmp_mmcpart tmp_rootfs_index tmp_mmcroot + env save fi else echo "Booting system (try ${bootcount})" diff --git a/meta-digi-arm/recipes-bsp/u-boot/u-boot-dey/ccimx93-dvk/boot.txt b/meta-digi-arm/recipes-bsp/u-boot/u-boot-dey/ccimx93-dvk/boot.txt index 6b6d33b53..9b169085c 100644 --- a/meta-digi-arm/recipes-bsp/u-boot/u-boot-dey/ccimx93-dvk/boot.txt +++ b/meta-digi-arm/recipes-bsp/u-boot/u-boot-dey/ccimx93-dvk/boot.txt @@ -13,22 +13,25 @@ if test "${mmcbootdev}" = "1"; then elif test "${dualboot}" = "yes"; then 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} + part number mmc ${mmcbootdev} linux_a tmp_mmcpart + part number mmc ${mmcbootdev} rootfs_a tmp_rootfs_index else 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} + part number mmc ${mmcbootdev} linux_b tmp_mmcpart + part number mmc ${mmcbootdev} rootfs_b tmp_rootfs_index + fi + part uuid mmc ${mmcbootdev}:${tmp_rootfs_index} tmp_mmcroot + if test "${mmcpart}" -ne "${tmp_mmcpart}"; then + setexpr mmcpart ${tmp_mmcpart} + env_save_needed="1" + fi + if test "${mmcroot}" != "PARTUUID=${tmp_mmcroot}"; then + setenv mmcroot PARTUUID=${tmp_mmcroot} + env_save_needed="1" + fi + if test "${env_save_needed}" = "1"; then + env delete tmp_mmcpart tmp_rootfs_index tmp_mmcroot + env save fi else echo "Booting system (try ${bootcount})" diff --git a/meta-digi-arm/recipes-bsp/u-boot/u-boot-dey/ccmp13-dvk/boot.txt b/meta-digi-arm/recipes-bsp/u-boot/u-boot-dey/ccmp13-dvk/boot.txt index 9ff6b0e33..94fed3c6d 100644 --- a/meta-digi-arm/recipes-bsp/u-boot/u-boot-dey/ccmp13-dvk/boot.txt +++ b/meta-digi-arm/recipes-bsp/u-boot/u-boot-dey/ccmp13-dvk/boot.txt @@ -10,12 +10,22 @@ if test "${dualboot}" = "yes"; then if test "${active_system}" = "linux_a"; then echo "Booting from system A (try ${bootcount})" - setenv mtdbootpart ${active_system} - setenv rootfsvol ${rootfsvol_a} + setenv tmp_rootfsvol ${rootfsvol_a} else echo "Booting from system B (try ${bootcount})" + setenv tmp_rootfsvol ${rootfsvol_b} + fi + if test "${mtdbootpart}" != "${active_system}"; then setenv mtdbootpart ${active_system} - setenv rootfsvol ${rootfsvol_b} + env_save_needed="1" + fi + if test "${rootfsvol}" != "${tmp_rootfsvol}"; then + setenv rootfsvol ${tmp_rootfsvol} + env_save_needed="1" + fi + if test "${env_save_needed}" = "1"; then + env delete tmp_rootfsvol + env save fi else echo "Booting system (try ${bootcount})" diff --git a/meta-digi-arm/recipes-bsp/u-boot/u-boot-dey/ccmp15-dvk/boot.txt b/meta-digi-arm/recipes-bsp/u-boot/u-boot-dey/ccmp15-dvk/boot.txt index f62b9eac6..632feb7aa 100644 --- a/meta-digi-arm/recipes-bsp/u-boot/u-boot-dey/ccmp15-dvk/boot.txt +++ b/meta-digi-arm/recipes-bsp/u-boot/u-boot-dey/ccmp15-dvk/boot.txt @@ -10,12 +10,22 @@ if test "${dualboot}" = "yes"; then if test "${active_system}" = "linux_a"; then echo "Booting from system A (try ${bootcount})" - setenv mtdbootpart ${active_system} - setenv rootfsvol ${rootfsvol_a} + setenv tmp_rootfsvol ${rootfsvol_a} else echo "Booting from system B (try ${bootcount})" + setenv tmp_rootfsvol ${rootfsvol_b} + fi + if test "${mtdbootpart}" != "${active_system}"; then setenv mtdbootpart ${active_system} - setenv rootfsvol ${rootfsvol_b} + env_save_needed="1" + fi + if test "${rootfsvol}" != "${tmp_rootfsvol}"; then + setenv rootfsvol ${tmp_rootfsvol} + env_save_needed="1" + fi + if test "${env_save_needed}" = "1"; then + env delete tmp_rootfsvol + env save fi else echo "Booting system (try ${bootcount})"