[PATCH] ath79: restore sysupgrade support for ja76pf2 and routerstations

Tomasz Maciej Nowak tmn505 at gmail.com
Tue Dec 1 12:30:27 EST 2020


Because the bug described in FS#2428 has been fixed with bf2870c
("kernel: fix mtd partition erase < parent_erasesize writes") these
devices can now safely do sysupgrade. Restore sysupgrade support disabled
in:
0cc87b3 ("ath79: image: disable sysupgrade images for routerstations and
ja76pf2")
and
cc5256a ("ath79: base-files: disable sysupgrade for routerstations and
ja76pf2")

Signed-off-by: Tomasz Maciej Nowak <tmn505 at gmail.com>
---
 .../ath79/generic/base-files/lib/upgrade/platform.sh      | 4 ++--
 target/linux/ath79/image/Makefile                         | 8 ++++++++
 target/linux/ath79/image/generic-ubnt.mk                  | 3 ++-
 target/linux/ath79/image/generic.mk                       | 3 ++-
 4 files changed, 14 insertions(+), 4 deletions(-)

diff --git a/target/linux/ath79/generic/base-files/lib/upgrade/platform.sh b/target/linux/ath79/generic/base-files/lib/upgrade/platform.sh
index 10756abbafd5..f4fca06384b1 100644
--- a/target/linux/ath79/generic/base-files/lib/upgrade/platform.sh
+++ b/target/linux/ath79/generic/base-files/lib/upgrade/platform.sh
@@ -45,11 +45,11 @@ platform_do_upgrade() {
 		redboot_fis_do_upgrade "$1" vmlinux_2
 		;;
 	jjplus,ja76pf2)
-		echo "Sysupgrade disabled due bug FS#2428"
+		redboot_fis_do_upgrade "$1" linux
 		;;
 	ubnt,routerstation|\
 	ubnt,routerstation-pro)
-		echo "Sysupgrade disabled due bug FS#2428"
+		redboot_fis_do_upgrade "$1" kernel
 		;;
 	*)
 		default_do_upgrade "$1"
diff --git a/target/linux/ath79/image/Makefile b/target/linux/ath79/image/Makefile
index 4b4a67fd4d54..92ddb15f28ae 100644
--- a/target/linux/ath79/image/Makefile
+++ b/target/linux/ath79/image/Makefile
@@ -47,6 +47,14 @@ define Build/relocate-kernel
 	rm -rf $@.relocate
 endef
 
+define Build/combined-image
+	sh $(TOPDIR)/scripts/combined-image.sh \
+		"$(IMAGE_KERNEL)" \
+		"$@" \
+		"$@.new"
+	@mv $@.new $@
+endef
+
 
 define Device/Default
   DEVICE_DTS_DIR := ../dts
diff --git a/target/linux/ath79/image/generic-ubnt.mk b/target/linux/ath79/image/generic-ubnt.mk
index 6e12c34d8509..7c143519dc9f 100644
--- a/target/linux/ath79/image/generic-ubnt.mk
+++ b/target/linux/ath79/image/generic-ubnt.mk
@@ -310,9 +310,10 @@ define Device/ubnt_routerstation_common
   DEVICE_VENDOR := Ubiquiti
   SOC := ar7161
   IMAGE_SIZE := 16128k
-  IMAGES := factory.bin
+  IMAGES += factory.bin
   IMAGE/factory.bin := append-rootfs | pad-rootfs | mkubntimage | \
 	check-size
+  IMAGE/sysupgrade.bin := append-rootfs | pad-rootfs | combined-image | append-metadata | check-size $$$$(IMAGE_SIZE)
   KERNEL := kernel-bin | append-dtb | lzma | pad-to $$(BLOCKSIZE)
   KERNEL_INITRAMFS := kernel-bin | append-dtb
 endef
diff --git a/target/linux/ath79/image/generic.mk b/target/linux/ath79/image/generic.mk
index a0d5e7ab0190..0819bdbd2778 100644
--- a/target/linux/ath79/image/generic.mk
+++ b/target/linux/ath79/image/generic.mk
@@ -1144,9 +1144,10 @@ define Device/jjplus_ja76pf2
   DEVICE_VENDOR := jjPlus
   DEVICE_MODEL := JA76PF2
   DEVICE_PACKAGES += -kmod-ath9k -swconfig -wpad-basic-wolfssl -uboot-envtools fconfig
-  IMAGES := kernel.bin rootfs.bin
+  IMAGES += kernel.bin rootfs.bin
   IMAGE/kernel.bin := append-kernel
   IMAGE/rootfs.bin := append-rootfs | pad-rootfs
+  IMAGE/sysupgrade.bin := append-rootfs | pad-rootfs | combined-image | append-metadata | check-size $$$$(IMAGE_SIZE)
   KERNEL := kernel-bin | append-dtb | lzma | pad-to $$(BLOCKSIZE)
   KERNEL_INITRAMFS := kernel-bin | append-dtb
   IMAGE_SIZE := 16000k
-- 
2.29.2




More information about the openwrt-devel mailing list