wpa_supplicant和openssl移植
在ubuntu10.04下移植,下面记录过程。版本:wpa_supplicant-2.0.tar.gz openssl-1.0.1e编译器:linaro - arm-linux-gcc-4.7.3备注:经过测试发现openssl-0.9.8e + wpa_supplicant-0.7.3 or wpa_supplicant-2.0 连接时会出错:>
在ubuntu10.04下移植,下面记录过程。
版本:wpa_supplicant-2.0.tar.gz
openssl-1.0.1e
编译器:linaro - arm-linux-gcc-4.7.3
备注:
经过测试发现openssl-0.9.8e + wpa_supplicant-0.7.3 or wpa_supplicant-2.0 连接时会出错:
> wlan0: authenticate with 48:02:2a:17:84:55
wlan0: send auth to 48:02:2a:17:84:55 (try 1/3)
wlan0: authenticated
ath9k 0000:01:00.0 wlan0: disabling HT/VHT due to WEP/TKIP use
wlan0: associate with 48:02:2a:17:84:55 (try 1/3)
wlan0: RX AssocResp from 48:02:2a:17:84:55 (capab=0x431 status=0 aid=2)
wlan0: associated
wlan0: deauthenticating from 48:02:2a:17:84:55 by local choice (reason=17)
cfg80211: Calling CRDA to update world regulatory domain
<2>CTRL-EVENT-SCAN-RESULTS
<2>Trying to associate with 48:02:2a:17:84:55 (SSID='yanglsh_AP' freq=2412 MHz)
<2>Association request to the driver failed
<2>Associated with 48:02:2a:17:84:55
<3>WPA: IE in 3/4 msg does not match with IE in Beacon/ProbeResp (no IE?) (src=48:02:2a:17:84:55)
<2>CTRL-EVENT-DISCONNECTED bssid=00:00:00:00:00:00 reason=0
然后使用openssl-1.0.1e版本+wpa_supplicant2.0版本可以正常连接。
------------------------------------------------------------------------------------------------------------------
先移植openssl-1.0.1e:
./config no-asm shared --prefix=/home/xuewt/share/yocto/build/tmp/work/socfpga_cyclone5-poky-linux-gnueabi/altera-image-1.0-r0/wireless/openssl-1.0.1e/_install
shared表示要生成动态库,否则默认生成的是静态库。
再移植wpa_supplicant2.0:
vi .config
CC=arm-linux-gnueabihf-gcc -L/home/xuewt/share/yocto/build/tmp/work/socfpga_cyclone5-poky-linux-gnueabi/altera-image-1.0-r0/wireless/openssl-1.0.1e/_install/lib/
CFLAGS +=-I/home/xuewt/share/yocto/build/tmp/work/socfpga_cyclone5-poky-linux-gnueabi/altera-image-1.0-r0/wireless/openssl-1.0.1e/_install/include/
LIBS +=-L/home/xuewt/share/yocto/build/tmp/work/socfpga_cyclone5-poky-linux-gnueabi/altera-image-1.0-r0/wireless/openssl-1.0.1e/_install/lib/
注意如果出现netlink编译错误,可以把.config中netlink driver配置屏蔽掉,在wpa-0.7.3默认是屏蔽掉的。
然后make,就会在当前目录下生成3个我们需要的文件:wpa_supplicant,wpa_cli,wpa_passphrase。
cp wpa_supplicant/examples/wpa-psk-tkip.conf wpa_supplicant.conf
编辑conf的内容:
network={
ssid="name"
#psk="123456"
key_mgmt=WPA-PSK
proto=WPA
pairwise=TKIP
group=TKIP
#priority=20
psk=fa4b84264af8dcf3876f3c612d52dea90c3d20c0fedfd87775144ea0a463ad55
#frequency=2412
}
./wpa_passphrase ssid name 123456 就会生成一个加密后的密码,然后把这个密码填到conf文件里,把明码屏蔽掉,如上所示。
然后把它们下载到开发板上。
ifconfig eth0 down
ifconfig wlan0 up
./wpa_supplicant -Dwext -iwlan0 -c/etc/wpa_supplicant.conf -B
-B表示是个守护进程,在后台一直运行。 -Dwext 表示使用扩展WIFI接口。
./wpa_cli scan
./wpa_cli scan_results
./wpa_cli
add_network 添加一个网络,假设返回0
set_network 0 ssid "name" 设置用户名
有密码时:set_network 0 psk "123456"
没有密码时:set_network 0 key_mgmt NONE
select_network 0
enable_network 0
udhcpc -i wlan0 动态获取IP
然后可以使用wget去网络下载一些文件测试一下稳定性。
备注:删除指定网络0:./wpa_cli remove_network 0
更多推荐
所有评论(0)