← Revision 8 as of 2009-06-27 14:02:05
Size: 7495
Comment: switch to a git feed of the nocatauth packaging
|
← Revision 9 as of 2009-06-28 14:37:46 →
Size: 7361
Comment: nocatauth packaging was merged into OpenWrt packages, drop outside feed.
|
Deletions are marked like this. | Additions are marked like this. |
Line 56: | Line 56: |
We aren't using anything from the xwrt or luci feeds currently, and we'll change the packages feed to use git instead of svn and also to add a local feed for NoCatAuth (at least until we merge it upstream). So, create a file feeds.conf containing this: | We aren't using anything from the xwrt or luci feeds currently, and we'll change the packages feed to use git instead of svn. So, create a file feeds.conf containing this: |
Line 60: | Line 60: |
src-git portals git://git.personaltelco.net/portals |
WORK-IN-PROGRESS! FOLLOW WITH CAUTION!
This page provides a description, suitable for following along at home, of how we have been creating the firmware image for the AlixCab and WgtCab devices that we've been working on.
Contents
Historical Context
The AlixCab and WgtCab are named after the CloneArmyBox and subsequent NewCloneArmyBox (or NuCab) they are meant to replace. These predecessors were based on recycled PCs that we obtained for free and, running Debian GNU/Linux, repurposed as routers/gateway devices for our network installations. The AlixCab and WgtCab are based on the Alix single-board computer (from PC Engines in Zurich Switzerland) and the Netgear WGT634U, respectively. PersonalTelco is (as of late June 2009) part way through a purchase of 30 Alix boards. We already own or have deployed a number of Netgear WGT634Us. PersonalTelco has some Soekris board (typically as MetrixKits) deployed about as well, running various firmware. It is notable that the same firmware (or slight permutations) as described here can also run on the Soekris devices.
Note that the Netgear WGT634U is a somewhat special device. The device has 8 megabytes of flash storage and has 32 megabytes of RAM, which is rare these days. The image produced with this HowTo will not fit on a 4 megabyte flash device.
OpenWrt
The respective firmware images for the AlixCab and WgtCab are both based on OpenWrt.
In order to take advantage of the newest and shiniest features and bugfixes, as well as to add our own packages to images, we build the firmware ourselves rather than relying on specific binary image releases of OpenWrt. If you have (or can get easily) a Linux box with a few development tools, you can do this yourself without much difficulty. You will also need an internet connection.
OpenWrt is built using a Makefile system called a buildroot. The Makefile infrastructure handles all the details of downloading source code, building the cross-compiling toolchain, compiling the packages and composing image files suitable for flashing (or otherwise writing) onto the device. The buildroot system you obtain from OpenWrt is itself not very large. Instead, it has pointers to the source packages for everything it is going to build, and construction implies retrieving them to a local archive if you haven't already.
We are typically building the most recent (or very nearly) version from OpenWrt's subversion (svn) tree. We are currently using a git version that synchronizes with the svn tree every 10 minutes.
Bleeding Edge
Building the current version of a developing code base can sometimes not work. Don't be afraid to report non-workingness, using the Trac ticket system or on the freenode Irc channel #openwrt-devel. Over time, bit by bit, you learn about how the buildroot works and can begin to repair problems yourself and submit patches. Don't be afraid. Try, learn, develop.
Checkout
There are often many ways of doing things and this is no exception. We'll show how we do it. If you like another way better, and it works for you, feel free to deviate. First thing to do is to check out OpenWrt's current "trunk" buildroot verion. In a directory where you ordinarily build software (we'll use /src in the examples here) and where you have at least several gigabytes of free disk space:
cd /src git clone git://nbd.name/openwrt.git
Then, change directories into your shiney new buildroot, what is known in OpenWrt as $(TOPDIR), or in our case, /src/openwrt:
cd openwrt
Configuration
- The first thing to do after checking out the buildroot is to set up any feeds you want to use. A feed is basically a URL to a tree of packages that can be built using the buildroot. The primary feed is one called "packages". You almost certainly want to enable that one. Feeds are configured in a file called $(TOPDIR)/feeds.conf. The newly checked out tree will contain a file called feeds.conf.default, which looks like this:
src-svn packages svn://svn.openwrt.org/openwrt/packages src-svn xwrt http://x-wrt.googlecode.com/svn/trunk/package src-svn luci http://svn.luci.subsignal.org/luci/branches/luci-0.8/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-git packages git://nbd.name/packages.git
scripts/feeds update -a scripts/feeds install -a
The OpenWrt buildroot uses a linux kconfig-style configuration interface and stores the package configuration in a file called .config. Here is a minimal example for the Netgear WGT634U.
wget http://www.personaltelco.net/~russell/wgtcab-2009-06-25.config mv wgtcab-2009-06-25.config .config make oldconfig
make menuconfig
Note that selectiong <M> for a package will build the package but not include the package in the image. Selecting <*> for a package builds the package and includes it in the image. Non-included packages can be added later using the opkg utility from the running image.
Lastly, custom files can be added to the image by placing them in $(TOPDIR)/files/. These files are copied in to the filesystem tree before the image is constructed, but after any package files are copied. This allows you to override package default configurations. There is not a mechanism at the present time for *removing* files, and there is a small bug (for which a patch exists) relating to symlinks. An experimental set of files can be found here. Unpack as follows:
wget http://www.personaltelco.net/~russell/wgtcab-files-2009-06-25.tar.gz tar xzvf wgtcab-files-2009-06-25.tar.gz mv files-experimental files
Building
- To build the cross-compiling toolchain, packages and image, execute the following command (adjust the -j value as appropriate, 17 works for me on a hyperthreaded quad-core):
make BUILD_LOG=1 IGNORE_ERRORS=m V=99 -j17
[...] Generating index for package ./wireless-tools_29-4_mipsel.ipk Generating index for package ./zlib_1.2.3-5_mipsel.ipk make[2]: Leaving directory `/src/openwrt' make[1]: Leaving directory `/src/openwrt'
On a quad-core Intel Core i7, the WgtCab build finishes in about 17 minutes, your mileage may vary. You can look in $(TOPDIR)/bin and find the images that were built, and in $(TOPDIR)/bin/packages/target-mipsel_uClibc-0.9.30.1/ you'll find the package files you just built.
Flashing
(MORE DETAIL TO FOLLOW SHORTLY)