Downloading Sources for Building OpenWRT

OpenWRT is a complex system with many components that depend on one another.  To successfully build a working system, a good starting point is to to download a set of files tested by the OpenWRT development team.

Core and Feeds

I divide OpenWRT files into four categories.  In the first category are OpenWRT core files.  These files are for building essential components, such as the Linux kernel or BusyBox.

The other three categories are all OpenWRT “feeds”.  A feed provides additional packages that expand OpenWRT’s features.

In the second category are LuCI files, and in the third are xWrt files.  The development teams of LuCI and xWrt work closely with the OpenWRT team.

In the last category are files for building all other packages.  For example, software RAID and multimedia packages are in this category.

Downloading Source Files

It takes five steps to download a set of tested source files:

  1. Find revision numbers
  2. Find core repository path
  3. Download core files
  4. Update feed configuration file
  5. Update feed files
Finding Revision Numbers

With each release the OpenWRT team marks this milestone on the project’s roadmap (https://dev.openwrt.org/roadmap?show=all).  Starting from 10.03-rc1, revision numbers of files tested in a release are included as well.  For example, at the end of Backfire 10.03 announcement, one will find

image

Each revision number is actually a hyperlink to a project tree in a repository. This is convenient because we need know the core’s location in OpenWRT repository.

Finding Core Repository Path

To find this information, follow the link embedded in core’s revision number (20728 in this example). This opens up a source browser, displaying OpenWRT core project.  Near the top of the browser, under OpenWRT logo, is the repository path to the core project tree.  For Backfire 10.03, this path is “branches/backfire” (circled in red):

image

Downloading Core Files

To download a project from a repository, use Subversion “checkout” command:

svn co URL@REV WORK_DIR

where “URL” is a project’s URL, “REV” is the revision to check out, and “WORK_DIR” is the directory for checked out files.

For OpenWRT core, the project URL is a combination of OpenWRT repository URL and core’s repo path:

  • Repo URL:  svn://svn.openwrt.org/openwrt
  • Core repo path:  branches/backfire

Putting them together and adding the revision number, the command to check out Backfire 10.03 is:

svn co svn://svn.openwrt.org/openwrt/branches/backfire@20728 my_openwrt
Updating Feed Config

In the checked-out core project tree, there is a default configuration file for feeds.  For Backfire 10.03, this file correctly specifies repo URLs of packages, LuCI, and xWrt feeds, but not revision numbers:

src-svn packages svn://svn.openwrt.org/openwrt/packages
src-svn xwrt http://x-wrt.googlecode.com/svn/branches/backfire_10.03/package
src-svn luci http://svn.luci.subsignal.org/luci/tags/0.9.0/contrib/package
#src-svn phone svn://svn.openwrt.org/openwrt/feeds/phone
#src-svn efl svn://svn.openwrt.org/openwrt/feeds/efl
#src-svn desktop svn://svn.openwrt.org/openwrt/feeds/desktop
#src-svn xfce svn://svn.openwrt.org/openwrt/feeds/xfce
#src-link custom /usr/src/openwrt/custom-feed

This omission is easily fixed:

$ cd my_openwrt
$ cp feeds.conf.default feeds.conf
$ vi feeds.conf

Now append the feeds’ revision numbers of a milestone (Backfire 10.03 in this example) to their URLs and save these changes:

src-svn packages svn://svn.openwrt.org/openwrt/packages@20732
src-svn xwrt http://x-wrt.googlecode.com/svn/branches/backfire_10.03/package@4893
src-svn luci http://svn.luci.subsignal.org/luci/tags/0.9.0/contrib/package@6030
#src-svn phone svn://svn.openwrt.org/openwrt/feeds/phone
#src-svn efl svn://svn.openwrt.org/openwrt/feeds/efl
#src-svn desktop svn://svn.openwrt.org/openwrt/feeds/desktop
#src-svn xfce svn://svn.openwrt.org/openwrt/feeds/xfce
#src-link custom /usr/src/openwrt/custom-feed
Updating Feed Files

After adding feed revision numbers, an OpenWRT script is used to download or update feed files:

./scripts/feeds update

After the download or update is finished, the working directory holds a set of tested core and feed files.  To build OpenWRT, just install packages, select the correct configuration, and run “make”.

Symptoms of Incompatible Feeds

Occasionally downloaded feed files are incompatible with the core files.  A symptom is that errors are reported while feeds are updated or downloaded:

ERROR: please fix feeds/packages/sound/mpdas/Makefile
ERROR: please fix feeds/packages/sound/mpd/Makefile
ERROR: please fix feeds/packages/sound/pulseaudio/Makefile
ERROR: please fix feeds/packages/admin/syslog-ng3/Makefile
ERROR: please fix feeds/packages/Xorg/wm/matchbox-window-manager/Makefile

Ensuring the correct revisions are specified in the feed configuration file often fixes this problem.

Leave a comment