[*] Networking support --->
[*] Wireless --->
<*> cfg80211 - wireless configuration API
[*] Wireless extensions sysfs files
<*> Generic IEEE 802.11 Networking Stack(mac80211)
Device Drivers --->
[*]Network device support --->
[*] Wireless LAN --->
<*> IEEE 802.11 for Host AP (Prism2/2.5/3 andWEP/TKIP/CCMP)
[*] Support downloading firmware images withHost AP driver
[*] Support for non-volatile firmwaredownload
<*> Ralink driver support --->
<*> Ralink rt27xx/rt28xx/rt30xx (USB) support
tar -xjf DPO_RT3070_LinuxSTA_V2.3.0.2_20100412.tar.bz2
由于文件名太长,重命名一下
mv DPO_RT3070_LinuxSTA_V2.3.0.2_20100412 rt3070l
Platform 选择默认的PC
改变交叉编译路径和linux源码路径
implicit declaration of function ' usb_buffer_free'
implicit declaration of function ' usb_buffer_alloc'
显示usb_buffer_alloc和'usb_buffer_free没有申明,这是由于Relink RT3070驱动支持linux 内核版本太旧的原因。
显示如下
./include/os/rt_linux.h:#define RTUSB_URB_FREE_BUFFER(pUsb_Dev, BufSize, pTransferBuf, Dma_addr) usb_buffer_free(pUsb_Dev, BufSize, pTransferBuf, Dma_addr)
./include/os/rt_linux.h:#define RTUSB_URB_FREE_BUFFER(pUsb_Dev, BufSize, pTransferBuf, Dma_addr) rausb_buffer_free(pUsb_Dev, BufSize, pTransferBuf, Dma_addr)
./include/os/rt_linux.h:extern void rausb_buffer_free(struct usb_device *dev,
./os/linux/rt_usb_util.c:void rausb_buffer_free(struct usb_device *dev,
./os/linux/rt_usb_util.c: usb_buffer_free(dev, size, addr, dma);
./os/linux/rt_usb_util.c:EXPORT_SYMBOL(rausb_buffer_free);
Vim ./include/os/rt_linux.h
usb_buffer_alloc 和 usb_buffer_free这两个函数已不在使用了,可以用usb_alloc_coherent 和 usb_free_coherent代替
sudo make 之后会在 os/linux/ 目录下生成rt3070sta.ko驱动文件
下载相应的驱动文件到开发板
把RT2870STA.dat拷贝到/etc/Wireless/RT2870STA目录下
加载rt3070sta.ko驱动
insmod rt3070sta.ko
显示错误如下
/apps >: insmod rt3070sta.ko
rt3070sta: module license 'unspecified' taints kernel.
Disabling lock debugging due to kernel taint
rt3070sta: Unknown symbol usb_alloc_urb (err 0)
rt3070sta: Unknown symbol usb_free_urb (err 0)
rt3070sta: Unknown symbol usb_alloc_coherent (err 0)
rt3070sta: Unknown symbol usb_register_driver (err 0)
rt3070sta: Unknown symbol usb_put_dev (err 0)
rt3070sta: Unknown symbol usb_get_dev (err 0)
rt3070sta: Unknown symbol usb_submit_urb (err 0)
rt3070sta: Unknown symbol usb_free_coherent (err 0)
rt3070sta: Unknown symbol usb_control_msg (err 0)
rt3070sta: Unknown symbol usb_deregister (err 0)
rt3070sta: Unknown symbol usb_kill_urb (err 0)
insmod: can't insert 'rt3070sta.ko': unknown symbol in module or invalid parameter
这是有内核无法识别的原因,相应的内核没有LICENSE
找到OS/linux/rt_main_dev.c 在第一行加入 MODULE_LICENSE(“GPL”);
再次编译,加载模块,显示如下
~ >: insmod rt3070sta.ko
rtusb init --->
usbcore: registered new interface driver rt2870
ifconfig wlan0 up
显示
找到common/rt2870.bin的固件,放入开发板的lib/firmware/目录下
使文件具有可执行的权限:chmod +x rt2870.bin
使能网卡: ifconfig wlan0 up
wget http://www.hpl.hp.com/personal/Jean_Tourrilhes/Linux/wireless_tools.29.tar.gz
tar -xzf wireless_tools.29.tar.gz
5 ## Installation directory. By default, go in /usr/local.
6 ## Distributions should probably use /, but they probably know better...
7 ifndef PREFIX
8 PREFIX = ./ //库安装目录,我选择的是当前目录
9 endif
10
11 ## Compiler to use (modify this for cross compile).
12 CC = arm-linux-gcc //交叉编译器
13 ## Other tools you need to modify for cross compile (static lib only).
14 AR = arm-linux-ar //连接器
15 RANLIB = arm-linux-ranlib
Make之后,将生成的libiw.so.29,移植到开发板的lib目录下
将ifrename,iwconfig, iwlist, iwgetid, iwevent,iwpriv, iwspy,工具移植到开发板的bin目录下
参考博客:http://blog.sina.com.cn/s/blog_73739d500100oz2v.html
安装目录就指定为默认目录
CC= arm-linux-gcc 修改交叉编译器
注意安装时切换到root用户,再make,make install
使用sudo 权限是不行的
Wget http://hostap.epitest.fi/releases/wpa_supplicant-0.7.3.tar.gz
5.2配置和修改
进入/wpa_supplicant-0.7.3/wpa_supplicant/目录
#cp defconfig .config
#vi .config
增加这几行
CFLAGS += -I/openss/include/
LIBS += -L/openss/lib/
CC = arm-linux-gcc -L /openss/lib/
#make
将wpa_supplicant 移植到开发板的bin目录下
将 修改的wpa_supplicant.conf文件放入etc目录下
chmod +x bin/wpa_supplicant
chmod +x etc/wpa_supplicant.conf
执行wpa_supplicant -B -iwlan0 -c /etc/wpa_supplicant.conf -Dwext命令
显示如下
~ >: wpa_supplicant: symbol '__ctype_tolower': can't resolve symbol
>
> wpa_supplicant: symbol '__ctype_b': can't resolve symbolchmod +x bin/wpa_suppl
icant
这个应该是开发板缺少相应wpa_supplicant需要的动态库文件,
目前我找到的解决方法是静态连接
修改 .config 文件
CFLAGS += -I/openss/include/
LIBS += -L/openss/lib/
CC = arm-linux-gcc -L /openss/lib/ -static //选择静态连接
再次编译之后,将 wpa_supplicant,放入开发板的bin目录
修改权限chmod +x wpa_supplicant
再次执行
wpa_supplicant -B -iwlan0 -c /etc/wpa_supplicant.conf -Dwext
出现了一个问题:暂时不知道什么原因
~ >: cfg80211: Calling CRDA for country: US
cfg80211: Regulatory domain changed to country: US
cfg80211: (start_freq - end_freq @ bandwidth), (max_antenna_gain, max_eirp)
cfg80211: (2402000 KHz - 2472000 KHz @ 40000 KHz), (300 mBi, 2700 mBm)
cfg80211: (5170000 KHz - 5250000 KHz @ 40000 KHz), (300 mBi, 1700 mBm)
cfg80211: (5250000 KHz - 5330000 KHz @ 40000 KHz), (300 mBi, 2000 mBm)
cfg80211: (5490000 KHz - 5600000 KHz @ 40000 KHz), (300 mBi, 2000 mBm)
cfg80211: (5650000 KHz - 5710000 KHz @ 40000 KHz), (300 mBi, 2000 mBm)
cfg80211: (5735000 KHz - 5835000 KHz @ 40000 KHz), (300 mBi, 3000 mBm)
cfg80211: (57240000 KHz - 63720000 KHz @ 2160000 KHz), (N/A, 4000 mBm)
解决方法:找到内核目录net/wireless/reg.c文件,注释相应的打印信息。
查看状态:
#iwconfig
显示如下
~ >: iwconfig
lo no wireless extensions.
eth0 no wireless extensions.
wlan0 IEEE 802.11bgn ESSID:"16-912A"
Mode:Managed Frequency:2.412 GHz Access Point: 38:83:45:51:4F:AA
Bit Rate=6.5 Mb/s Tx-Power=27 dBm
Retry long limit:7 RTS thr:off Fragment thr:off
Encryption key:off
Power Management:on
Link Quality=63/70 Signal level=-47 dBm
Rx invalid nwid:0 Rx invalid crypt:0 Rx invalid frag:0
Tx excessive retries:0 Invalid misc:8 Missed beacon:0
证明连接到了网络
设置ip地址
#ifconfig wlan0 192.168.1.230 netmask 255.255.255.0
ping 192.168.1.1
~ >: ping 192.168.1.1
PING 192.168.1.1 (192.168.1.1): 56 data bytes
64 bytes from 192.168.1.1: seq=0 ttl=64 time=262.313 ms
64 bytes from 192.168.1.1: seq=1 ttl=64 time=45.464 ms
64 bytes from 192.168.1.1: seq=2 ttl=64 time=45.511 ms
64 bytes from 192.168.1.1: seq=3 ttl=64 time=44.479 ms
64 bytes from 192.168.1.1: seq=4 ttl=64 time=44.560 ms
在电脑上ping 开发板
C:\Users\Administrator>ping 192.168.1.230
正在 Ping 192.168.1.230 具有 32 字节的数据:
来自 192.168.1.230 的回复: 字节=32 时间=129ms TTL=64
来自 192.168.1.230 的回复: 字节=32 时间=258ms TTL=64
来自 192.168.1.230 的回复: 字节=32 时间=278ms TTL=64
来自 192.168.1.230 的回复: 字节=32 时间=186ms TTL=64
192.168.1.230 的 Ping 统计信息:
数据包: 已发送 = 4,已接收 = 4,丢失 = 0 (0% 丢失),
往返行程的估计时间(以毫秒为单位):
最短 = 129ms,最长 = 278ms,平均 = 212ms
由此说明无线网卡已经移植成功了。
/home/zhanghaijun/fl2440/3rdparty/busybox-1.20.2/examples/udhcp目录下的simple.script
重命名为dedault.script并拷贝到开发板usr/share/udhcpc/目录下,修改权限。
udhcpc -i wlan0