在调试wifi的过程中,需要使用到其Ap模式。折腾许久,在这里将方法记录下来,供以后查阅。
1. 进入hostapd目录,打开 .config 文件,选择合适的驱动。此处我选择 nl80211 的模式。此时直接编译会出现错误的信息。
通过查阅资料发现需要 添加一个 libnl 的库。其2.0以上版本,API 接口有改变。这里下载了 libnl1.*.* 的库文件进行编译。
编译方法如下:
./configure --prefix=/home/anyone/wifi/libnl --host=arm-linux其中 --prefix指定编译好后make install的路径。2 、
make3、
make install
此时在libnl的文件夹下就可以看见include的头文件以及lib目录下的库文件。libnl编译完成。
接下来编译hostapd工具
进入hostapd的.config文件进行配置
CONFIG_DRIVER_NL80211=y
# driver_nl80211.c requires a rather new libnl (version 1.1) which may not be
# shipped with your distribution yet. If that is the case, you need to build
# newer libnl version and point the hostapd build to use it.
LIBNL=/your libnl path
CFLAGS += -I$(LIBNL)/include
LIBS += -L$(LIBNL)/lib
其中LIBNL变量表示你的libnl的文件地址。
make之后即可得到 hostapd的应用程序。hostapd程序编译成功。
本文详细介绍了如何在设备上搭建WiFi的AP模式,包括编译libnl库和hostapd工具的具体步骤。针对libnl的不同版本及API变化进行了说明,并提供了具体的编译指令。
1781

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



