Site Overlay

Adding custom packages to an OpenWRT image

As I use the stable Barrier Braker 14.07 release of OpenWRT, I sometimes run into the problem that the packages included in these releases are either outdated versions or that a package was not yet available in the 14.07 release but is now included in the trunk of github package repository. In both cases, we either need to replace the outdated version of the package sources with a newer one or add a completely new package to the respective feed of our Barrier Breaker sources.

The following tutorial shows how this can be accomplished. We will take ddns-scripts as an example of an outdated package to be replaced by a newer version in our image and davfs2 as an example of a package which has to be added as a completely new package to our image sources (davfs2 was not available in the 14.07 feed of OpenWRT but it can be retrieved from the github master trunk).

Updating the sources

When retrieving or refreshing the local source code from which the router image is built, a regular step is to issue a ./scripts/feeds/update -a followed by a ./scripts/feeds/install -a command in order to update the package sources. The install command basically puts a couple of symlinks from the package directory into the feeds subdirectories.

So after issuing ./scripts/feeds/update -a we are first going to modify the package sources before creating the symlinks by issuing the install -a command:

Download the whole github package repo and extract it to your harddisk.

  • Delete the outdated packages in the sources from the openwrt/feeds/ subdirectories (e.g. in your oWRT sources delete the folder openwrt/feeds/packages/net/ddns-scripts and replace it by the ddns-scripts folder from from the unzipped trunk snapshot)
  • Copy any new packages to your local oWRT package sources (e.g. copy the folder davfs2 from the zip you downloaded from github at the matching subdirectory of openwrt/feeds local package sources).

Update package index

Before installing the sources, it is advisable to update the package index – otherwise menuconfig may not show those packages which have been added completely new. The index can be (re-) generated by issuing ./scripts/feeds update -i

Installing the modified sources

Only now are you ready to install the modified sources by issuing the ./scripts/feeds/install -a command. After that, you can launch make menuconfig to check if the newly added or modified versions are selected in your menuconfig.

In order to check if the version was updated correctly, you invoke the help function and see whether the explanatory text matches the one in the Makefile of the updated sources. For ddns-scripts the hepl text of the old version 2.1.0-3 reads as follows:

ddns-scripts menuconfig before update
ddns-scripts menuconfig before update

After replacing the whole openwrt/feeds/packages/net/ddns-scripts folder by the latest 2.4.1 version, the help text for ddns-scripts in menuconfig looks as follows:

ddns-scripts help text in menuconfig after installing latest version
ddns-scripts help text in menuconfig after installing latest version

Unfortunately, menuconfig will no longer show the original descriptions taken from the Makefile. I have so far been unable to find a way to get the package information from the updated Makefile into the menuconfig help text. This won’t be a problem however, as the oWRT image will compile with the updated version.

In case somthing does not work

Sometimes, the updated package sources are not 100% compliant with your build environment and the image build will fail. Afaik, there is no general recipe to debug such fails. A good idea is to rerun the make with maximum verbosity and redirect the output to a logfile which can later be analyzed for clues what went wrong.

As an example. the oWRT image will not compile with the davfs2 sources from github. After poking around in the buildlog file, I found out that the line PKG_FIXUP:=gettext-version autoreconf in the Makefile has to be commented out by just inserting a # at the beginning of the line.