2011年11月3日 星期四

如何將tcpdump移植到arm嵌入式系統

Follow http://read-and-thinking.blogspot.com/2009/06/tcpdumparm.html

下載
libpcap-1.1.1
tcpdump-4.1.1

build licpcap-1.1.1

 1. 修改configure file
註解掉6901~6905
#if test -z "$with_pcap" && test "$cross_compiling" = yes; then
# { { echo "$as_me:$LINENO: error: pcap type not determined when cross-compiling; use --with-pcap=..." >&5
#echo "$as_me: error: pcap type not determined when cross-compiling; use --with-pcap=..." >&2;}
# { (exit 1); exit 1; }; }
#fi

註解掉7237~7241
# if test $ac_cv_linux_vers = unknown ; then
# { { echo "$as_me:$LINENO: error: cannot determine linux version when cross-compiling" >&5
#echo "$as_me: error: cannot determine linux version when cross-compiling" >&2;}
# { (exit 1); exit 1; }; }
# fi

./configure --host=arm-none-linux


確認Makefile的CC不是gcc而是你的cross compile的名字
就代表ok嚕
接下來
make

產生libpcap.so.1.1.1

就代表成功嚕

build tcpdump-4.1.1


 1. 修改configure
註解掉 4411~4415

# if test $ac_cv_linux_vers = unknown ; then
# { { echo "$as_me:$LINENO: error: cannot determine linux version when cross-compiling" >&5
#echo "$as_me: error: cannot determine linux version when cross-compiling" >&2;}
# { (exit 1); exit 1; }; }
# fi

./configure --host=arm-none-linux

檢查是否成功的方式與上述相同

確認成功後
make
產生tcpdump
就代表成功嚕

可以用file看一下

file tcpdump
tcpdump: ELF 32-bit LSB executable, ARM, version 1, dynamically linked (uses shared libs), not stripped





透過Facebook分享

沒有留言: