]> git.ipfire.org Git - thirdparty/openwrt.git/commitdiff
bcm53xx: fix sysupgrade losing config on NAND devices
authorSemih Baskan <strst.gs@gmail.com>
Sun, 2 Aug 2026 06:54:44 +0000 (09:54 +0300)
committerJonas Jelonek <jelonek.jonas@gmail.com>
Fri, 14 Aug 2026 09:40:47 +0000 (11:40 +0200)
The check that decides whether the new rootfs is a UBI image passes one argument
where 715634e6d144 now expects two. Without the extraction command the subshell
runs nothing, the magic comes back empty and the check fails. sysupgrade then
falls back to writing the whole image over the firmware partition, which cannot
carry sysupgrade.tgz into the new rootfs_data volume. After the reboot the
settings are gone, as if -n had been passed, and the UBI erase counters go with
them.

Affects bcm53xx NAND devices flashed with a trx based image, from 24.10.0-rc1
onwards.

The fix lives in the firmware doing the flashing, so upgrading from an affected
build loses the config one last time. Every upgrade from a fixed build onwards
keeps it.

Build tested on main with kernel 6.18, Asus RT-N18U, three consecutive
sysupgrades, config preserved every time.

Fixes: 715634e6d144 ("base-files: upgrade: nand: use "cmd" argument for extracting command")
Link: https://github.com/openwrt/openwrt/issues/21024
Link: https://github.com/openwrt/openwrt/issues/21655
Signed-off-by: Semih Baskan <strst.gs@gmail.com>
Link: https://github.com/openwrt/openwrt/pull/24531
Signed-off-by: Jonas Jelonek <jelonek.jonas@gmail.com>
target/linux/bcm53xx/base-files/lib/upgrade/platform.sh

index dfa333af8b13b668a7337ade2e58c0cc8f299735..1f7d65cd1c4c5eef8e8471987ad92cc75285f432 100644 (file)
@@ -237,7 +237,7 @@ platform_do_upgrade_nand_trx() {
        }
 
        # Firmwares without UBI image should be flashed "normally"
-       local root_type=$(identify $dir/root)
+       local root_type=$(identify "$dir/root" "cat")
        [ "$root_type" != "ubi" ] && {
                echo "Provided firmware doesn't use UBI for rootfs."
                return