mvebu: mamba resize kernel to 4MB
authorTad Davanzo <tad@spotco.us>
Sat, 6 Feb 2021 03:38:03 +0000 (22:38 -0500)
committerHauke Mehrtens <hauke@hauke-m.de>
Fri, 19 Mar 2021 14:30:01 +0000 (15:30 +0100)
mamba has a 3MB kernel partition as specified by the DTS.
3MB is not sufficient for building with many kernel modules or newer
kernel versions.

mamba uboot however as set from factory will load up to 4MB.
This can be observed by looking a uboot log:
NAND read: device 0 offset 0xa00000, size 0x400000
4194304 bytes read: OK
and from uboot environment variables:
$ fw_printenv | grep "pri_kern_size";
pri_kern_size=0x400000

Resize the root partitions from 37MB to 36MB to let kernel expand
into it another 1MB.
And set kernel target size to 4MB.

Lastly add a compatibility version message: kernel-size-migration.
And set it on mamba to prevent sysupgrading without first reinstalling from
a factory image.

Signed-off-by: Tad Davanzo <tad@spotco.us>
target/linux/mvebu/cortexa9/base-files/etc/uci-defaults/05_fix-compat-version [new file with mode: 0644]
target/linux/mvebu/image/cortexa9.mk
target/linux/mvebu/patches-5.10/316-armada-xp-linksys-mamba-resize-kernel.patch [new file with mode: 0644]
target/linux/mvebu/patches-5.4/318-armada-xp-linksys-mamba-resize-kernel.patch [new file with mode: 0644]

diff --git a/target/linux/mvebu/cortexa9/base-files/etc/uci-defaults/05_fix-compat-version b/target/linux/mvebu/cortexa9/base-files/etc/uci-defaults/05_fix-compat-version
new file mode 100644 (file)
index 0000000..70e0e9e
--- /dev/null
@@ -0,0 +1,10 @@
+. /lib/functions.sh
+
+case "$(board_name)" in
+       linksys,wrt1900ac-v1)
+               uci set system.@system[0].compat_version="2.0"
+               uci commit system
+               ;;
+esac
+
+exit 0
index a7ebc30a715f071a238d9e0940377e6421fad1c8..90c0dfa8270100cff7298a8a597339cbcd429767 100644 (file)
@@ -8,6 +8,12 @@ define Device/dsa-migration
   DEVICE_COMPAT_MESSAGE := Config cannot be migrated from swconfig to DSA
 endef
 
+define Device/kernel-size-migration
+  DEVICE_COMPAT_VERSION := 2.0
+  DEVICE_COMPAT_MESSAGE := Partition design has changed compared to older versions (up to 19.07) due to kernel size restrictions. \
+       Upgrade via sysupgrade mechanism is not possible, so new installation via factory style image is required.
+endef
+
 define Device/buffalo_ls421de
   $(Device/NAND-128K)
   DEVICE_VENDOR := Buffalo
@@ -108,14 +114,14 @@ TARGET_DEVICES += linksys_wrt1900acs
 
 define Device/linksys_wrt1900ac-v1
   $(call Device/linksys)
-  $(Device/dsa-migration)
+  $(Device/kernel-size-migration)
   DEVICE_MODEL := WRT1900AC
   DEVICE_VARIANT := v1
   DEVICE_ALT0_VENDOR := Linksys
   DEVICE_ALT0_MODEL := Mamba
   DEVICE_DTS := armada-xp-linksys-mamba
   DEVICE_PACKAGES += mwlwifi-firmware-88w8864
-  KERNEL_SIZE := 3072k
+  KERNEL_SIZE := 4096k
   SUPPORTED_DEVICES += armada-xp-linksys-mamba linksys,mamba
   DEFAULT := n
 endef
diff --git a/target/linux/mvebu/patches-5.10/316-armada-xp-linksys-mamba-resize-kernel.patch b/target/linux/mvebu/patches-5.10/316-armada-xp-linksys-mamba-resize-kernel.patch
new file mode 100644 (file)
index 0000000..f1fddce
--- /dev/null
@@ -0,0 +1,37 @@
+From 258233f00bcd013050efee00c5d9128ef8cd62dd Mon Sep 17 00:00:00 2001
+From: Tad <tad@spotco.us>
+Date: Fri, 5 Feb 2021 22:32:11 -0500
+Subject: [PATCH] ARM: dts: armada-xp-linksys-mamba: Increase kernel
+ partition to 4MB
+
+Signed-off-by: Tad Davanzo <tad@spotco.us>
+---
+ arch/arm/boot/dts/armada-xp-linksys-mamba.dts | 8 ++++----
+ 1 file changed, 4 insertions(+), 4 deletions(-)
+
+--- a/arch/arm/boot/dts/armada-xp-linksys-mamba.dts
++++ b/arch/arm/boot/dts/armada-xp-linksys-mamba.dts
+@@ -456,9 +456,9 @@
+                               reg = <0xa00000 0x2800000>;  /* 40MB */
+                       };
+-                      partition@d00000 {
++                      partition@e00000 {
+                               label = "rootfs1";
+-                              reg = <0xd00000 0x2500000>;  /* 37MB */
++                              reg = <0xe00000 0x2400000>;  /* 36MB */
+                       };
+                       /* kernel2 overlaps with rootfs2 by design */
+@@ -467,9 +467,9 @@
+                               reg = <0x3200000 0x2800000>; /* 40MB */
+                       };
+-                      partition@3500000 {
++                      partition@3600000 {
+                               label = "rootfs2";
+-                              reg = <0x3500000 0x2500000>; /* 37MB */
++                              reg = <0x3600000 0x2400000>; /* 36MB */
+                       };
+                       /*
diff --git a/target/linux/mvebu/patches-5.4/318-armada-xp-linksys-mamba-resize-kernel.patch b/target/linux/mvebu/patches-5.4/318-armada-xp-linksys-mamba-resize-kernel.patch
new file mode 100644 (file)
index 0000000..f1fddce
--- /dev/null
@@ -0,0 +1,37 @@
+From 258233f00bcd013050efee00c5d9128ef8cd62dd Mon Sep 17 00:00:00 2001
+From: Tad <tad@spotco.us>
+Date: Fri, 5 Feb 2021 22:32:11 -0500
+Subject: [PATCH] ARM: dts: armada-xp-linksys-mamba: Increase kernel
+ partition to 4MB
+
+Signed-off-by: Tad Davanzo <tad@spotco.us>
+---
+ arch/arm/boot/dts/armada-xp-linksys-mamba.dts | 8 ++++----
+ 1 file changed, 4 insertions(+), 4 deletions(-)
+
+--- a/arch/arm/boot/dts/armada-xp-linksys-mamba.dts
++++ b/arch/arm/boot/dts/armada-xp-linksys-mamba.dts
+@@ -456,9 +456,9 @@
+                               reg = <0xa00000 0x2800000>;  /* 40MB */
+                       };
+-                      partition@d00000 {
++                      partition@e00000 {
+                               label = "rootfs1";
+-                              reg = <0xd00000 0x2500000>;  /* 37MB */
++                              reg = <0xe00000 0x2400000>;  /* 36MB */
+                       };
+                       /* kernel2 overlaps with rootfs2 by design */
+@@ -467,9 +467,9 @@
+                               reg = <0x3200000 0x2800000>; /* 40MB */
+                       };
+-                      partition@3500000 {
++                      partition@3600000 {
+                               label = "rootfs2";
+-                              reg = <0x3500000 0x2500000>; /* 37MB */
++                              reg = <0x3600000 0x2400000>; /* 36MB */
+                       };
+                       /*