Bringing Routers and Modems together in style

Adding Packages

Package problems

The Facts about Adding Packages to ROOter

The more advanced user of ROOter firmware may, at times, want to add a different feature to their router using the OpenWrt or Lede repository. This doucument will outline some facts about this process.

Memory Space

This mostly a problem for routers that are using a 4meg image but can also happen to some routers using the 8meg image as well. See the supported routers list to see which image type you are using. A brief explanation of how router memory works will make this clearer.

The Flash memory of the router is similar to a hard drive since it holds the firmware and data used by the router. The firmware is compressed very much like a Zip file when it is in Flash memory so that more data can be packed into a smaller space. When the router boots up, it unpacks the firmware from Flash memory into RAM and then runs the program from there. It does not run from Flash memory but from RAM. A part of Flash memory is used to hold data that must survive a router power down, like the configuration information when you set up the router. In ROOter, this is about 90Kb so that much Flash memory must be free at all times. You can check how much free Flash memory space your router has by going to the System menu and then to the Software submenu.

Subtract 90KB from what is shown and that is how much space you have left to hold new packages. In GoldenOrb 2017-10-10 routers with 4meg of Flash memory have about 70Kb left to hold new packages. A router with 8 meg of Flash memory using the 8meg image will have about 250Kb left to hold new packages.

You can get an idea of how much memory space a new feature requires by looking at the package sizes in the OpenWrt repository or the Lede repository. Remember that a package may also install other packages that it depends on so the memory requirements will almost always be much larger than just the base package size. Plus, these packages are stored in Flash memory uncompressed so they take up the full amount of space, unlike those inside the firmware image.

The first thought in this situation is to remove any unneeded packages from the firmware to free up more memory to add the new feature. It appears that you can uninstall packages from the Software submenu and, in theory, get more memory.

This does not work, however.

Removing a package from the firmware does not actually delete it but just marks it as removed. It still exists inside the firmware image taking up space. In fact, it requires more space since it requies space to tell that is marked as removed. You can not free up any memory by doing this. The only way to free up memory by removing unwanted packages is to build a new image without those packages. If you have a router with only 4 meg of Flash memory there is very little room for any extra features and there is no way short of making a new image of ever getting any extra memory.

There is also the problem with routers that have 8meg of Flash memory but only 32meg of RAM. While routers like this have a large amount of free Flash memory, about 3meg in fact, they too have limitations on how many extra packages that they can hold.

This time it is RAM that limits them. When the firmware image is uncompressed into RAM it takes up a lot more space that what it did in Flash memory. A 4meg image requires about 25meg of RAM to hold it after decompressing. An 8meg image requires about 40meg. You can see the status of the router RAM by going to the Status menu and the Overview submenu.

From this you can see that even though the router has 32meg of RAM only 28meg is available for use. And about 2meg is used for buffers to hold the data packets that thr router is sending throughout the network. When you add in the extra RAM that a modem requires the amount of free RAM can drop to 600Kb. This doesn't leave a lot left for adding those extra packages. Any extra packages will take away memory from the buffers and that will affect router performance in a big way. LAN speed and modem speed will suffer and you will find the web GUI very slow to respond. In fact, the router turns into a dog.

Kerrnel Mismatch

Even if you have enough flash memory to hold the new feature you wish to add there can be a problem with the Linux kernel used by the firmware.

The kernel is the basic part of Linux that is used by OpenWrt/Lede with all the features being added on top of this. Kernels are numbered such as 3.18 or 4.1 to tell how new they are. As the kernel number increases this indicates that changes have been made to the code and these changes may not be backward compatible with older kernel versions.

Certain programs made to work with kernel 3.18 may not work correctly with kernel 4.1 unless they are recompiled or modified. This is usually restricted to those packages whose name start with kmod-. As mentioned above, when you install a new package into ROOter it may also install other packages that it requires. If one of these other packages is a kernel package (whose name starts with kmod-) then the kernel used in the ROOter firmware must match the kernel used when the package was compiled.

If the kernel numbers do not match between the firmware and the package being installed then ROOter will give a kernel mismatch error and not allow it to be installed. This is to prevent software problems from occurring due to incompatible kernels.

The problem that arises here is that ROOter does not use the exact same kernel as that used when the OpenWrt/Lede repository was compiled. Even though ROOter uses the OpenWrt Chaos Calmer and Lede 17.01 revisions for its images, the kernel is given a new number every time you build with it. Only those images that were compiled at the same time as the repository was created will have a matching kernel number. ROOter will always have a different kernel number than the OpenWrt or Lede repository expects and would require its own repository to get around this problem

The bottom line here is, you can't install a new feature if it requires the installation of any kernel packages from the OpenWrt or Lede repository.