ramips: use nand_do_upgrade for netis WF-2881
authorSungbo Eo <mans0n@gorani.run>
Wed, 2 Oct 2019 13:12:28 +0000 (22:12 +0900)
committerAdrian Schmutzler <freifunk@adrianschmutzler.de>
Fri, 7 Feb 2020 13:28:50 +0000 (14:28 +0100)
WF-2881 sysupgrade image uses UBI rootfs, but still relies on
default_do_upgrade. Because of this, config backup is not restored after
sysupgrade. It can be fixed by switching to nand_do_upgrade and
sysupgrade-tar image. default_do_upgrade does not handle sysupgrade-tar
properly, so one should use factory image to upgrade from older version.

Signed-off-by: Sungbo Eo <mans0n@gorani.run>
target/linux/ramips/dts/mt7621_netis_wf-2881.dts
target/linux/ramips/image/mt7621.mk
target/linux/ramips/mt7621/base-files/lib/upgrade/platform.sh

index a7e8e06..9d37583 100644 (file)
                };
 
                partition@140000 {
-                       compatible = "denx,uimage";
                        label = "firmware";
                        reg = <0x140000 0x7e40000>;
+
+                       compatible = "fixed-partitions";
+                       #address-cells = <1>;
+                       #size-cells = <1>;
+
+                       partition@0 {
+                               label = "kernel";
+                               reg = <0x0 0x400000>;
+                       };
+
+                       partition@400000 {
+                               label = "ubi";
+                               reg = <0x400000 0x7a40000>;
+                       };
                };
        };
 };
index 17b3265..fdb71ac 100644 (file)
@@ -628,10 +628,12 @@ define Device/netis_wf-2881
   BLOCKSIZE := 128k
   PAGESIZE := 2048
   FILESYSTEMS := squashfs
+  KERNEL_SIZE := 4096k
   IMAGE_SIZE := 129280k
-  KERNEL := $(KERNEL_DTB) | pad-offset $$(BLOCKSIZE) 64 | uImage lzma
   UBINIZE_OPTS := -E 5
-  IMAGE/sysupgrade.bin := append-kernel | append-ubi | append-metadata | \
+  IMAGES += factory.bin
+  IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata
+  IMAGE/factory.bin := append-kernel | pad-to $$$$(KERNEL_SIZE) | append-ubi | \
        check-size $$$$(IMAGE_SIZE)
   DEVICE_VENDOR := NETIS
   DEVICE_MODEL := WF-2881
index 6e0e8a6..eaddca0 100755 (executable)
@@ -49,6 +49,7 @@ platform_do_upgrade() {
        netgear,r6260|\
        netgear,r6350|\
        netgear,r6850|\
+       netis,wf-2881|\
        xiaomi,mir3g|\
        xiaomi,mir3p)
                nand_do_upgrade "$1"