Page 369 - Hacking Roomba
P. 369
350 Part III — More Complex Interfacing
bit more complex than compiling AVR programs. OpenWrt does make it quite easy with the
company’s SDK. The abbreviated steps are:
1. Get the OpenWrt SDK.
2. Create a directory with your source code and package control commands for ipkg.
3. Within that directory, compile using the OpenWrt makefiles.
4. Copy the resulting ipkg package to the router and install.
To save you some time, the roomcmd C code has been placed in such a directory set up to work
with the OpenWrt SDK. Using it you can get started making modifications and improvements
to suite your needs. To get the SDK and the bundled roombacmd source and to start cross-
compiling, run these commands:
demo% wget http://downloads.openwrt.org/whiterussian/newest/ i
OpenWrt-SDK-Linux-i686-1.tar.bz2
demo% bzcat OpenWrt-SDK-Linux-i686-1.tar.bz2 | tar -xvf -
demo% wget http://roombahacking.com/software/roombacmd/roombacmd-
ipkg.tar.gz
demo% tar xvf roombacmd-ipkg.tar.gz
demo% mv roombacmd-ipkg OpenWrt-SDK-Linux-i686-1/package
demo% cd OpenWrt-SDK-Linux-i686-1
demo% make clean && make
The last line will spew a lot of text as it builds, and then when it’s done you’ll have the
roombacmd ipkg file in bin/packages. Copy that file to your OpenWrt box and install
it using ipkg.
The roombacmd-ipkg directory contains an ipkg package description and a Makefile that
abides by the OpenWrt SDK’s standards. It’s like a meta-Makefile in that it contains descrip-
tions on how an existing Makefile (the one for the regular Linux version of roombacmd)
should be modified to compile for OpenWrt. OpenWrt has several recipes for how to do this,
and roombacmd-ipkg uses one of them almost verbatim. If you’re familiar with Makefiles, it’s
a little hairy but not too complex. If you have other C code you’d like to run on your OpenWrt
system, you can use the preceding techniques to cross-compile them as well.
Currently, you need a Linux system (Debian-based, like Ubuntu) to run the OpenWrt SDK. If you
have VMware or VirtualPC, you can run virtual Linux.
OpenWrt has a great how-to document on compiling for OpenWrt and building packages at
http://wiki.openwrt.org/BuildingPackagesHowTo.