How to cross compile the PPP to arm-xscale

1.

如果需要让pppd支持packet filtering 功能的话就需要编译libpcap.

cross compile libpcap-1.0.0


./configure --host=arm-xscale-linux-gnu --prefix=/usr/arm-xscale-linux-gnu/

直接出错了

configure: error: pcap type not determined when cross-compiling; use --with-pcap=...

 

比较了非交叉编译的log,发现需要加上--with-pcap=linux

./configure --host=arm-xscale-linux-gnu --prefix=/usr/arm-xscale-linux-gnu/ --with-pcap=linux

checking Linux kernel version... unknown
configure: error: cannot determine linux version when cross-compiling

 

查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; }; }

 

原来是交叉编译器无法通过uname获得arm linux 的版本.只能通过cache文件设置了.


echo ac_cv_linux_vers=linux-2.6.15.6-xyz4>arm-linux.cache
./configure --cache-file=arm-linux.cache --host=arm-xscale-linux-gnu --prefix=/usr/arm-xscale-linux-gnu/ --with-pcap=linux
make
make install

这下过了libpcap-1.0.0被安装到了/usr/arm-xscale-linux-gnu/ 目录下

 

2.

cross compile ppp-2.4.4
./configure --prefix=/usr/arm-xscale-linux-gnu   <--  ppp-2.4.4 只支持--prefix/--sysconf参数,其他都不支持

 

make CC=/opt/gcc-4.1.2-glibc-2.4/arm-xscale-linux-gnu/bin/arm-xscale-linux-gnu-gcc

options.c:59:18: error: pcap.h: No such file or directory
options.c: In function 'process_option':
options.c:781: warning: dereferencing type-punned pointer will break strict-aliasing rules
options.c: In function 'setpassfilter':
options.c:1458: error: 'pcap_t' undeclared (first use in this function)
options.c:1458: error: (Each undeclared identifier is reported only once
options.c:1458: error: for each function it appears in.)
options.c:1458: error: 'pc' undeclared (first use in this function)

 

个人觉得,ppp的Makefile 有问题,没有在configure的时候把 --prefix 所指向的路径作为默认路径.

我的做法有两种
第一种在  pppd/Makefile 文件中

line86 行 CFLAGS= $(COPTS) $(COMPILE_FLAGS) $(INCLUDE_DIRS) '-DDESTDIR="/usr/arm-xscale-linux-gnu"'
后添加
CFLAGS += -I$(DESTDIR)/include

LDFLAGS = -L$(DESTDIR)/lib


或者
第二种也是在 pppd/Makefile 文件中

直接disable PPP packet filtering,这样的话libpcap-1.0.0甚至都不用编译

# Uncomment the next line to include support for PPP packet filtering.
# This requires that the libpcap library and headers be installed
# and that the kernel driver support PPP packet filtering.
#FILTER=y

 

两种任一种改完,再运行
make CC=/opt/gcc-4.1.2-glibc-2.4/arm-xscale-linux-gnu/bin/arm-xscale-linux-gnu-gcc
make install

ppp的包就被安装在pc的/usr/arm-xscale-linux-gnu/, 把该目录原封不动拷贝到板子的相同路径下,就可以在板子上运行pppd了.

 

OK.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值