aarch64交叉编译dfu-programmer
这里需要说明一下的是dfu-programmer的编译需要依赖于libusb-1.0库,需要先交叉编译usblib-1.0库。
交叉编译usblib-1.0
usblib-1.0源码下载:
https://github.com/libusb/libusb/releases
cd /root/ tar -xvf libusb-1.0.23.tar.bz2 cd libusb-1.0.23/ mkdir build ./configure --host=aarch64-linux-gnu --prefix=/root/libusb-1.0.23/build/ CC=aarch64-linux-gnu-gcc CXX=aarch64-linux-gnu-g++
这时会报如下错误:
configure: error: udev support requested but libudev header not installed
在configure里面加上--disable-udev选项,重新配置。
./configure --host=aarch64-linux-gnu --prefix=/root/libusb-1.0.23/build/ CC=aarch64-linux-gnu-gcc CXX=aarch64-linux-gnu-g++ --disable-udev
配置成功后依次执行:
make make install
在/root/libusb-1.0.23/build/lib/目录下会生成libusb的动态库。
[root@jz4775dev]# ls build/lib/ libusb-1.0.a libusb-1.0.la libusb-1.0.so libusb-1.0.so.0 libusb-1.0.so.0.2.0 pkgconfig
交叉编译dfu-programmer
dfu-programmer源码下载: https://github.com/dfu-programmer/dfu-programmer
cd /root/ unzip dfu-programmer-master.zip cd dfu-programmer-master mkdir build ./configure --prefix=/root/dfu-programmer-master/build/ --host=aarch64-linux-gnu CC=aarch64-linux-gnu-gcc LDFLAGS=-L"/root/libusb-1.0.23/build/lib/" CPPFLAGS=-I"/root/libusb-1.0.23/build/include" make make install
这时在/root/dfu-programmer-master/build/bin/目录下会生成dfu-programmer二进制文件。
[root@jz4775dev]# file build/bin/dfu-programmer build/bin/dfu-programmer: ELF 64-bit LSB executable, ARM aarch64, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 3.7.0, BuildID[sha1]=a0
本文来自博客园,作者:闹闹爸爸,转载请注明原文链接:https://www.cnblogs.com/wanglouxiaozi/p/12794736.html