Ipq40xx kernel size and U-Boot: v5.10 is too big for 4 MB

Kernel v5.10 support for ipq40xx was landed in OpenWrt for testing purposes.

As can be seen in the commit message, two GL.iNet devices failed to build with buildbot settings and all
feeds installed, for example:

FIT description: ARM OpenWrt FIT (Flattened Image Tree)
Created:         Thu Sep 30 21:07:31 2021
 Image 0 (kernel-1)
  Description:  ARM OpenWrt Linux-5.10.64
  Created:      Thu Sep 30 21:07:31 2021
  Type:         Kernel Image
  Compression:  gzip compressed
  Data Size:    4212548 Bytes = 4113.82 KiB = 4.02 MiB
  Architecture: ARM
  OS:           Linux
  Load Address: 0x80208000
  Entry Point:  0x80208000
  Hash algo:    crc32
  Hash value:   54fc4207
  Hash algo:    sha1
  Hash value:   7461cdf544e7d56310807c36e394dacbc58d2acc
 Image 1 (fdt-1)
  Description:  ARM OpenWrt glinet_gl-b1300 device tree blob
  Created:      Thu Sep 30 21:07:31 2021
  Type:         Flat Device Tree
  Compression:  uncompressed
  Data Size:    16326 Bytes = 15.94 KiB = 0.02 MiB
  Architecture: ARM
  Hash algo:    crc32
  Hash value:   303d4ba2
  Hash algo:    sha1
  Hash value:   0dbf495a0c42dfbc3ff5a3ebe4dc3f456ad91aed
 Default Configuration: 'config@1'
 Configuration 0 (config@1)
  Description:  OpenWrt glinet_gl-b1300
  Kernel:       kernel-1
  FDT:          fdt-1
WARNING: Image file /openwrt/build_dir/target-arm_cortex-a7+neon-vfpv4_musl_eabi/linux-ipq40xx_generic/glinet_gl-b1300-fit-uImage.itb is too big: 4230764 > 4194304

So I had to repeat @jeffsf, but for ipq40xx, especially GL-B1300 and GL-S1300:

Thanks!

Looks like switching to zImage (from gzip compression) will be the solution a good workaround:

  • all the U-Boot releases support, even the initial release U-Boot 2012.07 [Chaos Calmer 15.05.1,r35193] (Apr 13 2018 - 13:54:46)
  • shrinks the kernel by ~1200k

Thanks for that solution. It’s possible to load >4MB kernel after patching uboot. I’ll do some test.

1 Like

That would be far better solution, thanks!

While testing other solutions, I was able to start oversized kernels up to 0x00450000.
After upgrading to newer versions, and rolling back to a backup of my original U-Boot (U-Boot 2012.07 [Chaos Calmer 15.05.1,r35193] (Apr 13 2018 - 13:54:46)), I wasn’t able to boot any oversized kernel. :woman_shrugging:

I happily test new binary releases and commits from that uboot-ipq40xx.

Hi Szabolcs,

I’v patch uboot to load maxium 8MB kernel. I think that’s extensible enough. you can check commit.
This patch load larger kernel than the pre-defined partition table on nor flash, partiton table can be checked by uboot command

smeminfo
1 Like

Hi!

Thank you very much for the fix!

Sadly I’m unable to verify smeminfo because my serial connection doesn’t send anything to the device! :upside_down_face:

I tested the newest U-Boot release (U-Boot 2012.07 [local,local] (Oct 21 2021 - 18:08:35)) with an oversized, ~10 MB kernel, and it doesn’t boot: :heavy_check_mark:

FIT description: ARM OpenWrt FIT (Flattened Image Tree)
Created:         Sat Oct 23 11:31:22 2021
 Image 0 (kernel-1)
  Description:  ARM OpenWrt Linux-5.4.155
  Created:      Sat Oct 23 11:31:22 2021
  Type:         Kernel Image
  Compression:  uncompressed
  Data Size:    10642944 Bytes = 10393.50 KiB = 10.15 MiB
  Architecture: ARM
  OS:           Linux
  Load Address: 0x80208000
  Entry Point:  0x80208000
  Hash algo:    crc32
  Hash value:   7da27167
  Hash algo:    sha1
  Hash value:   d4b09f29fe908dd33f2962933c3bdc9f2243e279
 Image 1 (fdt-1)
  Description:  ARM OpenWrt glinet_gl-b1300 device tree blob
  Created:      Sat Oct 23 11:31:22 2021
  Type:         Flat Device Tree
  Compression:  uncompressed
  Data Size:    16326 Bytes = 15.94 KiB = 0.02 MiB
  Architecture: ARM
  Hash algo:    crc32
  Hash value:   303d4ba2
  Hash algo:    sha1
  Hash value:   0dbf495a0c42dfbc3ff5a3ebe4dc3f456ad91aed
 Default Configuration: 'config@1'
 Configuration 0 (config@1)
  Description:  OpenWrt glinet_gl-b1300
  Kernel:       kernel-1
  FDT:          fdt-1

After that, I checked a 4+ MB kernel: boots nicely! :heavy_check_mark:

SF: Detected MX25L25635E with page size 4 KiB, total 32 MiB
## Booting kernel from FIT Image at 84000000 ...
   Using 'config@1' configuration
   Trying 'kernel-1' kernel subimage
     Description:  ARM OpenWrt Linux-5.10.75
     Type:         Kernel Image
     Compression:  gzip compressed
     Data Start:   0x840000e4
     Data Size:    4561994 Bytes = 4.4 MiB
     Architecture: ARM
     OS:           Linux
     Load Address: 0x80208000
     Entry Point:  0x80208000
     Hash algo:    crc32
     Hash value:   2242d08b
     Hash algo:    sha1
     Hash value:   83becb3c9130f7054e2cd880dd442fecb073890b
   Verifying Hash Integrity ... crc32+ sha1+ OK
## Flattened Device Tree from FIT Image at 84000000
   Using 'config@1' configuration
   Trying 'fdt-1' FDT blob subimage
     Description:  ARM OpenWrt glinet_gl-b1300 device tree blob
     Type:         Flat Device Tree
     Compression:  uncompressed
     Data Start:   0x84459e6c
     Data Size:    16326 Bytes = 15.9 KiB
     Architecture: ARM
     Hash algo:    crc32
     Hash value:   303d4ba2
     Hash algo:    sha1
     Hash value:   0dbf495a0c42dfbc3ff5a3ebe4dc3f456ad91aed
   Verifying Hash Integrity ... crc32+ sha1+ OK
   Booting using the fdt blob at 0x84459e6c
   Uncompressing Kernel Image ... OK
   Loading Device Tree to 86ff9000, end 86ffffc5 ... OK
ipq: fdt fixup unable to find compatible node
Using machid 0x8010000 from environment

Starting kernel ...

[    0.000000] Booting Linux on physical CPU 0x0
[    0.000000] Linux version 5.10.75 (xabolcs@ut2004) (arm-openwrt-linux-muslgnueabi-gcc (OpenWrt GCC 11.2.0 r17816-94c41ef2ef) 11.2.0, GNU ld (GNU Binutils) 2.37) #0 SMP Sat Oct 23 11:31:22 2021
[    0.000000] CPU: ARMv7 Processor [410fc075] revision 5 (ARMv7), cr=10c5387d
[    0.000000] CPU: div instructions available: patching division code
[    0.000000] CPU: PIPT / VIPT nonaliasing data cache, VIPT aliasing instruction cache
[    0.000000] OF: fdt: Machine model: GL.iNet GL-B1300

Your commit message is:

 fix boot kernel lager than 4MB, maximum 8MB 

Is this true for all the ipq-40xx devices: GL-AP1300, GL-B1300, GL-S1300 and GL-B2200?

I’m asking this, because I’d like to create an OpenWrt commit where all these devices get an KERNEL_SIZE := 8192k limit, to prevent the devices from unnecessary boot loop.

Another question: all these devices support booting an uncompressed image? I know GL-B1300 and GL-B2200 work for sure.
I’m asking this, because I’d like to switch the remaining devices to use zImage.

Sorry that I make that commit message too simple. 8MB limitation is for kernel on nor flash, only GL-B1300 and GL-S1300. AP1300’s kernel is on nand and it has volumn name of “kernel”, B2200’s kernel is
on eMMC partition that has limitation of 32MB.
Although S1300 and B2200 both has eMMC, S1300 support is upstream early when eMMC kernel patch is needed with older kernel.

Yes.

1 Like

Thank you for clarifying!