The compilation process of psotnic for embedded systems is a little bit more difficult than the one for ordinary linux box.
In order to compile it you must have following prerequisites:
- psotnic source code with revison at least 64 (previous versions didn't have support of embedded systems)
- build environment for linux distribution installed on the router:
While the first one is obvious, the second is usually not. The reason for having build environment (sometimes called build root) is the fact that the linux distribution running on the router has different set of system libraries and that the router is not an x86 compatible machine, so code compiled on your linux box won't be understood by the router. Here comes the build environment with set of libraries and development tools (compilers, linkers, ...) that allow you to build software that will be working on your router.
Bellow I will present compilation process for my Linksys WRT54GL router. It has OpenWRT whiterussian 0.9 installed.
1. Unpack OpenWrt-SDK-Linux-i686-1.tar.bz2 to your home directory:
tar xzf OpenWrt-SDK-Linux-i686-1.tar.bz2
2. Unpack psotnic-current.tar.gz to your home directory:
tar xzf psotnic-current.tar.gz
3. Enter psotnic directory
cd psotnic-current
4. Run ./configure script
./configure --cc-prefix=~/OpenWrt-SDK-Linux-i686-1/staging_dir_mipsel/bin/mipsel-linux-uclibc- --little-endian \
--cc-options="-fno-builtin -nostdinc++ -nodefaultlibs -Os" --ld-options="-luClibc++ -lm" --disable-adns
If you are interested in explanation of this line,
read on this.
5. Compile
make dynamic
This should cause bot to compile. If you get problems with compilation, please form a
bug report. Make sure that you give us information about the router (linux distro and model should be enough) and linux box you are compiling on.
The output binary should be about 600KB.
As for now I do not recommend compiling in debug mode, because the binary will be around 3MB. If you are having problems, and you insist on using debug version, please make sure that you strip debug symbols out of it, to do use strip utility from your build environment:
~/OpenWrt-SDK-Linux-i686-1/staging_dir_mipsel/bin/mipsel-linux-uclibc-strip bin/psotnic
6. Copy bin/psotnic to your router. That's all!!!