免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 1942 | 回复: 0
打印 上一主题 下一主题

tcpdum 移植arm平台 [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2009-11-29 03:20 |只看该作者 |倒序浏览

下面介绍一下具体过程。
1.在http://www.tcpdump.org下载libpcap-0.9.8.tar.gz和tcpdump-3.9.8.tar.gz两个文件。
2解压。
3.编译,安装libpcap-1.0.0:
   (1)进入libpcap目录,打开configure。将下面两端代码注释掉
       #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
   .......
     #   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-linu
   (2)配置之后,会生成Makefile。打开Makefile发现CC=arm-uclibc-linux-gcc,说明交叉编译配置成功。
  把prefix项为prefix=/usr/local/arm/3.4.1/arm-linux。然后make,make install。
   发现/usr/local/arm/3.4.1/arm-uclibc-linux/include有了3个pcap文件,libpcap编译安装成功。
   
3.编译,安装tcpdump-3.9.8
   (1)进入tcpdump目录,打开configure,将下面一段代码注释掉
     #   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-linux
   (2)打开生成的Makefile,将INCLS项改为INCLS=-I.-I./../libpcap-1.0.0 -I$(srcdir)/missing -I/usr/local/include,
       DEFS项改为DEFS=-DHAVE_CONFIG_H -I./../libpcap-1.0.0 -I/usr/local/include -I$(srcdir)missing -D_U_="__attribute__((unused))"。
       LDFLAGS=-L/usr/local/lib。
然后make,make install。在/usr/local/sbin下有个tcpdump的二进制文件,这个就是交叉编译成功的tcpdump
   (3)将这个二进制文件下载到arm板上,chmod 777 tcpdump将其变为可执行文件。
   (4)运行tcpdump,成功!
你可能需要解决一些依赖关系,比如flex,m4,bison等

http://ftp.gnu.org/gnu/m4/

http://ftp.gnu.org/gnu/bison/

http://jaist.dl.sourceforge.net/sourceforge/flex/flex-2.5.35.tar.gz

安装顺序:

m4,flex,bison,libpcap,tcpdump。

编译tcpdump的时候,报了一个错误

undefined reference to `ip6_print'

然后我尝试使用./configure --disable-ipv6 来消除这个错误,可是不管用。

没办法,只好去源代码里看看了。是print-enc.c 这个文件,打开后找到了这么一段:

       case AF_INET6:
       ip6_print(p, length);
       break;

我直接把ip6_print(p, length);这行给注释

然后make && make install,一切正常。然后make && make install,一切正常。




Make error ----pcap
gcc *.o -o find_stats -lpcap
/usr/local/lib/libpcap.a(gencode.o): In function `.L149':
gencode.c:(.text+0x7b4): undefined reference to `pcap_parse'
collect2: ld returned 1 exit status
make: *** [find_stats] Error 1
solution:

文件:
source.rar
大小:
1424KB
下载:
下载
sudo apt-get install libpcap-dev
sudo apt-get install libnids-dev
sudo apt-get install libnet1-dev





本文来自ChinaUnix博客,如果查看原文请点:http://blog.chinaunix.net/u3/95172/showart_2106565.html
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP