hostapd自己常用,本次先写一篇源码交叉编译和基本使用方法的文档,待自己60大寿记忆退化的时候翻阅。
-----再牛逼的梦想,也抵不住傻逼般的坚持! ----20240105 16:42
1.源码下载
下载链接:https://w1.fi/releases/ 下载文件 hostapd-2.9.tar.gz
2.交叉编译:
ps:hostapd依赖libnl和openssl库,该两个库的交叉编译方法在另外一篇博文中获取 https://blog.csdn.net/Bgm_Nilbb/article/details/120724443
2.1.解压
tar -zxvf hostapd-2.9.tar.gz
2.2 交叉编译
cd hostapd; make CC=arm-linux-gnueabihf-4.8.3-gcc
3.hostapd使用方法
hostapd test.conf &
4.常见问题:
问题1. 交叉编译时报错…/src/drivers/driver_nl80211.c:19:31: fatal error: netlink/genl/genl.h: No such file or directory
或报错…/src/crypto/tls_openssl.c:23:25:fatal error: openssl/ssl.h: No such file or directory
问题原因: 缺少libnl、openssl依赖,需要连接libnl,openssl编译产物及头文件
解决方法: 在hostapd/Makefile中添加头文件路径及库链接路径(路径需要根据自己实际情况修改)
CFLAGS += -I/openssl-1.0.2r/_install/include
LIBS += -L/openssl-1.0.2r/_install/lib
CFLAGS += -I/libnl-3.5.0/_install/include/libnl3
LIBS += -L/libnl-3.5.0/_install/lib
问题2. 交叉编译报错
/opt/alpsx/alpsx-tools/v4.8.3/bin/../lib/gcc/arm-linux-gnueabihf/4.8.3/../../../../arm-linux-gnueabihf/bin/ld: cannot find -lnl
collect2: error: ld returned 1 exit status
问题原因: 使用了高版本的libnl
解决方法: 在.config(隐藏文件)中增加CONFIG_LIBNL32=y选项
问题3. hostapd运行过程中提示缺少某些动态库
该问题日志丢失,大致讲解下处理方法,方法1,增加缺少的动态库,确实的动态库一般是libnl和openssl编译的产物,切记动态库复制到设备中时,若原本有软链接关系,需要将软链接关系一起复制过去。方法2,可在编译libnl、openssl库时增加静态编译规则如下(部分低版本hostapd不支持–enable-shared --enable-static选项)
./configure --host=$(GCC_HOST) --enable-shared --enable-static
或者将相关的动态库复制到工具链对应的目录中
问题4. 执行cd hostapd; make CC=arm-linux-gnueabihf-4.8.3-gcc出现如下报错
Building hostapd requires a confi


1062

被折叠的 条评论
为什么被折叠?



