[OpenWrt-Devel] [PATCH 2/2] ath79: GL-AR750S (NOR/NAND): limit factory.img kernel size to 2 MB

Jeff Kletsky lede at allycomm.com
Wed Nov 13 16:09:49 EST 2019


From: Jeff Kletsky <git-commits at allycomm.com>

The present U-Boot for GL-AR750S has a limit of 2 MB for kernel size.
While sysupgrade can manage kernels up to the present limit of 4 MB,
directly flashing a factory.img with a kernel size greater than 2 MB
through U-Boot will result in an unbootable device.

This commit uses the newly-introduced check-kernel-size build
operation to prevent the output of factory.img when the kernel
exceeds 2 MB in size, yet permits output of sysupgrade.img
as long as the kernel is within KERNEL_SIZE := 4096k

Cc: Chuanhong Guo <gch981213 at gmail.com>

Signed-off-by: Jeff Kletsky <git-commits at allycomm.com>
---
 target/linux/ath79/image/nand.mk | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/target/linux/ath79/image/nand.mk b/target/linux/ath79/image/nand.mk
index 7940167e1a..75c1af89bb 100644
--- a/target/linux/ath79/image/nand.mk
+++ b/target/linux/ath79/image/nand.mk
@@ -89,12 +89,15 @@ define Device/glinet_gl-ar750s-common
   VID_HDR_OFFSET := 2048
 endef
 
+# NB: The kernel size is intentionally restricted at this time; see commit message
 define Device/glinet_gl-ar750s-nor-nand
   $(Device/glinet_gl-ar750s-common)
   DEVICE_VARIANT := NOR/NAND
   BLOCKSIZE := 128k
+  GL_UBOOT_UBI_OFFSET := 2048k
   IMAGES += factory.img
-  IMAGE/factory.img := append-kernel | pad-to $$$$(KERNEL_SIZE) | append-ubi
+  IMAGE/factory.img := append-kernel | pad-to $$$$(GL_UBOOT_UBI_OFFSET) | \
+			append-ubi | check-kernel-size $$$$(GL_UBOOT_UBI_OFFSET)
   IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata
   SUPPORTED_DEVICES += glinet,gl-ar750s-nor
 endef
-- 
2.20.1


_______________________________________________
openwrt-devel mailing list
openwrt-devel at lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel



More information about the openwrt-devel mailing list