Cross Compiling
It's sometimes useful to compile the router for a different architecture. Once the cross-compile toolchain is setup, the actual compile is easy.
Getting a cross-compilation toolchain going is beyond this tutorial, but I'd point you to http://downloads.openwrt.org/kamikaze/7.09/atheros-2.6/. For instance, I use the x86_64 one on my machine, so
$ cd /opt $ http://downloads.openwrt.org/kamikaze/7.09/atheros-2.6/OpenWrt-SDK-atheros-2.6-for-Linux-i686.tar.bz2 $ tar zxvf OpenWrt-SDK-atheros-2.6-for-Linux-i686.tar.bz2 $ export PATH=/opt/OpenWrt-SDK-atheros-2.6-for-Linux-x86_64/staging_dir_mips/bin/:$PATH
You might want to put that last one in your startup scripts.
Next, cross compile the serial library that comes with tinyos.
$ cd $TOSROOT/support/sdk/c/sf $ make distclean $ ./configure --host=mips-linux $ make
You'll need to change the host argument to be your flavor of target platform. You can tell this by the prefix on the toolchain binaries; for instance, in this example the target is 'mips-linux' and so the cross-compiling version of gcc is 'mips-linux-gcc'.
Then, go build the driver; pretty much the same deal.
$ cd $LOWPAN_ROOT/support/sdk/c/blip $ make distclean $ ./configure --host=mips-linux $ make
If this all works, you can grab the cross-compiled version of the driver:
$ uname -a Linux rabbit 2.6.28-15-generic #49-Ubuntu SMP Tue Aug 18 19:25:34 UTC 2009 x86_64 GNU/Linux $ file driver/ip-driver driver/ip-driver: ELF 32-bit MSB executable, MIPS, MIPS32 version 1 (SYSV), dynamically linked (uses shared libs), not stripped
See! All cross-compiled.
