[PATCH v4 1/3] ipq40xx: image: limit kernel size for NOR devices

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


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

'bootipq' command on some devices, with kernel on NOR flash chip, read
kernel partition size from Qualcomm proprietary partition table, which
seems to be stored in MIBIB partition. The partition table can be read
by 'smeminfo' command in U-Boot command line interface. Because this
partition table is never updated on sysupgrade (even when the kernel
size changes) kernel size is capped at initial value, usually 4MiB.
Sysupgrading such kernel will soft-brick the device, which will need
serial console for recovery. Some devices already suffer from this,
beacuse its U-Boot does not allow to boot LZMA or GZIP compressed kernel
image. Even some devices allowing to boot LZMA compressed kernel will hit
this limitation later. Therefore limit the kernel size to 4MiB for
devices not having it specified, so we won't create soft-bricking images.

Signed-off-by: Tomasz Maciej Nowak <tmn505 at gmail.com>
---
 target/linux/ipq40xx/image/generic.mk | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/target/linux/ipq40xx/image/generic.mk b/target/linux/ipq40xx/image/generic.mk
index a9dd2aa0912f..13b6ce1fee41 100644
--- a/target/linux/ipq40xx/image/generic.mk
+++ b/target/linux/ipq40xx/image/generic.mk
@@ -400,6 +400,7 @@ define Device/dlink_dap-2610
 	WRGG_DEVNAME := /dev/mtdblock/8
 	WRGG_SIGNATURE := wapac30_dkbs_dap2610
 	IMAGE_SIZE := 14080k
+	KERNEL_SIZE := 4096k
 	IMAGES += factory.bin
 	# Bootloader expects a special 160 byte header which is added by
 	# wrgg-image.
@@ -478,6 +479,7 @@ define Device/engenius_emd1
 	DEVICE_DTS_CONFIG := config at 4
 	SOC := qcom-ipq4018
 	IMAGE_SIZE := 30720k
+	KERNEL_SIZE := 4096k
 	IMAGES += factory.bin
 	IMAGE/sysupgrade.bin := append-kernel | append-rootfs | pad-rootfs | append-metadata
 	IMAGE/factory.bin := qsdk-ipq-factory-nor | check-size
@@ -800,6 +802,7 @@ define Device/netgear_ex61x0v2
 	NETGEAR_BOARD_ID := EX6150v2series
 	NETGEAR_HW_ID := 29765285+16+0+128+2x2
 	IMAGE_SIZE := 14400k
+	KERNEL_SIZE := 4096k
 	SOC := qcom-ipq4018
 endef
 
@@ -954,6 +957,7 @@ define Device/pakedge_wr-1
 	SOC := qcom-ipq4018
 	BLOCKSIZE := 64k
 	IMAGE_SIZE := 31232k
+	KERNEL_SIZE := 4096k
 	IMAGE/sysupgrade.bin := append-kernel | pad-to $$$$(BLOCKSIZE) | append-rootfs | pad-rootfs | append-metadata
 endef
 TARGET_DEVICES += pakedge_wr-1
@@ -1030,6 +1034,7 @@ define Device/qxwlan_e2600ac-c1
 	BOARD_NAME := e2600ac-c1
 	SOC := qcom-ipq4019
 	IMAGE_SIZE := 31232k
+	KERNEL_SIZE := 4096k
 	IMAGE/sysupgrade.bin := append-kernel | append-rootfs | pad-rootfs | append-metadata
 endef
 TARGET_DEVICES += qxwlan_e2600ac-c1
@@ -1218,6 +1223,7 @@ define Device/zyxel_wre6606
 	DEVICE_DTS_CONFIG := config at 4
 	SOC := qcom-ipq4018
 	IMAGE_SIZE := 13184k
+	KERNEL_SIZE := 4096k
 	IMAGE/sysupgrade.bin := append-kernel | append-rootfs | pad-rootfs | check-size | append-metadata
 	DEVICE_PACKAGES := -kmod-ath10k-ct kmod-ath10k-ct-smallbuffers
 endef
-- 
2.41.0




More information about the openwrt-devel mailing list