Image Size: How to know it will fit a small flash e.g. 8MB?

Is there a way to limit the firmware size when I compile my image?

What I normally do before compiling my image, is to install a standard image, install packages, write down packages, and try to use image generator to integrate the image, i.e. by try and error

I told myself if flash is 8MB, the image size with 6MB is safe.

Is there any switches in build system for this?


I was told that if the image becomes bigger then the flash size the image itself won't be build at all.

Yes. Each router's "image recipe" defines the maximum size for that router. If you add too many packages, the sysupgrade and factory images are not produced. But there is no clear error message for the user, except in the verbose build log (if you have enabled that) where it says:
Warning: /.../bin/ar71xx/openwrt-ar71xx-generic-dir-825-b1-squashfs-sysupgrade.bin is too big

1 Like

You also need to keep in mind that the hard reserve is 3 erase blocks (== typically 3*64 KB), that isn't a whole lot and -while safe to flash- not really recommended for normal operations (so try to keep a little more free space).

Thanks everyone for the input :slight_smile: