移植环境:
       主机操作系统:Ubantu 10.10
       目标系统:hi351x 内核 linux-2.6.14
       交叉编译器:arm-hismall-linux-

版本: wpa_supplicant-0.7.3
移植wpa_supplicant前确保Openssl已经移植好了,Openssl移植参考前文“Openss驱动移植
1.下载wpa_supplicant驱动源码

2. 配置修改,编译
#cp defconfig   .config
#vi .config
增加这几行
CFLAGS += -I/usr/local/ssl/include
LIBS += -L/usr/local/ssl/lib
CC = arm-hismall-linux-gcc -L /usr/local/ssl/lib/

#make

需要先编译安装openssl库,确保两个编译都使用统一工具arm-hismall-linux-gcc
不一致会出现这样的问题:
/usr/bin/ld: skipping incompatible /usr/local/ssl/lib/libssl.so when searching for -lssl
/usr/bin/ld: skipping incompatible /usr/local/ssl/lib/libssl.a when searching for -lssl
/usr/bin/ld: cannot find -lssl
/usr/bin/ld: skipping incompatible /usr/local/ssl/lib/libcrypto.so when searching for -lcrypto
/usr/bin/ld: skipping incompatible /usr/local/ssl/lib/libcrypto.a when searching for -lcrypto
/usr/bin/ld: cannot find -lcrypto
collect2: ld returned 1 exit status
make: *** [wpa_supplicant] Error 1
这样只要把openssl和wpa_supplicant两个用同一个编译工具编译即可。


3. 产品板使用:
3.1. 把wpa_supplicant.conf拷贝到/xxx目录下 (xxx目录自定)

按加密方式分3种,以下3个配置文件均测试正常

# 无密码 wpa_supplicant.conf内容:
ctrl_interface=/var/run/wpa_supplicant
network={
ssid="XXXXXX"    
key_mgmt=NONE   
}

# WEP密码 wpa_supplicant.conf内容:
ctrl_interface=/var/run/wpa_supplicant
network={
ssid="XXXXXX"    
key_mgmt=NONE       
wep_key0="XXXXXX"    
wep_tx_keyidx = 0
}

# WPA密码 wpa_supplicant.conf内容:
# WPA-PSK/TKIP
ctrl_interface=/var/run/wpa_supplicant
network=
{
ssid="XXXXXX"   
ap_scan=1;
key_mgmt=WPA-EAP WPA-PSK IEEE8021X NONE       
pairwise=TKIP CCMP        
group=CCMP TKIP WEP104 WEP40
psk="XXXXXX"
}

3.2. wpa_supplicant拷贝到/xxx/目录下
//无桥方式
wpa_supplicant -B -ira0 -c /xxx/wpa_supplicant.conf -Dwext (xxx为前面wpa_supplicant.conf目录)

//有桥接方式(bridge-utils)
wpa_supplicant -B -b br0 -ira0 -c /xxx/wpa_supplicant.conf -Dwext

如果运行时出现:
socket(PF_PACKET): Address family not supported by protocol

原因
内核不支持RAW socket,编译内核时把CONFIG_PACKET选项打开,
CONFIG_PACKET = y

If we use CONFIG_PACKET=m instead of CONFIG_PACKET=y we'd need to 
include af_packet.ko into the initramfs for netboot installation.

手动加载af_packet.ko
#insmod af_packet.ko
显示
NET: Registered protocol family 17
加载正常

3.3 运行#wpa_supplicant
#wpa_supplicant -B -ira0 -c /xxx/wpa_supplicant.conf -Dwext
(Efuse for 3062/3562/3572) Size=0x2d [2d0-2fc] 
RTMP_TimerListAdd: add timer obj d1b3c620!
RTMP_TimerListAdd: add timer obj d1b3c650!
RTMP_TimerListAdd: add timer obj d1b3c680!
RTMP_TimerListAdd: add timer obj d1b3c5f0!
RTMP_TimerListAdd: add timer obj d1b3c560!
RTMP_TimerListAdd: add timer obj d1b3c590!
RTMP_TimerListAdd: add timer obj d1b06b94!
RTMP_TimerListAdd: add timer obj d1af5f54!
RTMP_TimerListAdd: add timer obj d1af5f8c!
RTMP_TimerListAdd: add timer obj d1b06c38!
RTMP_TimerListAdd: add timer obj d1b06b34!
RTMP_TimerListAdd: add timer obj d1b06c04!
-->RTUSBVenderReset
<--RTUSBVenderReset
Key1Str is Invalid key length(0) or Type(0)
Key2Str is Invalid key length(0) or Type(0)
Key3Str is Invalid key length(0) or Type(0)
Key4Str is Invalid key length(0) or Type(0)
1. Phy Mode = 5
2. Phy Mode = 5
phy mode> Error! The chip does not support 5G band 5!
RTMPSetPhyMode: channel is out of range, use first channel=1 
(Efuse for 3062/3562/3572) Size=0x2d [2d0-2fc] 
3. Phy Mode = 9
MCS Set = ff 00 00 00 01
<==== rt28xx_init, Status=0
0x1300 = 00064300
运行正常

查看状态:
#iwconfig
  Ralink STA  ESSID:"xxxx"  Nickname:"RT2870STA"
          Mode:Managed  Frequency=2.427 GHz  Access Point: 54:E6:FC:68:74:24   
          Bit Rate=54 Mb/s   
          RTS thr:off   Fragment thr:off
          Encryption key:8888-8888-8888-8888-8888-8888-8888-8888   Security mode:open
          Link Quality=68/100  Signal level:-60 dBm  Noise level:-83 dBm
          Rx invalid nwid:0  Rx invalid crypt:0  Rx invalid frag:0
          Tx excessive retries:0  Invalid misc:0   Missed beacon:0

3.4 设置ip
#ifconfig ra0 192.168.1.230 netmask 255.255.255.0
设置完一会,等网络连接好就可以了。
Logo

更多推荐