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

Tomasz Maciej Nowak tmn505 at terefe.re
Fri Jul 7 08:11:41 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 compressed kernel image
and/or kernel zImage. 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 | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/target/linux/ipq40xx/image/generic.mk b/target/linux/ipq40xx/image/generic.mk
index f15463ae8ca5..d9d60a25ff0f 100644
--- a/target/linux/ipq40xx/image/generic.mk
+++ b/target/linux/ipq40xx/image/generic.mk
@@ -130,6 +130,7 @@ define Device/8dev_habanero-dvk
 	DEVICE_VENDOR := 8devices
 	DEVICE_MODEL := Habanero DVK
 	IMAGE_SIZE := 30976k
+	KERNEL_SIZE := 4096k
 	SOC := qcom-ipq4019
 	IMAGE/sysupgrade.bin := append-kernel | pad-to 64k | append-rootfs | pad-rootfs | check-size | append-metadata
 endef
@@ -400,6 +401,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 +480,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 +803,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 +958,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 +1035,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
@@ -1202,6 +1208,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