From 8e09f9ffc3cc67d2e64984ad463ce677ae9d9cca Mon Sep 17 00:00:00 2001 From: Tomasz Maciej Nowak Date: Mon, 4 Jul 2022 14:23:03 +0200 Subject: ath79: switch some RedBoot based devices to OKLI loader After the kernel has switched version to 5.10, JA76PF2 and RouterStations lost the capability to sysupgrade the OpenWrt version. The cause is the lack of porting the patches responsible for partial flash erase block writing and these boards FIS directory and RedBoot config partitions share the same erase block. Because of that the FIS directory can't be updated to accommodate kernel/rootfs partition size changes. This could be remedied by bootloader update, but it is very intrusive and could potentially lead to non-trivial recovery procedure, if something went wrong. The less difficult option is to use OpenWrt kernel loader, which will let us use static partition sizes and employ mtd splitter to dynamically adjust kernel and rootfs partition sizes. On sysupgrade from ath79 19.07 or 21.02 image, which still let to modify FIS directory, the loader will be written to kernel partition, while the kernel+rootfs to rootfs partition. The caveats are: * image format changes, no possible upgrade from ar71xx target images * downgrade to any older OpenWrt version will require TFTP recovery or usage of bootloader command line interface To downgrade to 19.07 or 21.02, or to upgrade if one is already on OpenWrt with kernel 5.10, for RouterStations use TFTP recovery procedure. For JA76PF2 use instructions from this commit message: commit 0cc87b3bacee ("ath79: image: disable sysupgrade images for routerstations and ja76pf2"), replacing kernel image with loader (loader.bin suffix) and rootfs image with firmware (firmware.bin suffix). Fixes: b10d6044599d ("kernel: add linux 5.10 support") Fixes: 15aa53d7ee65 ("ath79: switch to Kernel 5.10") Signed-off-by: Tomasz Maciej Nowak (mkubntimage was moved to generic-ubnt.mk) Signed-off-by: Christian Lamparter (cherry picked from commit 5c142aad7bc018fe000789740a486c49973035b8) --- target/linux/ath79/image/Makefile | 8 -------- target/linux/ath79/image/generic-ubnt.mk | 24 ++++++++++++++++-------- target/linux/ath79/image/generic.mk | 25 +++++++++++++++++-------- 3 files changed, 33 insertions(+), 24 deletions(-) (limited to 'target/linux/ath79/image') diff --git a/target/linux/ath79/image/Makefile b/target/linux/ath79/image/Makefile index 768ec57044..32a4b2abed 100644 --- a/target/linux/ath79/image/Makefile +++ b/target/linux/ath79/image/Makefile @@ -8,14 +8,6 @@ DEVICE_VARS += LOADER_FLASH_MAX LOADER_KERNEL_MAGIC DEVICE_VARS += NETGEAR_BOARD_ID NETGEAR_HW_ID DEVICE_VARS += RAS_BOARD RAS_ROOTFS_SIZE RAS_VERSION -define Build/combined-image - sh $(TOPDIR)/scripts/combined-image.sh \ - "$(IMAGE_KERNEL)" \ - "$@" \ - "$@.new" - @mv $@.new $@ -endef - define Build/loader-common rm -rf $@.src $(MAKE) -C lzma-loader \ diff --git a/target/linux/ath79/image/generic-ubnt.mk b/target/linux/ath79/image/generic-ubnt.mk index 2381d92567..cb7a6417b0 100644 --- a/target/linux/ath79/image/generic-ubnt.mk +++ b/target/linux/ath79/image/generic-ubnt.mk @@ -394,14 +394,24 @@ define Device/ubnt_routerstation_common kmod-usb2 fconfig DEVICE_VENDOR := Ubiquiti SOC := ar7161 - IMAGE_SIZE := 16128k + LOADER_TYPE := bin + LOADER_FLASH_OFFS := 0x50000 + COMPILE := loader-$(1).bin + COMPILE/loader-$(1).bin := loader-okli-compile | lzma | pad-to 128k + IMAGE_SIZE := 16000k IMAGES += factory.bin - IMAGE/factory.bin := append-rootfs | pad-rootfs | mkubntimage | \ - check-size - IMAGE/sysupgrade.bin := append-rootfs | pad-rootfs | combined-image | \ - check-size | append-metadata - KERNEL := kernel-bin | append-dtb | lzma | pad-to $$(BLOCKSIZE) + IMAGE/factory.bin := append-kernel | uImage lzma -M 0x4f4b4c49 | pad-to $$$$(BLOCKSIZE) | \ + append-rootfs | pad-rootfs | pad-to $$$$(BLOCKSIZE) | \ + mkubntimage $$$$(KDIR)/loader-$(1).bin | check-size + IMAGE/sysupgrade.bin := append-kernel | uImage lzma -M 0x4f4b4c49 | pad-to $$$$(BLOCKSIZE) | \ + append-rootfs | pad-rootfs | pad-to $$$$(BLOCKSIZE) | check-size | \ + sysupgrade-tar kernel=$$$$(KDIR)/loader-$(1).bin rootfs=$$$$@ | append-metadata + KERNEL := kernel-bin | append-dtb | lzma KERNEL_INITRAMFS := kernel-bin | append-dtb + DEVICE_COMPAT_VERSION := 2.0 + DEVICE_COMPAT_MESSAGE := Partition design has changed compared to older versions (19.07 and 21.02) \ + due to kernel drivers restrictions. Upgrade via sysupgrade mechanism is one way operation. \ + Downgrading OpenWrt version will involve usage of TFTP recovery or bootloader command line interface. endef define Device/ubnt_routerstation @@ -411,7 +421,6 @@ define Device/ubnt_routerstation UBNT_TYPE := RSx UBNT_CHIP := ar7100 DEVICE_PACKAGES += -swconfig - SUPPORTED_DEVICES += routerstation endef TARGET_DEVICES += ubnt_routerstation @@ -421,7 +430,6 @@ define Device/ubnt_routerstation-pro UBNT_BOARD := RSPRO UBNT_TYPE := RSPRO UBNT_CHIP := ar7100pro - SUPPORTED_DEVICES += routerstation-pro endef TARGET_DEVICES += ubnt_routerstation-pro diff --git a/target/linux/ath79/image/generic.mk b/target/linux/ath79/image/generic.mk index c4b810cb59..2b81690654 100644 --- a/target/linux/ath79/image/generic.mk +++ b/target/linux/ath79/image/generic.mk @@ -1454,15 +1454,24 @@ 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 - IMAGE/kernel.bin := append-kernel - IMAGE/rootfs.bin := append-rootfs | pad-rootfs - IMAGE/sysupgrade.bin := append-rootfs | pad-rootfs | combined-image | \ - check-size | append-metadata - KERNEL := kernel-bin | append-dtb | lzma | pad-to $$(BLOCKSIZE) + LOADER_TYPE := bin + LOADER_FLASH_OFFS := 0x60000 + COMPILE := loader-$(1).bin + COMPILE/loader-$(1).bin := loader-okli-compile | lzma | pad-to 128k + ARTIFACTS := loader.bin + ARTIFACT/loader.bin := append-loader-okli $(1) + IMAGES += firmware.bin + IMAGE/firmware.bin := append-kernel | uImage lzma -M 0x4f4b4c49 | pad-to $$$$(BLOCKSIZE) | \ + append-rootfs | pad-rootfs | pad-to $$$$(BLOCKSIZE) | check-size + IMAGE/sysupgrade.bin := $$(IMAGE/firmware.bin) | \ + sysupgrade-tar kernel=$$$$(KDIR)/loader-$(1).bin rootfs=$$$$@ | append-metadata + KERNEL := kernel-bin | append-dtb | lzma KERNEL_INITRAMFS := kernel-bin | append-dtb - IMAGE_SIZE := 16000k - SUPPORTED_DEVICES += ja76pf2 + IMAGE_SIZE := 15872k + DEVICE_COMPAT_VERSION := 2.0 + DEVICE_COMPAT_MESSAGE := Partition design has changed compared to older versions (19.07 and 21.02) \ + due to kernel drivers restrictions. Upgrade via sysupgrade mechanism is one way operation. \ + Downgrading OpenWrt version will involve usage of bootloader command line interface. endef TARGET_DEVICES += jjplus_ja76pf2 -- cgit v1.2.3