So, you've got OpenWRT on your router. Now
you'll probably want to compile some program to run on it. Well, the router
isn't the best platform to build software on natively. Lack of space, limited
RAM and processsor speed are few downsides. But never fear you can build
applications on your linux PC using toolchains and buildroots.
There's a few different ways to do this,
I'm going to use Kismet as an example
1. Use the Openwrt SDK
"When using the SDK you don't require
a full buildroot. The SDK is a stripped down version of it,
which includes the toolchain and all the
required library and header files to cross-compile applications for
I havenít gotten this method to work yet
2. Install and configure a Buildroot
buildroot documentation Read it through once then read it again,
and again and then you can start
3. Install and use a toolchain
library kinda like 1 and 2 but in a weird sorta going to visiting your aunt who
chain smokes through her stoma way.
Once you successfully created your
buildroot using the documentation on the OpenWRT site
Setting up your environment
You can put the following into a nifty
script and use sh to run it but Iím lazy and I just open up a terminal window
with the location of your buildroot and watch for line wraps!
export CFLAGS="-Os -s"
The most important one is the last one.
This tells the mipsel compiler to strip the binary. This removes all the
information that is bloating the
executable. This will take a 5Mb binary down to a managable 200k. In a non
this would be taken care of when you
performed a 'make install' but we can't do that.
Now itís time to Build Kismet
--host=mipsel-linux --disable-curses --disable-panel --disable-viha
--without-ethereal --prefix=/tmp --disable-setuid --disable-pcre
make CFLAGS='-Os -s' if you forgot it the
Once the process is finished you'll have a
nice compact binary
Now we need to transfer this to our router
using scp (secure copy)
Just in case let's make sure it's
executable on the router by issuing
#chmod 777 <filename>