Just moozing

Before you can check your notes, you must make them…

Building OpenWrt

with 2 comments

I though it would be easy to compile and build OpenWrt from source. This resembles compiling your own Linux kernel, so I thought that it would be simple for me.

It is well described on the OpenWrt homepage, I was just unable to find it until I got a hint. Start here, and scroll down to the table with the links related to building. If you end up in the kamikaze part of the documentation, you are in the wrong place.

Disclaimer (sort-of): I spend a lot of time compiling and building from source. A lot of the feeds didn’t compile out-of-the-box, and the compilation process stops every time a package fails to build. This means that I couldn’t just start it, and return the next day and fix the errors. It had to be restarted every 5-45 minutes. Maybe it relates to my configuration, maybe it us just a bad month for feeds, or something third, but it took very long to get the feeds build and the get the .trx file. In conclusion, either you should find an easier way than mine, or find a book to read while it compiles.

Building from source

1. Get the source.

I use subversion

svn co svn://svn.openwrt.org/openwrt/branches/backfire

The exact URL to retrieve from may be found on the developer site here.

2. Get the feeds.

This is all the extra packages available for OpenWrt (which is one of the good reasons for liking OpenWrt)

cd backfire
./scripts/feeds update -a
./scripts/feeds install -a

This will download all the source code for the packages and “install” it into the build system. After this step the packages are available when doing “make menuconfig” later.

3. Check if the system works.

make defconfig

On my test system, it reported a lot of missing dependencies. I had to install the following programs.

apt-get install gawk flex
apt-get install zlib1g-dev
apt-get install libncurses-dev
apt-get install g++
apt-get install rsync

To make matters worse, the “jikes” program is unavailable in Debian/testing, but is available in both experimental and stable. So I downloaded the .deb package from stable and installed it.

wget http://ftp.fi.debian.org/debian/pool/main/j/jikes/jikes_1.22-7_i386.deb
dpkg install jikes_1.22-7_i386.deb

4..config file

The configuration file for this build has to be decided. Just like with the Linux kernel, start with the standard configuration, and go from there – don’t start from scratch.
This will download the .config file used to build backfire 10.03 binaries as they are found in the download section of OpenWrt. Apparently, the .config file is unavailable for the release candidates.

wget http://downloads.openwrt.org/backfire/10.03/brcm-2.4/OpenWrt.config
cp OpenWrt.config .config

The .config file is the one that is used to decide which modules and packages to build.

5. Changing .config

After using the standard .config, it may be customized. I use

make menuconfig

Change relevant entries, and save the file when exiting. I had to disable entries related to hostapd-supplicant-mini.

network -> hostapd, hostapd-mini and hostapd-utils
kernel modules -> wireless drivers -> kmod-hostap-plx,  kmod-hostap-pci, kmod-hostap-cs and kmod-hostap
network -> wpa-supplicant-mini, wpad-mini

Note that they are interdependant, so some cannot be disabled without the others being disabled beforehand.

6. Build the packages and the image.

make -j 3 V=99

The switches

  • “-j 3” takes advantages of my dual core system.
  • “V=99” is about being verbose.

I had a lot of compilation issues.See Problem feeds below.

7. Installing the new firmware and packages

The firmware binaries are located in ./bin and the packages in ./bin/packages. Copy this to somewhere that the router will have access to. I copy it to my server, so that the router may access it at http://server/openwrt. This is important, at least for the kmod* packages that are kernel dependant. Flash the device using the web interface or use tftp.

In the file /etc/opkg.conf, change the line

src/gz packages http://downloads.openwrt.org/backfire/10.03.1-rc4/brcm-2.4/packages

to

src/gz packages http://server/openwrt/packages

I use nano as my preferred editor. The nano package (and the new opkg.conf file) could be included in the firmware image, but I have not into that part.It ought to work to use the default nano package from OpenWrt.


opkg update

opkg install nano

and when opkg.conf has been edited, opkg needs another update.

8. And doing it again…

The system running on the router is now the custom build OpenWrt. To update the source code and recompile firmware and feeds, do the following


svn update

./scripts/feeds update -a

This will download updates for OpenWrt itself, and all feeds.

After doing this, a couple of more feeds failed to built. I get the impression that we are doing bleeding edge here. I even had to do a ‘make distclean’ in order for it to build.

