主要参考:wpa_supplicant交叉编译
选择的版本:
openssl-1.0.2r.tar.gz
libnl-3.5.0.tar.gz
wpa_supplicant-2.5(版本太新会有报错)
1 libssl编译
1.1下载
下载链接:https://www.openssl.org/source/
下载文件openssl-1.0.2r.tar.gz
1.2编译
解压文件,进入主目录,使用如下命令编译
#mkdir _install #./config no-asm shared --prefix=$PWD/_install --cross-compile-prefix=aarch-himix100-linux- #make #make insatll
_install为相关库的存放路径
arm-himix100-linux- 为交叉编译工具链
注意,在编译过程中,如果出现如下错误:
arm-himix100-linux-gcc: error: unrecognized command line option ‘-m64’
则需要打开Makefile 查找里面的 ‘-m64’,并将其删除即可
make CC=aarch64-himix100-linux会报错,因为在config命令中已经指定了交叉编译工具链。直接make就可以。
CROSS_COMPILE= aarch64-himix100-linux-
CC= $(CROSS_COMPILE)gcc
2 libnl编译
2.1 下载
下载链接:
http://www.linuxfromscratch.org/blfs/view/svn/basicnet/libnl.html
下载libnl-3.5.0.tar.gz
2.2 编译
解压进入主目录,使用如下命令编译:
#mkdir _install #./configure --host=aarch-himix100-linux --prefix=$PWD/_install #make #make install
_install为相关库的存放路径
aarch-himix100-linux- 为交叉编译工具链
3 wpa_supplicant
3.1 下载
下载链接:http://w1.fi/releases/
下载wpa_supplicant-2.6.tar.gz
3.2 编译
解压并进入主目录
使用如下命令编译
#cd wpa_supplicant/
#cp defconfig .config
在Makefile中添加libssl和libnl的路径,如下:
CFLAGS += -I/home/openssl-1.0.2r/_install/include LIBS += -L/home/openssl-1.0.2r/_install/lib LIBS_p += -L/home/openssl-1.0.2r/_install/lib CFLAGS += -I/home/libnl-3.5.0/_install/include/libnl3 LIBS += -L/home/libnl-3.5.0/_install/lib
路径一定要对,否则会导致找不到头文件和库,
在.config中,修改
# Use libnl v2.0 (or 3.0) libraries. CONFIG_LIBNL20=y # Use libnl 3.2 libraries (if this is selected, CONFIG_LIBNL20 is ignored) CONFIG_LIBNL32=y
0、编译时报错,找不到dbus.h头文件
make: *** No rule to make target '/usr/include/dbus-1.0/dbus/dbus.h', needed by 'dbus/dbus_dict_helpers.o'. Stop.
到dbus源码包下的include目录dbus-1.0的所有头文件拷贝到/usr/include/目录下
1、pkg-config报错 解决:
1 export PKG_CONFIG_PATH=/home/tianyu/tools/dbus-1.13.12/_install/lib/pkgconfig/:$PKG_CONFIG_PATH 2 export PKG_CONFIG_PATH=/home/tianyu/tools/libnl-3.5.0/_install/lib/pkgconfig/:$PKG_CONFIG_PATH
2、在板子上运行后,报错提示缺少dbus-1.so的动态库
交叉编译dbus后将动态库文件及链接文件拷贝到板子上 /usr/lib
3、运行wpa_supplicant后报错
~/wifi # modprobe ahci.ko ~/wifi # modprobe bcmdhd.ko ~/wifi # ./wpa_supplicant -Dnl80211 -iwlan0 -cwpa.conf -B Successfully initialized wpa_supplicant Failed to create interface p2p-dev-wlan0: -22 (Invalid argument) nl80211: Failed to create a P2P Device interface p2p-dev-wlan0 P2P: Failed to enable P2P Device interface
在编译wpa_supplicant的时候把对P2P的支持打开了,但是板子内核加载的是STA+AP的固件,不支持P2P,所以报错。
解决有2:
1)把wpa_supplicant对P2P的支持取消,重新编译
2)使内核支持P2P
参考:
https://blog.csdn.net/u011003120/article/details/90175648
https://www.cnblogs.com/henryliublog/p/9902021.html
https://www.cnblogs.com/songfeixiang/p/3733799.html