What magic is in OpenWrt?

Hi

Never in my life have I seen such powerful software that is less than 5MB in size.

Practically everything that comes from GitHub and others is much bigger, and usually can also do less.

Why is OpenWRT under 5MB? What's the magic behind it?

Multiple things, but the main ones:

  • Experienced developers
  • OpenWRT is a distribution made for networking
  • Each device image includes a basic set of packages common to all devices (Luci, etc), and specific packages for things like firmware. So by default each device image includes the necessities, and little beyond that.
  • You have a package system, and a build system that allows you to install new packages and extend your devices functionality, or build your own customized images.
  • Use of software packages, which are modified/stripped to reduce executable and library sizes. A good example of this is busybox, which provides the basic init, terminal and utilities (https://en.wikipedia.org/wiki/BusyBox#Features)
  • Certain packages (like wpad) have multiple versions, which offer different feature sets at different package sizes. Again, up to the user to determinate what he needs and what we can afford in terms of space.
  • Compression of the filesystem images with SquashFS, which includes a form of file-level deduplication (https://en.wikipedia.org/wiki/SquashFS)
6 Likes

Every device has its particulars as well, the Linksys EA8300 sysupgrade is 5.4MB, however you are also showing a susupgrade of 4.5MB for your C7v5.

As such, you must remember that a sysupgrade is exactly that... an upgrade. This file is incomplete and does not contain the entire OpenWRT system, but the files and settings that nee be upgraded.

As a reference, the factory for the EA8300 is 7.6MB, a 50% increase over the sysupgrade. Also this router has more features, like quad-core, triband, dual boot partitions, way more RAM and Flash, etc.... It's also likely, that more modules are pre-compiled into the image to support the additional features and to add more "out of the box" functionality than the C7 and its limited resources.

As an example, I also have an MR8300 (even more RAM) and cybernook was nice to precompile a package with additional features "out of the box" and the image is 18.6MB in size as shown here Flashing OpenWrt on Linksys MR8300 - partially bricked and here Flashing OpenWrt on Linksys MR8300 - partially bricked. Hopefully cybernook will manage to get MR8300 officially supported.

And let's not forget the kernel itself, which is also xz-compressed. :slightly_smiling_face:

1 Like

Don't think that statement is correct.

Factory is for when installing on a device currently with OEM.

Upgrade is for when installing on a device currently with Openwrt.

The image is complete.

6 Likes

Then why huge difference in size ?

Factory generally has additional items such as headers and padding to make it compatible with the OEM flashing process. That's not necessary when using sysupgrade as OpenWRT is already installed.

4 Likes

This means it's possible to skip one release?

It's always been possible sysupgrade (e.g. flash the sysupgrade image from v17 to v19) if that's what you mean.

2 Likes

Yes definitely.

You can also flash the same release again or even flash a previous release

4 Likes