Kernel only image

Using mtd write directly is really not recommended, especially on NAND flash.

The size of the kernel and the squashfs root depends on what options are included. It is a good bet that they will be larger with each new version. The jffs2 partition begins at a variable place depending on where kernel + root ends. Thus you cannot depend on the jffs not being corrupted after writing a new kernel+root, if it is larger than the old one. Thus the process is to rebuild the jffs every time, first by writing in the files that are to be kept, then upon the first boot, the rest out to the end of usable flash is formatted as empty space.

This is all automatic if you build a tar file of the files you would like to have in the new overlay filesystem, like sysupgrade does, and submit it to sysupgrade with the -f option.

It seems you're looking to re-invent the wheel, without even getting out of the car to see that it already has four good wheels on it.

2 Likes