Wednesday, November 10, 2010

Tcpdump for Android

So I have decided to crosscompile Tcpdump for Android 2.2.
This guy has done it, but I figured as well as I should try.

I also used the openmoko toolchain after failing miserably with the Android one.
So the summary of all the steps:
Get the latest source for libpcap and tcpdump from http://www.tcpdump.org

Compile libpcap
$ tar zxvf libpcap.tar.gz
$ cd libpcap/
$ CC=arm-angstrom-linux-gnueabi-gcc ac_cv_linux_vers=2 ./configure --host=arm-linux --with-pcap=linux
$ make

Compile tcpdump
$ tar zxvf tcpdump-xx.tar.gz
$ cd tcpdump-xx/

$ CC=arm-angstrom-linux-gnueabi-gcc ac_cv_linux_vers=2 ./configure --host=arm-linux --with-pcap=linux
Edit the makefile, remove the -O2 flag and add the -static flag to the linker (LD_FLAGS += -static)

$ make

If you get the following error: undefined reference to `__isoc99_sscanf'
add #define _GNU_SOURCE in the faulty .c files.

No comments:

Post a Comment