Problem feeds

In order for me to succeed with the compilation, I had to uninstall some feeds. Most of them are obviously something I will not need on my router (e.g. GnuPlot), but other might be needed at some point.

The list (mostly alphabetically and in a copy’n’paste friendly format):

./scripts/feeds uninstall appweb amule asterisk14 asterisk14-app-meetme asterisk14-chan-alsa asterisk14-chan-gtalk asterisk14-chan-h323 asterisk14-chan-mgcp asterisk14-chan-mobile asterisk14-chan-ooh323 asterisk14-chan-oss asterisk14-chan-skinny asterisk14-codec-lpc10 asterisk14-codec-speex asterisk14-format-mp3 asterisk14-mini asterisk14-mysql asterisk14-pbx-dundi asterisk14-pgsql asterisk14-rawplayer asterisk14-res-agi asterisk14-res-crypto asterisk14-sounds asterisk14-sqlite asterisk14-voicemail avahi-autoipd avahi-daemon avahi-dnsconfd libavahi
./scripts/feeds uninstall baresip btpd
./scripts/feeds uninstall cairo cairomm pycairo libcwiid python-cwiid
./scripts/feeds uninstall deluge dmapd
./scripts/feeds uninstall elfutils ethtool ettercap
./scripts/feeds uninstall gnuplot
./scripts/feeds uninstall gst-plugins-base gst-plugins-good gst-plugins-ugly gst-python gstreamer gstreamer-utils libgstreamer gtk2 gtk2-cups gtkmm gtkperf
./scripts/feeds uninstall hippo-canvas python-hippo-canvas
./scripts/feeds uninstall imspector iputils-arping iputils-clockdiff iputils-ping iputils-tftpd iputils-tracepath
./scripts/feeds uninstall intltool
./scripts/feeds uninstall karma
./scripts/feeds uninstall libre
./scripts/feeds uninstall librsvg
./scripts/feeds uninstall libxcb
./scripts/feeds uninstall linuxigd
./scripts/feeds uninstall matchbox-window-manager
./scripts/feeds uninstall minidlna
./scripts/feeds uninstall n2n
./scripts/feeds uninstall ndisc6 nprobe nzbgetweb
./scripts/feeds uninstall openconnect
./scripts/feeds uninstall pango pangomm
./scripts/feeds uninstall php5
./scripts/feeds uninstall procps
./scripts/feeds uninstall pwrtray pwrtray-backend
./scripts/feeds uninstall radlib
./scripts/feeds uninstall restund
./scripts/feeds uninstall scmpc
./scripts/feeds uninstall snort snort-mysql snort-pgsql snort-wireless snort-wireless-mysql snort-wireless-pgsql
./scripts/feeds uninstall subversion-client subversion-libs subversion-server
./scripts/feeds uninstall tmux
./scripts/feeds uninstall triggerhappy
./scripts/feeds uninstall tslib xf86-input-tslib qt4-drivers-mouse-tslibmousedriver
./scripts/feeds uninstall vips
./scripts/feeds uninstall vpzone
./scripts/feeds uninstall wavemon
./scripts/feeds uninstall wget
./scripts/feeds uninstall xf86-input-evdev xf86-input-keyboard xf86-input-mouse xf86-input-tslib
./scripts/feeds uninstall xf86-video-ati xf86-video-fbdev xf86-video-geode xf86-video-glamo xf86-video-intel xf86-video-nv xf86-video-omapfb xf86-video-vesa
./scripts/feeds uninstall xserver-xorg
./scripts/feeds uninstall kmod-zaptel14 kmod-zaptel14-wcusb kmod-zaptel14-wctdm zaptel-libtonezone zaptel14-libtonezone zaptel14-util
Advertisements

Written by moozing

December 27, 2010 at 09:00

Posted in Tech

Tagged with , ,

2 Responses

Subscribe to comments with RSS.

  1. Hi!

    How can I compile with this tool only some of the package, and not the whole image?

    Regards, János

    János

    March 28, 2011 at 09:18

    • If you don’t do the
      $ ./scripts/feeds install -a
      you will only be compiling the base image without utilities.

      The feeds you want can be added individually using
      $ ./scripts/feeds install packagename

      moozing

      March 30, 2011 at 10:48


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: