TL-WR942N too small kernel space

Cannot build image with modified kernel options (preemption, dynamic printk, profiling).
Kernel grows in size and partition is only 1344k. Kernel image is 1.41Mb
What can be done with that ?
I guess its all to preserve original parition scheme used by stock firmware ?
For Dlink DIR-825B2 also such problem existed but if normal build fails at least we have -fat image which can be flashed after normal.

Image Name:   MIPS LEDE Linux-4.4.91
Created:      Thu Oct 12 21:40:27 2017
Image Type:   MIPS Linux Kernel Image (lzma compressed)
Data Size:    1465129 Bytes = 1430.79 kB = 1.40 MB
Load Address: 80060000
Entry Point:  80060000

......

os-image partition too big (more than 1376256 bytes): Success

Pls correct me if i'm wrong. stock U-boot has hardcoded values for kernel partition location and size. Reads kernel from there. If we increase kernel partition size u-boot will not read full image and kernel will crash

Have a look here: https://github.com/lede-project/source/blob/master/tools/firmware-utils/src/tplink-safeloader.c#L723

Yes, its layout of special tplink image format used by their proprietary firmware upgrader.
Initial firmware uploaded via web interface must be in tplink factory format.
But afterwards, when we already have openwrt there.
Is it possible to change layout ?
In this device flash must be memory mapped. U-boot does not load anything, it just passes control to preconfigured address (may be some additional logic apply, I dont know).
Why not abandon tplink layout if stock firmware is not going to be ever used ?
Partitions do not exist on hardware level. Its abstraction used by linux kernel. Kernel takes partition locations and sizes are from hardcoded cmdline.
What stops us from changing parts as we want ?
The only 2 things that should be kept are u-boot+possibly its config fata and ART.
Believe me, this image is going to stop compile when 4.9 kernel is adopted for ar71xx. It always grows in size and will be moment when even with default options it won't fit
It would be reasonable to always build -fat image with our layout even regular fails. Then we first flash small temporary -factory and sysupgrade to -fat

For now I had to compile without symbols and its ugly :frowning: When shit happens crashlog will contain nothing but bare hex addresses

Looking backward to what is done for another router :

 /** Firmware layout for the TL-WR902AC v1 */
 	/**
 		   384KB were moved from file-system to os-image
 		   in comparison to the stock image
 	*/

Is it safe to change

{"os-image", 0x20000, 0x150000},
{"file-system", 0x170000, 0xcd0000},

to

{"os-image", 0x20000, 0x170000},
{"file-system", 0x190000, 0xcb0000},

?

Or additional changes required ?

Tested my idea. Changed tplink-safeloader to stop errors. Flashed sysupgrade image and it didnt work.
Got bootloop. Recovered by tftp

@bolvan
In theory, image build script can take kernel length at a build time and calculate partitions layot on the next step. Can try to implement such behaviour in a makefile. Will be in my TODO list :slight_smile:
@pepe2k Is there anybody working on moving ar71xx target to dts?

I don't think so.

can u have a plnas to fix it and back this model to development?

I came across the same, but with 16Mb flash devices! Bump!