From f89bdab83280b5a5c795e4cea6823609547b498a Mon Sep 17 00:00:00 2001 From: Pawel Dembicki Date: Thu, 14 Mar 2024 13:57:25 +0100 Subject: [PATCH] kirkwood: resize kernel partition for kirkwood devices The 6.1 kernel has caused another increase in kernel size, and now it's more than 3MB: WARNING: Image file iom_ix4-200d-uImage is too big: 3170394 > 3145728 WARNING: Image file iom_ix2-200-uImage is too big: 3171494 > 3145728 WARNING: Image file linksys_e4200-v2-uImage is too big: 3171879 > 3145728 WARNING: Image file linksys_ea4500-uImage is too big: 3171871 > 3145728 WARNING: Image file linksys_ea3500-uImage is too big: 3171651 > 3145728 This causes problems for 5 devices: - Iomega StorCenter ix2/ix4 - Linksys EA3500/EA4200/EA4500 They have enough resources for proper operation with 6.1, but all of them had a 3MB kernel size limit. Let's keep them alive and resize kernel partitions to 4MB. Signed-off-by: Pawel Dembicki --- .../base-files/etc/board.d/05_compat-version | 6 +- .../arch/arm/boot/dts/kirkwood-ea3500.dts | 8 +-- .../arch/arm/boot/dts/kirkwood-ix4-200d.dts | 6 +- target/linux/kirkwood/image/Makefile | 60 +++++++++++++++---- .../patches-6.1/103-iomega-ix2-200.patch | 12 ++-- .../patches-6.1/105-linksys-viper-dts.patch | 8 +-- 6 files changed, 72 insertions(+), 28 deletions(-) diff --git a/target/linux/kirkwood/base-files/etc/board.d/05_compat-version b/target/linux/kirkwood/base-files/etc/board.d/05_compat-version index c6026c481f..9e9abf1f22 100644 --- a/target/linux/kirkwood/base-files/etc/board.d/05_compat-version +++ b/target/linux/kirkwood/base-files/etc/board.d/05_compat-version @@ -8,10 +8,14 @@ board_config_update case "$(board_name)" in + iom,ix2-200|\ + iom,ix4-200d) + ucidef_set_compat_version "2.0" + ;; linksys,e4200-v2|\ linksys,ea3500|\ linksys,ea4500) - ucidef_set_compat_version "2.0" + ucidef_set_compat_version "3.0" ;; esac diff --git a/target/linux/kirkwood/files/arch/arm/boot/dts/kirkwood-ea3500.dts b/target/linux/kirkwood/files/arch/arm/boot/dts/kirkwood-ea3500.dts index 94697866dc..e9f9e30bb4 100644 --- a/target/linux/kirkwood/files/arch/arm/boot/dts/kirkwood-ea3500.dts +++ b/target/linux/kirkwood/files/arch/arm/boot/dts/kirkwood-ea3500.dts @@ -168,9 +168,9 @@ reg = <0x200000 0x1400000>; }; - partition@500000 { + partition@600000 { label = "rootfs1"; - reg = <0x500000 0x1100000>; + reg = <0x600000 0x1000000>; }; partition@1600000 { @@ -178,9 +178,9 @@ reg = <0x1600000 0x1400000>; }; - partition@1900000 { + partition@1a00000 { label = "rootfs2"; - reg = <0x1900000 0x1100000>; + reg = <0x1a00000 0x1000000>; }; partition@2a00000 { diff --git a/target/linux/kirkwood/files/arch/arm/boot/dts/kirkwood-ix4-200d.dts b/target/linux/kirkwood/files/arch/arm/boot/dts/kirkwood-ix4-200d.dts index d57e1f5d5a..6220fbf137 100644 --- a/target/linux/kirkwood/files/arch/arm/boot/dts/kirkwood-ix4-200d.dts +++ b/target/linux/kirkwood/files/arch/arm/boot/dts/kirkwood-ix4-200d.dts @@ -180,12 +180,12 @@ partition@100000 { label = "kernel"; - reg = <0x100000 0x300000>; + reg = <0x100000 0x400000>; }; - partition@400000 { + partition@500000 { label = "ubi"; - reg = <0x400000 0x1C00000>; + reg = <0x500000 0x1B00000>; }; }; }; diff --git a/target/linux/kirkwood/image/Makefile b/target/linux/kirkwood/image/Makefile index 5ba81cad80..8aa2d69720 100644 --- a/target/linux/kirkwood/image/Makefile +++ b/target/linux/kirkwood/image/Makefile @@ -64,12 +64,50 @@ define Build/ctera-firmware rm -rf $@.tmp endef -define Device/kernel-size-migration +define Device/kernel-size-migration-iomega DEVICE_COMPAT_VERSION := 2.0 - DEVICE_COMPAT_MESSAGE := Partition design has changed compared to \ - older versions (up to 21.02) due to kernel size restrictions. \ + DEVICE_COMPAT_MESSAGE := \n$\ + !The partitioning of the router has changed! \n$\ + Partition design has changed compared to \ + older versions (up to 23.05) due to kernel size restrictions. \ Upgrade via sysupgrade mechanism is not possible, so new \ - installation via factory style image is required. + installation via initramfs image is required.\n$\ + Please adjust bootcmd in u-boot console:\n$\ + setenv bootcmd \ + 'setenv bootargs $$$${console} $$$${mtdparts} $$$${bootargs_root}; \ + nand read.e 0x800000 0x100000 0x400000; bootm 0x00800000'\n$\ + saveenv\n$\ + or use OpenWrt shell:\n$\ + fw_setenv bootcmd \ + "setenv bootargs $$$${console} $$$${mtdparts} $$$${bootargs_root};\ + nand read.e 0x800000 0x100000 0x400000; bootm 0x00800000"\n$\ + and reinstall image with initramfs image. \ + Please see original instructions for more details. +endef + +define Device/kernel-size-migration-linksys + DEVICE_COMPAT_VERSION := 3.0 + DEVICE_COMPAT_MESSAGE := \n$\ + !The partitioning of the router has changed! \n$\ + Partition design has changed compared to \ + older versions (up to 23.05) due to kernel size restrictions. \n$\ + Upgrade via sysupgrade mechanism is not possible, so u-boot args \ + adjustment and new installation via factory style image is required. \n$\ + Upgrade instructions: \n$\ + 2. Run folowing commands in console (ssh or serial): \n$\ + \t fw_printenv \n$\ + \t fw_setenv nandboot \ + "$$$$(fw_printenv nandboot | awk -F= '{sub(/^nandboot=/, "");print}' \ + | sed 's/0x300000/0x400000/g')"\n$\ + \t fw_setenv altnandboot \ + "$$$$(fw_printenv altnandboot | awk -F= '{sub(/^altnandboot=/, "");print}' \ + | sed 's/0x300000/0x400000/g')"\n$\ + 3. Test if envs are ok by 'fw_printenv'. \ + It should be the same except last argument of\ + 'nand read.e' in 'nandboot' and 'altnandboot'.\n$\ + 4. If envs are ok, please apply FACTORY image with command:\n$\ + \t sysupgrade -F -n OPENWRT_FACTORY_IMAGE.bin \n$\ + 5. System should start normally. If not, serial console will be required. endef define Device/Default @@ -169,6 +207,7 @@ endef TARGET_DEVICES += iom_iconnect-1.1 define Device/iom_ix2-200 + $(Device/kernel-size-migration-iomega) DEVICE_VENDOR := Iomega DEVICE_MODEL := StorCenter ix2-200 DEVICE_DTS := kirkwood-iomega_ix2_200 @@ -177,7 +216,7 @@ define Device/iom_ix2-200 PAGESIZE := 512 SUBPAGESIZE := 256 BLOCKSIZE := 16k - KERNEL_SIZE := 3072k + KERNEL_SIZE := 4096k KERNEL_IN_UBI := UBINIZE_OPTS := -E 5 IMAGE_SIZE := 31744k @@ -187,6 +226,7 @@ endef TARGET_DEVICES += iom_ix2-200 define Device/iom_ix4-200d + $(Device/kernel-size-migration-iomega) DEVICE_VENDOR := Iomega DEVICE_MODEL := StorCenter ix4-200d DEVICE_PACKAGES := kmod-ata-marvell-sata kmod-fs-ext4 \ @@ -195,7 +235,7 @@ define Device/iom_ix4-200d PAGESIZE := 512 SUBPAGESIZE := 256 BLOCKSIZE := 16k - KERNEL_SIZE := 3072k + KERNEL_SIZE := 4096k KERNEL_IN_UBI := UBINIZE_OPTS := -E 5 IMAGE_SIZE := 31744k @@ -221,41 +261,37 @@ endef TARGET_DEVICES += iptime_nas1 define Device/linksys + $(Device/kernel-size-migration-linksys) DEVICE_VENDOR := Linksys DEVICE_PACKAGES := kmod-mwl8k wpad-basic-mbedtls kmod-gpio-button-hotplug \ kmod-rtc-mv KERNEL_IN_UBI := + KERNEL_SIZE := 4096k UBINIZE_OPTS := -E 5 IMAGE/factory.bin := append-kernel | pad-to $$$$(KERNEL_SIZE) | append-ubi endef define Device/linksys_e4200-v2 $(Device/linksys) - $(Device/kernel-size-migration) DEVICE_MODEL := E4200 DEVICE_VARIANT := v2 - KERNEL_SIZE := 3072k SUPPORTED_DEVICES += linksys,viper linksys-viper endef TARGET_DEVICES += linksys_e4200-v2 define Device/linksys_ea3500 $(Device/linksys) - $(Device/kernel-size-migration) DEVICE_MODEL := EA3500 PAGESIZE := 512 SUBPAGESIZE := 256 BLOCKSIZE := 16k - KERNEL_SIZE := 3072k SUPPORTED_DEVICES += linksys,audi linksys-audi endef TARGET_DEVICES += linksys_ea3500 define Device/linksys_ea4500 $(Device/linksys) - $(Device/kernel-size-migration) DEVICE_MODEL := EA4500 - KERNEL_SIZE := 3072k SUPPORTED_DEVICES += linksys,viper linksys-viper endef TARGET_DEVICES += linksys_ea4500 diff --git a/target/linux/kirkwood/patches-6.1/103-iomega-ix2-200.patch b/target/linux/kirkwood/patches-6.1/103-iomega-ix2-200.patch index 9313b4bc3e..db04c09f76 100644 --- a/target/linux/kirkwood/patches-6.1/103-iomega-ix2-200.patch +++ b/target/linux/kirkwood/patches-6.1/103-iomega-ix2-200.patch @@ -34,7 +34,7 @@ label = "status:red:health_led"; gpios = <&gpio1 5 GPIO_ACTIVE_HIGH>; }; -@@ -186,18 +193,18 @@ +@@ -186,19 +193,19 @@ }; partition@a0000 { @@ -46,16 +46,20 @@ partition@100000 { - label = "uImage"; +- reg = <0x100000 0x300000>; + label = "kernel"; - reg = <0x100000 0x300000>; ++ reg = <0x100000 0x400000>; }; - partition@400000 { +- partition@400000 { - label = "rootfs"; +- reg = <0x400000 0x1C00000>; ++ partition@500000 { + label = "ubi"; - reg = <0x400000 0x1C00000>; ++ reg = <0x500000 0x1C00000>; }; }; + @@ -211,7 +218,7 @@ }; diff --git a/target/linux/kirkwood/patches-6.1/105-linksys-viper-dts.patch b/target/linux/kirkwood/patches-6.1/105-linksys-viper-dts.patch index d56a469d94..b1604ec92c 100644 --- a/target/linux/kirkwood/patches-6.1/105-linksys-viper-dts.patch +++ b/target/linux/kirkwood/patches-6.1/105-linksys-viper-dts.patch @@ -36,9 +36,9 @@ - partition@4a0000 { - label = "rootfs"; - reg = <0x4A0000 0x1760000>; -+ partition@500000 { ++ partition@600000 { + label = "rootfs1"; -+ reg = <0x500000 0x1700000>; ++ reg = <0x600000 0x1600000>; }; partition@1c00000 { @@ -51,9 +51,9 @@ - partition@1ea0000 { - label = "alt_rootfs"; - reg = <0x1EA0000 0x1760000>; -+ partition@1f00000 { ++ partition@2000000 { + label = "rootfs2"; -+ reg = <0x1F00000 0x1700000>; ++ reg = <0x2000000 0x1600000>; }; partition@3600000 { -- 2.30.2