diff mbox series

ath79: restore sysupgrade support for ja76pf2 and routerstations

Message ID 20201201173027.415097-1-tmn505@gmail.com
State Accepted
Headers show
Series ath79: restore sysupgrade support for ja76pf2 and routerstations | expand

Commit Message

Tomasz Maciej Nowak Dec. 1, 2020, 5:30 p.m. UTC
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@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(-)

Comments

Adrian Schmutzler Dec. 1, 2020, 7:09 p.m. UTC | #1
Hi,

> -----Original Message-----
> From: openwrt-devel [mailto:openwrt-devel-bounces@lists.openwrt.org]
> On Behalf Of Tomasz Maciej Nowak
> Sent: Dienstag, 1. Dezember 2020 18:30
> To: openwrt-devel@lists.openwrt.org
> Subject: [PATCH] ath79: restore sysupgrade support for ja76pf2 and
> routerstations
> 
> 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")

I'm merging this one with a few minor adjustments.

> +define Build/combined-image
> +	sh $(TOPDIR)/scripts/combined-image.sh \
> +		"$(IMAGE_KERNEL)" \
> +		"$@" \
> +		"$@.new"
> +	@mv $@.new $@
> +endef

I wonder whether we can merge this with the similar function from ath25 and put it back into image-commands.mk.
The only difference seems that ath25 uses the $(IMAGE_ROOTFS) argument, while we use the rootfs set up in $@.

Do you have an opinion on that?

Best

Adrian
Tomasz Maciej Nowak Dec. 1, 2020, 7:20 p.m. UTC | #2
Hi.

W dniu 01.12.2020 o 20:09, Adrian Schmutzler pisze:
> Hi,
> 
>> -----Original Message-----
>> From: openwrt-devel [mailto:openwrt-devel-bounces@lists.openwrt.org]
>> On Behalf Of Tomasz Maciej Nowak
>> Sent: Dienstag, 1. Dezember 2020 18:30
>> To: openwrt-devel@lists.openwrt.org
>> Subject: [PATCH] ath79: restore sysupgrade support for ja76pf2 and
>> routerstations
>>
>> 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")
> 
> I'm merging this one with a few minor adjustments.
> 
>> +define Build/combined-image
>> +	sh $(TOPDIR)/scripts/combined-image.sh \
>> +		"$(IMAGE_KERNEL)" \
>> +		"$@" \
>> +		"$@.new"
>> +	@mv $@.new $@
>> +endef
> 
> I wonder whether we can merge this with the similar function from ath25 and put it back into image-commands.mk.
> The only difference seems that ath25 uses the $(IMAGE_ROOTFS) argument, while we use the rootfs set up in $@.
> 
> Do you have an opinion on that?

I'm fine with using that command and moving it to image.mk. I'm planing to move both ja76pf2 and routerstations images to use sysupgrade-tar, after first ath79-only stable release, so I don't know if we should bother moving the combine-image command.

> 
> Best
> 
> Adrian 
> 

Regards
Adrian Schmutzler Dec. 1, 2020, 7:32 p.m. UTC | #3
> I'm fine with using that command and moving it to image.mk. I'm planing to
> move both ja76pf2 and routerstations images to use sysupgrade-tar, after
> first ath79-only stable release, so I don't know if we should bother moving
> the combine-image command.

Ah, then it's probably a waste of time and I won't touch it.

Best

Adrian
diff mbox series

Patch

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