[PATCH v4 3/3] ipq40xx: pakedge_wr-1: workaround for kernel bigger than 4MiB

Tomasz Maciej Nowak tmn505 at terefe.re
Thu Jul 27 09:45:16 PDT 2023


From: Tomasz Maciej Nowak <tmn505 at gmail.com>

Alter booting command in U-Boot on first boot after upgrade to workaround
the kernel size limitation. The kernel size read from flash will be 8MiB,
which should suffice for forseable future. As precaution a warning
interupting upgrade is emited, explaining what to do.

Signed-off-by: Tomasz Maciej Nowak <tmn505 at gmail.com>
---
 .../etc/uci-defaults/05_fix-compat-version         |  3 ++-
 .../base-files/lib/preinit/81_patch_uboot_env.sh   | 14 ++++++++++++++
 target/linux/ipq40xx/image/generic.mk              |  8 +++++++-
 3 files changed, 23 insertions(+), 2 deletions(-)
 create mode 100644 target/linux/ipq40xx/base-files/lib/preinit/81_patch_uboot_env.sh

diff --git a/target/linux/ipq40xx/base-files/etc/uci-defaults/05_fix-compat-version b/target/linux/ipq40xx/base-files/etc/uci-defaults/05_fix-compat-version
index c01192089712..a3f90125c6e5 100644
--- a/target/linux/ipq40xx/base-files/etc/uci-defaults/05_fix-compat-version
+++ b/target/linux/ipq40xx/base-files/etc/uci-defaults/05_fix-compat-version
@@ -4,7 +4,8 @@ case "$(board_name)" in
 linksys,ea6350v3|\
 linksys,ea8300|\
 linksys,mr8300|\
-ezviz,cs-w3-wd1200g-eup)
+ezviz,cs-w3-wd1200g-eup|\
+pakedge,wr-1)
 	uci set system. at system[0].compat_version="2.0"
 	uci commit system
 	;;
diff --git a/target/linux/ipq40xx/base-files/lib/preinit/81_patch_uboot_env.sh b/target/linux/ipq40xx/base-files/lib/preinit/81_patch_uboot_env.sh
new file mode 100644
index 000000000000..0cc0ab0fca6f
--- /dev/null
+++ b/target/linux/ipq40xx/base-files/lib/preinit/81_patch_uboot_env.sh
@@ -0,0 +1,14 @@
+. /lib/functions.sh
+
+preinit_patch_uboot_env() {
+	case $(board_name) in
+	pakedge,wr-1)
+		if ! fw_printenv -n OpenWrt &>/dev/null; then
+			fw_setenv OpenWrt 'sf probe; sf read 0x84000000 0x180000 0x800000; bootm 0x84000000'
+			fw_setenv bootcmd "$(fw_printenv -n bootcmd | sed -e 's,bootipq,run OpenWrt,')"
+		fi
+		;;
+	esac
+}
+
+boot_hook_add preinit_main preinit_patch_uboot_env
diff --git a/target/linux/ipq40xx/image/generic.mk b/target/linux/ipq40xx/image/generic.mk
index 13b6ce1fee41..742576a29e5e 100644
--- a/target/linux/ipq40xx/image/generic.mk
+++ b/target/linux/ipq40xx/image/generic.mk
@@ -957,8 +957,14 @@ define Device/pakedge_wr-1
 	SOC := qcom-ipq4018
 	BLOCKSIZE := 64k
 	IMAGE_SIZE := 31232k
-	KERNEL_SIZE := 4096k
+	KERNEL_SIZE := 8192k
 	IMAGE/sysupgrade.bin := append-kernel | pad-to $$$$(BLOCKSIZE) | append-rootfs | pad-rootfs | append-metadata
+	DEVICE_COMPAT_VERSION := 2.0
+	DEVICE_COMPAT_MESSAGE := \n$\
+		Booting command in U-Boot needs to be changed because of kernel \n$\
+		growing beyond 4MiB. Force upgrade to 23.05.0 first and it will \n$\
+		automatically amend booting command in U-Boot on first boot. \n$\
+		Then proceed with the upgrade to desired version.
 endef
 TARGET_DEVICES += pakedge_wr-1
 
-- 
2.41.0




More information about the openwrt-devel mailing list