From 92dd70b262814c366588e1d856b41049ed73aba7 Mon Sep 17 00:00:00 2001 From: James Turton Date: Mon, 2 Nov 2026 23:10:45 +0100 Subject: [PATCH] Add extra check in flash to check kernel cmdline If one happens to run `flash` and then `flash` again without rebooting the board will get soft bricked as the u-boot variable `systemAB_next` has already been updated. Add this extra kernel cmdline flag prevents this from being an issue. --- .../images/files/centauri-carbon-1/sw-description | 4 ++-- .../images/files/centauri-carbon-2/sw-description | 4 ++-- .../recipes-bsp/u-boot/files/elegoo-centauri-carbon1.env | 2 +- .../recipes-bsp/u-boot/files/elegoo-centauri-carbon2.env | 2 +- meta-opencentauri/recipes-core/swu-flasher/files/flash | 2 +- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/meta-opencentauri/images/files/centauri-carbon-1/sw-description b/meta-opencentauri/images/files/centauri-carbon-1/sw-description index 248ea7e6..c945378b 100644 --- a/meta-opencentauri/images/files/centauri-carbon-1/sw-description +++ b/meta-opencentauri/images/files/centauri-carbon-1/sw-description @@ -57,7 +57,7 @@ software = }, { name = "setargs_mainline"; - value = "setenv bootargs console=@@KERNEL_CONSOLE@@ earlycon=uart8250,mmio32,@@SERIAL_ADDR@@ root=${mmc_root} rootwait consoleblank=0 gpt"; + value = "setenv bootargs console=@@KERNEL_CONSOLE@@ earlycon=uart8250,mmio32,@@SERIAL_ADDR@@ root=${mmc_root} rootwait consoleblank=0 gpt systemAB.slot=${systemAB_next}"; }, { name = "bootcmd_"; @@ -142,7 +142,7 @@ software = }, { name = "setargs_mainline"; - value = "setenv bootargs console=@@KERNEL_CONSOLE@@ earlycon=uart8250,mmio32,@@SERIAL_ADDR@@ root=${mmc_root} rootwait consoleblank=0 gpt"; + value = "setenv bootargs console=@@KERNEL_CONSOLE@@ earlycon=uart8250,mmio32,@@SERIAL_ADDR@@ root=${mmc_root} rootwait consoleblank=0 gpt systemAB.slot=${systemAB_next}"; }, { name = "bootcmd_"; diff --git a/meta-opencentauri/images/files/centauri-carbon-2/sw-description b/meta-opencentauri/images/files/centauri-carbon-2/sw-description index edf761eb..5d18c91e 100644 --- a/meta-opencentauri/images/files/centauri-carbon-2/sw-description +++ b/meta-opencentauri/images/files/centauri-carbon-2/sw-description @@ -86,7 +86,7 @@ software = }, { name = "setargs_mainline"; - value = "setenv bootargs console=@@KERNEL_CONSOLE@@ root=${mmc_root} rootwait consoleblank=0 gpt"; + value = "setenv bootargs console=@@KERNEL_CONSOLE@@ root=${mmc_root} rootwait consoleblank=0 gpt systemAB.slot=${systemAB_next}"; }, { name = "bootcmd_"; @@ -200,7 +200,7 @@ software = }, { name = "setargs_mainline"; - value = "setenv bootargs console=@@KERNEL_CONSOLE@@ root=${mmc_root} rootwait consoleblank=0 gpt"; + value = "setenv bootargs console=@@KERNEL_CONSOLE@@ root=${mmc_root} rootwait consoleblank=0 gpt systemAB.slot=${systemAB_next}"; }, { name = "bootcmd_"; diff --git a/meta-opencentauri/recipes-bsp/u-boot/files/elegoo-centauri-carbon1.env b/meta-opencentauri/recipes-bsp/u-boot/files/elegoo-centauri-carbon1.env index 765d36de..3ff9cf13 100644 --- a/meta-opencentauri/recipes-bsp/u-boot/files/elegoo-centauri-carbon1.env +++ b/meta-opencentauri/recipes-bsp/u-boot/files/elegoo-centauri-carbon1.env @@ -3,6 +3,6 @@ swu_mode=mainline systemAB_next=A boot_part=4 mmc_root=/dev/mmcblk0p5 -setargs_mainline=setenv bootargs console=ttyS0,115200 earlycon=uart8250,mmio32,0x02500000 root=${mmc_root} rootwait gpt +setargs_mainline=setenv bootargs console=ttyS0,115200 earlycon=uart8250,mmio32,0x02500000 root=${mmc_root} rootwait gpt systemAB.slot=${systemAB_next} bootcmd_mainline=run setargs_mainline; fatload mmc 0:${boot_part} 43000000 zImage; fatload mmc 0:${boot_part} 43800000 elegoo-centauri-carbon1.dtb; bootz 43000000 - 43800000 bootcmd=if test x${swu_mode} = xmainline; then run bootcmd_mainline; else run bootcmd_stock; fi diff --git a/meta-opencentauri/recipes-bsp/u-boot/files/elegoo-centauri-carbon2.env b/meta-opencentauri/recipes-bsp/u-boot/files/elegoo-centauri-carbon2.env index 34dad9cb..32a492ad 100644 --- a/meta-opencentauri/recipes-bsp/u-boot/files/elegoo-centauri-carbon2.env +++ b/meta-opencentauri/recipes-bsp/u-boot/files/elegoo-centauri-carbon2.env @@ -3,6 +3,6 @@ swu_mode=mainline systemAB_next=A boot_part=5 mmc_root=/dev/mmcblk0p7 -setargs_mainline=setenv bootargs console=ttyS2,115200 root=${mmc_root} rootwait gpt +setargs_mainline=setenv bootargs console=ttyS2,115200 root=${mmc_root} rootwait gpt systemAB.slot=${systemAB_next} bootcmd_mainline=run setargs_mainline; fatload mmc 1:${boot_part} 43000000 zImage; fatload mmc 1:${boot_part} 43800000 elegoo-centauri-carbon2.dtb; bootz 43000000 - 43800000 bootcmd=if test x${swu_mode} = xmainline; then run bootcmd_mainline; else run bootcmd_stock; fi diff --git a/meta-opencentauri/recipes-core/swu-flasher/files/flash b/meta-opencentauri/recipes-core/swu-flasher/files/flash index 22d0ed4a..32a0c9a2 100644 --- a/meta-opencentauri/recipes-core/swu-flasher/files/flash +++ b/meta-opencentauri/recipes-core/swu-flasher/files/flash @@ -31,7 +31,7 @@ fi rm -f "$TEMP_DIR/sw-description" -curr=$(fw_printenv systemAB_next | awk -F= '{ print $2 }' | tr -d '[:space:]') +curr=$(tr ' ' '\n' < /proc/cmdline | awk -F= '$1 == "systemAB.slot" { print $2 }' | tr -d '[:space:]') if [[ "$curr" == "A" ]]; then boot_partition="now_A_next_B"