wpa_supplicant交叉编译

本文详细描述了如何从源码编译openssl、libnl,并在Linux平台上进行交叉编译以支持WPA,包括配置步骤、遇到的问题及解决方法,最后介绍了如何在开发板上测试所编译的wpa_supplicant和wpa_cli。
摘要由CSDN通过智能技术生成

源码

wpa_supplicant官网:http://w1.fi/wpa_supplicant/
GIT源:git://w1.fi/hostap.git
在这里插入图片描述

openssl 源码:
https://www.openssl.org/
libnl 源码:
https://github.com/thom311/libnl/releases/download/libnl3_5_0/libnl-3.5.0.tar.gz 或
https://github.com/thom311/libnl/releases/

编译

编译wpa之前需要先编译openssl 以及 libnl

openssl编译

./Configure linux-armv4 shared no-asm --prefix=$(pwd)/install CROSS_COMPILE=arm-linux-gnueabihf-
make -j16
make install

libnl

./configure --host=arm-linux-gnueabihf --prefix=$(pwd)/install
在这里插入图片描述
如果出现以上错误提示,需要对应安装:
apt-get install bison
apt-get install flex

编译:
make -j16
make install

交叉编译WPA

  1. cp defconfig .config
  2. vim .config
  3. 添加如下内容
    CC = arm-linux-gnueabihf-gcc
    #openssl库和头文件路径

CFLAGS += -I/mnt/f/Project/Linux/Study/openssl-3.0.13/install/include
LIBS += -L/mnt/f/Project/Linux/Study/openssl-3.0.13/install/lib -lssl -lcrypto
#libnl库和头文件路径
CFLAGS += -I/mnt/f/Project/Linux/Study/libnl-3.2.25/install/include/libnl3
LIBS += -L/mnt/f/Project/Linux/Study/libnl-3.2.25/install/lib
export PKG_CONFIG_PATH=/mnt/f/Project/Linux/Study/wpa_supplicant-2.10/wpa_supplicant/install【替换成你的路径】
make -j16

如果出现如下dbus.h缺失
在这里插入图片描述
打开.config注释掉两个配置选项
#CONFIG_CTRL_IFACE_DBUS_NEW=y
#CONFIG_CTRL_IFACE_DBUS_INTRO=y

出现linux/if.h:71:2: error: redeclaration of enumerator ‘IFF_UP’
可能是libnl库的版本不对,比如3.2.25 需要用3.5.0

出现没有 if_macsec.h头文件
在.config中加上CFLAGS += -I/mnt/f/Project/Linux/Study/libnl-3.5.0/include/linux-private 该文件存在于libnl中
在这里插入图片描述
将编译出来的wpa_cli 以及 wpa_supplicant
在这里插入图片描述

开发板测试使用

在这里插入图片描述

  • 15
    点赞
  • 16
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值