1. 下载arm-linux-gcc-4.4.3.tar.gz
2. 解压并配置到PATH
3. 下载libpcap-1.3.0.tar.gz和tcpdump-4.3.0.tar.gz
Compile libpcap
$ tar zxvf libpcap.tar.gz
$ cd libpcap/
$ CC=arm-linux-gcc ./configure --host=arm-linux --prefix=/home/wv/source/tcpdump --with-pcap=linux
$ make
Compile tcpdump
$ tar zxvf tcpdump-xx.tar.gz
$ cd tcpdump-xx/
$ CC=arm-linux-gcc ac_cv_linux_vers=2 ./configure --host=arm-linux --with-pcap=linux
注意修改Makefile文件
Edit the makefile, remove the -O2 flag and add the -static flag to the linker (LD_FLAGS += -static)
$ make
4. 上传到手机测试
./tcpdump -en -i wlan0
我编译好的tcpdump.tar.gz
Tizen SDK 2.1:
sdb root on开启root权限
只要你有su权限,直接执行即可。如果你希望在android的app中获得tcpdump的结果,一行语句搞定
Runtime.getRuntime().exec(“tcpdump -p -vvv -w /sdcard/result”);
只要用户权限设置正确,应该就没有问题。
Ubuntu12.04可能遇到问题:
1. configure: error: Your operating system's lex is insufficient to compile
libpcap. flex is a lex replacement that has many advantages, including
being able to compile libpcap. For more information, see
http://www.gnu.org/software/flex/flex.html .
需要更新lex ,执行命令:sudo apt-get install flex
2. ./runlex.sh lex -oscanner.c scanner.l
yacc -d grammar.y
make: yacc:命令未找到
make: *** [grammar.c] 错误 127
需要安装yacc
inux下是用flex和bison来分别代替lex和yacc的,安装直接使用命令:
sudo apt-get install bison