WRT1900AC - Kernel image is too big

Hi.
I'm trying to build my own OpenWRT firmware from latest git/master branch and "testing kernel" option enabled.
I get this error while packing the images:

mkimage -A arm -O linux -T kernel -C none -a 0x00008000 -e 0x00008000 -n 'ARM OpenWrt Linux-5.10.18'   -d /build/openwrt/build_dir/target-arm_cortex-a9+vfpv3-d16_musl_eabi/linux-mvebu_cortexa9/linksys_wrt1900ac-v1-kernel.bin /build/openwrt/build_dir/target-arm_cortex-a9+vfpv3-d16_musl_eabi/linux           -mvebu_cortexa9/linksys_wrt1900ac-v1-kernel.bin.new
Image Name:   ARM OpenWrt Linux-5.10.18
Created:      Thu Mar  4 02:57:19 2021
Image Type:   ARM Linux Kernel Image (uncompressed)
Data Size:    3764599 Bytes = 3676.37 KiB = 3.59 MiB
Load Address: 00008000
Entry Point:  00008000
mv /build/openwrt/build_dir/target-arm_cortex-a9+vfpv3-d16_musl_eabi/linux-mvebu_cortexa9/linksys_wrt1900ac-v1-kernel.bin.new /build/openwrt/build_dir/target-arm_cortex-a9+vfpv3-d16_musl_eabi/linux-mvebu_cortexa9/linksys_wrt1900ac-v1-kernel.bin
WARNING: Image file /build/openwrt/build_dir/target-arm_cortex-a9+vfpv3-d16_musl_eabi/linux-mvebu_cortexa9/linksys_wrt1900ac-v1-kernel.bin is too big: 3764663 > 3145728
[ -f /build/openwrt/build_dir/target-arm_cortex-a9+vfpv3-d16_musl_eabi/linux-mvebu_cortexa9/linksys_wrt1900ac-v1-kernel.bin -a -f /build/openwrt/build_dir/target-arm_cortex-a9+vfpv3-d16_musl_eabi/linux-mvebu_cortexa9/root.squashfs ]
Makefile:138: recipe for target '/build/openwrt/build_dir/target-arm_cortex-a9+vfpv3-d16_musl_eabi/linux-mvebu_cortexa9/tmp/openwrt-snapshot-mvebu-cortexa9-linksys_wrt1900ac-v1-squashfs-sysupgrade.bin' failed
make[5]: *** [/build/openwrt/build_dir/target-arm_cortex-a9+vfpv3-d16_musl_eabi/linux-mvebu_cortexa9/tmp/openwrt-snapshot-mvebu-cortexa9-linksys_wrt1900ac-v1-squashfs-sysupgrade.bin] Error 1

.config file contains this:
CONFIG_TARGET_KERNEL_PARTSIZE=16
CONFIG_TARGET_ROOTFS_PARTSIZE=256

cat /proc/mtd
dev: size erasesize name
mtd0: 00100000 00020000 "u-boot"
mtd1: 00040000 00020000 "u_env"
mtd2: 00040000 00020000 "s_env"
mtd3: 00100000 00020000 "devinfo"
mtd4: 02800000 00020000 "kernel1"
mtd5: 02500000 00020000 "ubi"
mtd6: 02800000 00020000 "kernel2"
mtd7: 02500000 00020000 "rootfs2"
mtd8: 02600000 00020000 "syscfg"
mtd9: 00780000 00020000 "unused_area"
mtd10: 00008000 00008000 "spi0.0"

Why am I limited to 3MB kernel image size?

The kernel partition of WRT1900AC v1 overwraps with the rootfs partition, only 3MiB can be used for the kernel.

And the limitation of size for kernel is defined here:

2 Likes

Can I simply change that limit, or must I modify bootloader configuration too?

Sorry, I can't comment because I don't know where this limitation came from...
And there is no information about it in OpenWrt Wiki.

Might be of interest:

6 Likes

Yes, that patch works nice.

a series of builds that incorporate the (4MB) kernel size patch is maintained at
https://divested.dev/unofficial-openwrt-builds/mvebu-linksys/
with forum thread at

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.