iproute2交叉编译
测试zynq+ramdisk平台时发现自带的busybox无法通过ip命令配置can接口,执行can配置命令
ip link set can0 type can bitrate 100000
会出现以下报错:
ip: either "dev" is duplicate, or "type" is garbage
查看ip命令:
BusyBox v1.21.1 (2013-08-15 15:21:48 CST) multi-call binary. Usage: ip [OPTIONS] {address | route | link | tunnel | rule} {COMMAND} ip [OPTIONS] OBJECT {COMMAND} where OBJECT := {address | route | link | tunnel | rule} OPTIONS := { -f[amily] { inet | inet6 | link } | -o[neline] }
根据参考文献3可知busybox的ip命令太过old,因此需要对iproute2进行交叉编译,以下记录交叉编译过程:
PC平台:ubuntu16.04 LTS 32bit
交叉编译器:Sourcery CodeBench Lite gcc 4.6.1
1.下载源码:https://www.kernel.org/pub/linux/utils/net/iproute2/
2.修改Makefille中的CC为交叉编译器
3.make(该过程不会完全成功,但此时我们所需的ip已经编译完成)
4.ip目录下的ip即为我们所需的ip程序
参考文献:
1.http://xilinx.eetrend.com/blog/12062
2.http://www.wiki.xilinx.com/Linux+CAN+driver
3.https://stackoverflow.com/questions/18840891/command-ip-is-not-fully-supported-in-busybox
4.https://my.oschina.net/u/2326703/blog/385249