summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRobert Marko2026-05-25 19:26:14 +0000
committerRobert Marko2026-05-28 09:19:50 +0000
commit601e0674ae3fd3834140ec7aab04fa3807d76c35 (patch)
treec64356da7f7be7dd3094e19d69fcb7c6ce98ed86
parentfbf01b4d62db5bcb8a72be1205d9f50dcd600d2b (diff)
downloadopenwrt-601e0674ae3fd3834140ec7aab04fa3807d76c35.tar.gz
mvebu: cortexa53: uDPU/eDPU: update active bootscript as well
Currently, sysupgrade will only upgrade the unused slot, however since the whole dual firmware logic is in the bootscript U-boot will just use the first bootscript it finds. So, in a case that you are running slot A it will upgrade slot B, however that means that slot B will be still booted by the old bootscript that came with the previous firmware version. This is an issue if you need to change anything, so lets add a custom function that upgrades the active bootscript as well after flashing the slot firmware. Signed-off-by: Robert Marko <robert.marko@sartura.hr> (cherry picked from commit fb7787803c64fcca1ae3d0a8882c8337c788f058)
-rwxr-xr-xtarget/linux/mvebu/cortexa53/base-files/lib/upgrade/platform.sh43
1 files changed, 43 insertions, 0 deletions
diff --git a/target/linux/mvebu/cortexa53/base-files/lib/upgrade/platform.sh b/target/linux/mvebu/cortexa53/base-files/lib/upgrade/platform.sh
index 7ddb516762..8b8149c96b 100755
--- a/target/linux/mvebu/cortexa53/base-files/lib/upgrade/platform.sh
+++ b/target/linux/mvebu/cortexa53/base-files/lib/upgrade/platform.sh
@@ -7,6 +7,40 @@ RAMFS_COPY_BIN='fw_printenv fw_setenv mkfs.f2fs fdisk'
RAMFS_COPY_DATA='/etc/fw_env.config /var/lock/fw_printenv.lock'
REQUIRE_IMAGE_METADATA=1
+# U-Boot loads the first boot.scr it finds, so keep the active slot's script in
+# sync even when the full upgrade is written to the inactive slot.
+methode_update_active_bootscript() {
+ local active_part="$1"
+ local updated_part="$2"
+ local active_dev
+ local updated_dev
+ local ret=0
+
+ [ "$active_part" -a "$updated_part" ] || return 0
+
+ active_dev="$(find_mmc_part "$active_part" "$CI_ROOTDEV")"
+ updated_dev="$(find_mmc_part "$updated_part" "$CI_ROOTDEV")"
+ [ "$active_dev" -a "$updated_dev" ] || return 1
+
+ mkdir -p /tmp/bootpart-new
+ mount -o ro "$updated_dev" /tmp/bootpart-new || return 1
+
+ cp /tmp/bootpart-new/boot.scr /tmp/boot.scr
+ ret=$?
+ umount /tmp/bootpart-new
+ [ $ret -eq 0 ] || return 1
+
+ mkdir -p /tmp/bootpart-active
+ mount "$active_dev" /tmp/bootpart-active || return 1
+
+ cp /tmp/boot.scr /tmp/bootpart-active/boot.scr || ret=1
+ sync
+
+ umount /tmp/bootpart-active
+
+ return $ret
+}
+
platform_check_image() {
case "$(board_name)" in
glinet,gl-mv1000|\
@@ -35,15 +69,19 @@ platform_do_upgrade() {
;;
methode,udpu|\
methode,edpu)
+ local active_kernpart
+
[ "$(rootfs_type)" = "tmpfs" ] && {
local firmware_active="$(fw_printenv -n bootactive)"
case "$firmware_active" in
1)
+ active_kernpart="kernel_1"
CI_KERNPART="kernel_2"
CI_ROOTPART="rootfs_2"
fw_setenv bootactive 2
;;
2)
+ active_kernpart="kernel_2"
CI_KERNPART="kernel_1"
CI_ROOTPART="rootfs_1"
fw_setenv bootactive 1
@@ -54,11 +92,13 @@ platform_do_upgrade() {
local root="$(cmdline_get_var root)"
case "$root" in
/dev/mmcblk*p2)
+ active_kernpart="kernel_1"
CI_KERNPART="kernel_2"
CI_ROOTPART="rootfs_2"
fw_setenv bootactive 2
;;
/dev/mmcblk*p4)
+ active_kernpart="kernel_2"
CI_KERNPART="kernel_1"
CI_ROOTPART="rootfs_1"
fw_setenv bootactive 1
@@ -66,6 +106,9 @@ platform_do_upgrade() {
esac
emmc_do_upgrade "$1"
+
+ methode_update_active_bootscript "$active_kernpart" "$CI_KERNPART" || \
+ echo "Failed to update active boot script"
;;
*)
default_do_upgrade "$1"