OpenWrt Forum Archive

Topic: size limitation for firmware ?

The content of this topic has been archived on 19 Apr 2018. There are no obvious gaps in this topic, but there may still be some posts missing at the end.

Hi,

I am wondering if there is any size limitation on what can be put into the firmware image. In other words, can I contineously grow the rootfs size ?

I understand that the flash is sort of 'sliced' with one slice for the kernel + rootfs, one for the jffs2 and a fixed nvram area. Just don't know if the area for "kernel+rootfs" is fixed or can grow into jfffs2 area ?

After going through the setup.c code, I think this is a bad idea.

Since the jffs2 is dynamically calculated, there may be some slack which allows the kernel+rootfs to shrink and grow but once it goes over that slack, all things would go weird as the supposed jffs2 partition would point to a wrong location

So this bring me to another question :

once I have installed openwrt and created jffs2 partition, it is in general not a good idea to use any firmware that can be significantly different in size than what I have flashed into it.

A possible scenario :

I have built and flash with the stock openwrt configuration. Now a while later I find that I need to include more applet in busybox(say to support openswan) and this make the rootfs grows to a size larger than the unused slack(64k block +/- something), my old jffs2 partition would have been trashed on my next upload as the superblock is now written.

Do I make sense ? If yes, I believe this should be documented in the user guide.

If your root .bin file grows, probably you should reformat the jffs2 and it may be corrupted.

so

firstboot

This is , what keeps me not updating my OpenWRT on my WRT.

I have reread the init script, It seems that under this situation, the firstboot would be rerun automatically.

So overall, the process is still fine, just that for those upgrading this way may find it odd that their previous setup(packages etc.) that was there in jffs2 before the 'upgrade' would have mysteriously gone. The box becomes a brand new bare openwrt one. This does not limit to grow but shrink as well.

To avoid reinstalling all the packages and the setups after a firstboot I use a NFS-mounted directory for a tar backup of the jffs2-Files. After a firstboot I load via wget the backup and reinstall everything.

This even allows to swap among different setups, forcing a firstboot out of failsafe mode and after a reboot loading the propper backup.

Greetings,
Stefan

that is what I am planning to do too, thanks for the idea.

Though I am still thinking about cases like, what if my first firmware doesn't have say dropbear and install it to jffs2  but later add that to the firmware because I feel that it is stable enough. As putting it in squashfs has a size advantage over jffs2. If I just tarball the old one and back, I would have two copy of it which would net out my initial intention.

Though I am still thinking about cases like, what if my first firmware doesn't have say dropbear and install it to jffs2  but later add that to the firmware because I feel that it is stable enough. As putting it in squashfs has a size advantage over jffs2. If I just tarball the old one and back, I would have two copy of it which would net out my initial intention.

Uninstall the package, create a backup, flash new firmware, reload backup. It needs some manual work, but as long as the changes are not to big...

BTW: As far as I know - maybe I am wrong - jffs2 is a compressed file system. There will be little if any size advantage of the rom filesystem.

Greetings,
Stefan

The discussion might have continued from here.