I've compiled my own router firmware several times using the image builder on a Linux OS installing only the packages I need. However, there are some more packages I would like to add from the repository through OPKG and unfortunately I have run out of room.
The specifications to my router are 128MB NAND memory and 256MB RAM, but I can't see how my own compiled firmware and the respective packages cam equal 100MB or so, unless the partitons have been setup in some weird way.
To my knowledge reading somewhere my router does use RAM for one of the partitions. However, looking at the table below doesn't make perfect sense to me as I'm still quite new to Linux and it's file systems.
Can someone briefly explain the partitions from fstab above and suggest any ideas of how I can allocate more storage capacity for packages. A temporary fix will do in the meantime but mid-term I would like to be able fix this in my next compile.
This is from a mamba:
root@bsaedgy:/proc# cat 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 "rootfs1"
mtd6: 02800000 00020000 "kernel2"
mtd7: 02500000 00020000 "ubi"
mtd8: 02600000 00020000 "syscfg"
mtd9: 00780000 00020000 "unused_area"
mtd10: 00008000 00008000 "spi0.0"
there are 2 partitions of about ~40MB each for your image contents. Best to bake everything into an image when creating the binary rather than installing bits later. But with there only being ~40MB per image, there should be plenty of room for everything needed in an image, with the fail-safe feature of being able to go back to the previous known good partition.
First of all, the Linksys WRT1900AC devices come with a dualboot setup, this halves your usable flash space - this is then further reduced by additional vendor partitions (38 MB for syscfg in particular), leaving you with 2*40 MB for kernel+rootfs (of which 6 MB are reserved for the kernel). You'll find the details in the DTS files.
/rom is all the packages etc that you "squashed" into the image at build time. It will always report 100% full at runtime because it is read only.
/overlay is the run-time writeable area of flash. Packages and files you add after flashing will be stored here. This is stored in what is left of the 40 MB space after the kernel and /rom. It is not compressed as efficiently as /rom. Thus all the files you know you will need and will not be changing should be stored in /rom.
Note that if you change even one byte of a file stored in /rom, a complete new copy of the file is made in /overlay, which replaces (overlays) the original making it inaccessible. But the space occupied by the old copy in /rom cannot be freed up at runtime.
/tmp is in RAM. RAM is only allocated as needed for files as they are stored there, and freed up if the files are deleted. The maximum size is half of the usable (not occupied by the kernel code) RAM. Of course everything in tmp is lost on a power cut or reboot.
The flash layout is kept this way so there is an easy path to flash back to stock, and to have a complete backup OS (usually stock) in the flash for fail-safe purposes. In order to change this layout you would need to modify the source code and compile a new kernel from source code. Image Builder uses a pre-built kernel.
Ok thank you everyone for the replies. Sorry it has taken me a while to get back.
Sorry from the table above I basically have 14.78MB of capacity left on the overlay (the left over free space not taken up by the ROM partition)? Realistically I'm probably better off re-compiling the firmware with the additional packages I would like to add?