文章目錄
- 源碼
- 編譯
- openssl編譯
- libnl
- 交叉編譯WPA
- 開發板測試使用
源碼
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
- cp defconfig .config
- vim .config
- 添加如下內容
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