//源码包路径:
https://public.pengutronix.de/software/libsocketcan/libsocketcan-0.0.11.tar.bz2
https://public.pengutronix.de/software/socket-can/canutils/v4.0/canutils-4.0.6.tar.bz2
//编译命令
./configure --host=arm-linux-gnueabihf --prefix=/home/fangzeli/work/libsocketcan-0.0.11/out
./configure --host=arm-linux-gnueabihf --prefix=/home/fangzeli/work/canutils-4.0.6/out libsocketcan_LIBS=-lsocketcan LDFLAGS="-L/home/fangzeli/work/libsocketcan-0.0.11/out/lib/" libsocketcan_CFLAGS="-I/home/fangzeli/work/libsocketcan-0.0.11/out/include"
将libsocketcan-0.0.11文件夹下的libsocketcan.h和can_netlink.h复制到canutils的include文件夹下,输入make开始编译
//报错记录修改
checking host system type... Invalid configuration `aarch64-linux-gnu': machine `aarch64' not recognized
找到canutil源码包中的config.guess和config.sub,采用下面的命令下载得到新的文件覆盖过去
wget -O config.guess 'http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD' wget -O config.sub 'http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD'
其它:
//aarch64交叉编译工具链
https://releases.linaro.org/components/toolchain/binaries/7.5-2019.12/aarch64-linux-gnu/
//busybox自带的ip命令并不支持对can的操作,因此我们需要重新移植ip命令,也就是iproute2
//参考文献
https://www.cnblogs.com/FZLGYZ/p/11731839.html
https://public.pengutronix.de/software/socket-can/canutils/v4.0/canutils-4.0.6.tar.bz2