360WIFI2无线网卡移植 -MT7601U移植
来源:互联网 发布:php超链接传值 编辑:程序博客网 时间:2024/06/06 12:46
软件环境:虚拟机ubuntu12.04
硬件环境:360WIFI2无线网卡
EasyARM-i.MX280A: 64m sdram 128M nandflash 运行官方提供的Linux-2.6.35.3内核linux wpa_supplicant版本0.7.3(官方内核自带)
MT7601U驱动下载:http://download.csdn.net/detail/andylauren/9585949
先说一下为什么我要移植MT7601U,因为上一篇文章移植了一个腾达811M的usb网卡,发现无线网卡使用真是方便,手上还有一个360wifi2,所以就想移植一下,看看是不是一样能用呢。手上弄到一个新的开发板,EasyARM-i.MX280A,这个开发板是ARM9的芯片,但是是最便宜的开发板,之需要99元。后来经过不懈的努力终于成功了!我的360wifi在开发板上正常工作,能够上网,能够挂载nfs,下面就按照我从开始到最终移植的过程说一下,并把我在移植的过程中遇到的问题也说明一下,希望能够对后人有帮助。
首先说一下如何知道360wifi2的网卡芯片是什么才能去下载驱动移植,先把网卡插在ubuntu上,ubuntu不能识别,然后使用lsusb命令查看usb的id
linux@ubuntu:/tftpboot$ lsusbBus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hubBus 002 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hubBus 002 Device 002: ID 0e0f:0003 VMware, Inc. Virtual MouseBus 002 Device 003: ID 0e0f:0002 VMware, Inc. Virtual USB HubBus 001 Device 002: ID 0930:6545 Toshiba Corp. Kingston DataTraveler 102 Flash Drive / HEMA Flash Drive 2 GB / PNY Attache 4GB StickBus 001 Device 003: ID 148f:760b Ralink Technology, Corp.其中148f:760b就是360wifi2的ID,然后根据这个ID去网上搜是哪个网卡,但是万万没想到,没有搜到。
然后第二种方法,一个字,拆,当然先不用真拆,先上网看看有没有人拆解的图片,真的找到了,使用的是MT7601UN芯片。
有了上一个腾达的网卡移植经验这次就简单很多。
然后我们下载MT7601U驱动的源码,下载地址在我这篇博客开始的地方。首先把文件解压到linux目录中,
修改驱动源码根目录下的Makefile
#PLATFORM=PC
PLATFORM=SMDK
ifeq ($(PLATFORM),SMDK)
LINUX_SRC = /home/linux/sys/linux-3.0.1/(内核源码路径,内核需要被编译过)
CROSS_COMPILE = /home/linux/sys/arm-gcc-4.3.2/bin/arm-linux-(交叉编译工具链路径)
endif
下面加一行
{USB_DEVICE(0x148f,0x760b)}, /* 360 Wifi2 */
需要修改wpa_supplicant的wpa_supplicant.conf文件,这个文件在开发板的/etc/wpa_supplicant.conf路径下。
这里说一下wpa_supplicant
wpa_supplicant主要是用来支持WEP,WPA/WPA2和WAPI无线协议和加密认证的,由于linux本身并不支持WPA的加密,所以需要移植wpa_supplicant来使wifi能够连接WPA加密的无线路由上,简单的说,wpa_supplicant就是WiFi驱动和用户的中转站外加对协议和加密认证的支持。由于ok6410的3.0.1内核已经移植好了wpa_supplicant的0.7.3版本,所以对于wpa_supplicant的移植这里就不做讲解。
接着说wpa_supplicant.conf文件的内容,这里的问题我也是解决了很久。官方给的例程是这样的
ctrl_interface=/var/run/wpa_supplicant
network={
ssid="max" //填写无线网络的的用户名
key_mgmt=WPA-PSK
proto=WPA
pairwise=TKIP
group=TKIP
psk="1234567890" //填写密码
}
我使用这个模板出现了skip WPA IE - PTK cipher mismatch这个问题,在找到路由之后,提示密码错误,后来查看了路由器发现原来密码也有几种加密方式。TKIP和AES两种,上面的写法就是被固定为TKIP方式,TKIP方式的带宽很低,所以现在都采用的是AES方式加密,在wpa_supplicant中AES加密方式对应的是CCMP,也就是需要把TKIP改为CCMP,这个我没有验证过,我使用的是下面的方法,不声明使用的是哪种加密方式,让wpa_supplicant去自适应。
ctrl_interface=/var/run/wpa_supplicant
update_config=1
network={
ssid="mingzi"
key_mgmt=WPA-PSK
psk="mimamimamima"
}
我使用这个配置成功的连接了AES加密方式 的路由器。
然后我们将驱动加载进内核
insmod mt7601Usta.ko
然后可以使用
wpa_supplicant -ira0 -Dwext -c/etc/wpa_supplicant.conf -dd &
wpa_supplicant -ira0 -Dwext -c/etc/wpa_supplicant.conf &
这两条指令中的任意一个,-dd的会输出更过的信息。
在出现
root@EasyARM-iMX28x /# insmod mt7601Usta.ko rtusb init rt2870 --->usbcore: registered new interface driver rt2870root@EasyARM-iMX28x /# usb 1-1: new high speed USB device using fsl-ehci and address 2usb 1-1: device v148f p760b is not supported===>rt2870_probe()!--> RTMPAllocAdapterBlock=== pAd = c4a44000, size = 841592 ===--> RTMPAllocTxRxRingMemory<-- RTMPAllocTxRxRingMemory, Status=0<-- RTMPAllocAdapterBlock, Status=0NumEndpoints=8BULK IN MaxPacketSize = 512EP address = 0x84BULK IN MaxPacketSize = 512EP address = 0x85BULK OUT MaxPacketSize = 512EP address = 0x 8 BULK OUT MaxPacketSize = 512EP address = 0x 4 BULK OUT MaxPacketSize = 512EP address = 0x 5 BULK OUT MaxPacketSize = 512EP address = 0x 6 BULK OUT MaxPacketSize = 512EP address = 0x 7 BULK OUT MaxPacketSize = 512EP address = 0x 9 RTMP_COM_IoctlHandle():pAd->BulkOutEpAddr=0x8RTMP_COM_IoctlHandle():pAd->BulkOutEpAddr=0x4RTMP_COM_IoctlHandle():pAd->BulkOutEpAddr=0x5RTMP_COM_IoctlHandle():pAd->BulkOutEpAddr=0x6RTMP_COM_IoctlHandle():pAd->BulkOutEpAddr=0x7RTMP_COM_IoctlHandle():pAd->BulkOutEpAddr=0x9STA Driver version-3.0.0.3-->MT7601_Init():Chip specific bbpRegTbSize=0!Chip VCO calibration mode = 0!NVM is EFUSEEfuse Size=0x1d [Range:1e0-1fc] Endpoint(8) is for In-band CommandEndpoint(4) is for WMM0 AC0Endpoint(5) is for WMM0 AC1Endpoint(6) is for WMM0 AC2Endpoint(7) is for WMM0 AC3Endpoint(9) is for WMM1 AC0Endpoint(84) is for Data-InEndpoint(85) is for Command RspAllocate a net device with private data size=0!Allocate net device ops success!The name of the new ra interface is ra0...RtmpOSNetDevAttach()---><---RtmpOSNetDevAttach(), ret=0<===rt2870_probe()!RtmpUSBNullFrameKickOut - Send NULL Frame @24 Mbps...
这时候需要禁用有线网卡eth0。如果使用的是nfs挂载的文件系统建议最后禁用有线网卡,因为一旦禁用就没有文件系统了,开发板就没办法操作了。
ifconfig eth0 down
这时候无线网卡还没有ip,可以使用静态分配的方式
ifconfig ra0 192.168.1.20
如果路由器支持动态分配也可以使用动态分配
udhcpc -i ra0
之后会返回
udhcpc (v1.13.3) started
Sending discover...
Sending select for 192.168.1.104...
Lease of 192.168.1.104 obtained, lease time 7200
deleting routers
route: SIOCDELRT: No such process
adding dns 10.10.0.1
adding dns 124.207.160.106
表示分配IP成功,到这里我们的腾达无线网卡就已经可以正常使用了,想做什么都可以,完全和有线是一样的。
但是在2.6的内核下有一个提示一直打印
RtmpUSBNullFrameKickOut - Send NULL Frame @24 Mbps...
这个需要更改printk的打印等级才能更改,如何更改printk的打印等级可以在我的这篇博客中了解http://blog.csdn.net/andylauren/article/details/51504125
下面是我的终端打印信息
root@EasyARM-iMX28x /# ifconfiglo Link encap:Local Loopback inet addr:127.0.0.1 Mask:255.0.0.0 UP LOOPBACK RUNNING MTU:16436 Metric:1 RX packets:2 errors:0 dropped:0 overruns:0 frame:0 TX packets:2 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:0 RX bytes:272 (272.0 B) TX bytes:272 (272.0 B)ra0 Link encap:Ethernet HWaddr 00:87:46:0E:2B:D7 inet addr:192.168.1.106 Bcast:192.168.1.255 Mask:255.255.255.0 UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:3498 errors:0 dropped:0 overruns:0 frame:0 TX packets:84 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:846648 (826.8 KiB) TX bytes:16798 (16.4 KiB)root@EasyARM-iMX28x /# RtmpUSBNullFrameKickOut - Send NULL Frame @24 Mbps...root@EasyARM-iMX28x /# root@EasyARM-iMX28x /# root@EasyARM-iMX28x /# RtmpUSBNullFrameKickOut - Send NULL Frame @24 Mbps...RtmpUSBNullFrameKickOut - Send NULL Frame @24 Mbps...root@EasyARM-iMX28x /# root@EasyARM-iMX28x /# pRtmpUSBNullFrameKickOut - Send NULL Frame @24 Mbps...ing 192.168.1.1PING 192.168.1.1 (192.168.1.1): 56 data bytes64 bytes from 192.168.1.1: seq=0 ttl=64 time=2.032 ms64 bytes from 192.168.1.1: seq=1 ttl=64 time=1.188 ms64 bytes from 192.168.1.1: seq=2 ttl=64 time=1.156 ms64 bytes from 192.168.1.1: seq=3 ttl=64 time=7.906 ms64 bytes from 192.168.1.1: seq=4 ttl=64 time=2.656 ms64 bytes from 192.168.1.1: seq=5 ttl=64 time=2.125 msRtmpUSBNullFrameKickOut - Send NULL Frame @24 Mbps...64 bytes from 192.168.1.1: seq=6 ttl=64 time=3.375 ms64 bytes from 192.168.1.1: seq=7 ttl=64 time=1.594 ms64 bytes from 192.168.1.1: seq=8 ttl=64 time=1.188 ms64 bytes from 192.168.1.1: seq=9 ttl=64 time=1.125 ms64 bytes from 192.168.1.1: seq=10 ttl=64 time=1.188 ms64 bytes from 192.168.1.1: seq=11 ttl=64 time=1.531 ms64 bytes from 192.168.1.1: seq=12 ttl=64 time=241.937 ms64 bytes from 192.168.1.1: seq=13 ttl=64 time=1.125 ms64 bytes from 192.168.1.1: seq=14 ttl=64 time=1.094 ms64 bytes from 192.168.1.1: seq=15 ttl=64 time=1.156 msRtmpUSBNullFrameKickOut - Send NULL Frame @24 Mbps...64 bytes from 192.168.1.1: seq=16 ttl=64 time=1.156 ms--- 192.168.1.1 ping statistics ---17 packets transmitted, 17 packets received, 0% packet lossround-trip min/avg/max = 1.094/16.090/241.937 ms到这里就结束了,下载再提供一个开机自启动的脚本文件
#!/bin/sh insmod mt7601Usta.ko&&wpa_supplicant -ira0 -Dwext -c/etc/wpa_supplicant.conf &sleep 40&&udhcpc -i ra0&&ifconfig eth0 down这个脚本是在最后才关闭有线网卡,所以即使使用nfs挂载根文件系统也可以。其中有一个sleep 40是等待无线驱动加载和无线网卡连接路由的时间,这个需要根据自己的实际情况去更改。
其他错误解决:
/os/linux/sta_ioctl.c:2225: error: unknown field 'private' specified in initializer
/os/linux/sta_ioctl.c:2226: error: unknown field 'num_private' specified in initializer
/os/linux/sta_ioctl.c:2228: error: unknown field 'num_private_args' specified in initializer
问题原因:是因为在配置内核的时候,没有选择支持802.11的无线设备驱动。
解决办法:重新配置编译指定的Linux Kernel,make menuconfig
Device Drivers --->
[*] Network device support --->
[*] Wireless LAN --->
<*> IEEE 802.11 for Host AP (Prism2/2.5/3 and WEP/TKIP/CCMP)
重新编译内核,并开发板也要重新下载内核,然后驱动也要重新编译,要保持和编译过的kernel移植,包括编译器版本。
- 360WIFI2无线网卡移植 -MT7601U移植
- 360WIFI2无线网卡移植 -MT7601U移植
- Tiny6410移植MT7601U方案的USB无线网卡 (360随身WiFi2代3代)(通过测试,串口数据很少)
- 无线网卡MT7601U驱动的移植
- wifi无线网卡 移植
- 无线网卡移植
- RT3070L无线网卡移植
- A20 android 移植MT7601u
- 360wifi2完美移植ubuntu12.04
- TL_WN321G无线网卡的移植
- 移植usb无线网卡驱动
- mini2440 realtek8188cus 无线网卡移植
- FS210无线网卡驱动移植
- redhat移植rtl8192cu无线网卡
- RT5370_USB无线网卡驱动移植
- FS210无线网卡驱动移植
- FS210无线网卡驱动移植
- zedboard 无线网卡移植问题
- Codeforces 612C Replace To Make Regular Bracket Sequence 【stack】
- UE4 C++示例工程Battery Collector(4.10版本又更名为3rd Person Power-up)
- 玩游戏也是有心得的!——培训的第一天
- 面试题7:用两个栈实现队列(java)
- sigprocmask实例
- 360WIFI2无线网卡移植 -MT7601U移植
- 用表单实现qq注册页面
- Listview很重要
- JQuery选择器
- SAP SM37后台作业结果显示为alv list怎么样可以显示alv grid形式呢?
- CSS设置文字斜体
- KMP算法
- Python语言_思维导图
- 线性表3-双链表