RT3070 STA 驱动移植

原文地址:RT3070 STA 驱动移植 作者:monopoly


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

 

驱动版本: 2011_0107_RT3070_RT3370_Linux_STA_v2.5.0.1_DPO

 

1. 下载RT3070驱动源码
版本: 2011_0107_RT3070_RT3370_Linux_STA_v2.5.0.1_DPO
download: 下载页面

选到 T8070/RT3070/RT3370/RT5370/RT5372 USB  这个然后随便输入名字和邮箱即可下载。

 

2. RT3070驱动修改

解压 tar -zxvf 2011_0107_RT3070_RT3370_Linux_STA_v2.5.0.1_DPO.tar.gz

进入RT3070_Linux_STA目录,看到有一个README_STA_usb文件,里面介绍了如何加载该驱动,先浏览一下

 

2.1 先设好环境变量
export PATH=/opt/hisi-linux/x86-arm/gcc-3.4.3-uClibc-0.9.28/usr/bin:$PATH

 

2.2 makefile修改 (-为去掉设置, +为新加的设置)
#vi makefile

- #PLATFORM = PC
+ PLATFORM = IXP
#(选用的是IXP)

ifeq ($(PLATFORM),IXP)

- LINUX_SRC = /project/stable/Gmtek/snapgear-uclibc/linux-2.6.x
- CROSS_COMPILE = arm-linux-
+ LINUX_SRC = /xxx/kernel/linux-2.6.14
+ CROSS_COMPILE = arm-hismall-linux-
endif


2.3 /os/linux/config.mk修改
#cd /os/linux/
#vi config.mk

# Support Wpa_Supplicant
- HAS_WPA_SUPPLICANT=n
+ HAS_WPA_SUPPLICANT=y

# Support Native WpaSupplicant for Network Maganger
- HAS_NATIVE_WPA_SUPPLICANT_SUPPORT=n
+ HAS_NATIVE_WPA_SUPPLICANT_SUPPORT=y

ifeq ($(PLATFORM),IXP)
- WFLAGS += -DRT_BIG_ENDIAN
#加这个选项,模块运行时显示出错,CPU不能工作
endif

ifeq ($(PLATFORM),IXP)

 - CFLAGS := -v -D__KERNEL__ -DMODULE -I$(LINUX_SRC)/include -I$(RT28xx_DIR)/include -mbig-endian -Wall -Wstrict-prototypes -Wno-trigraphs -O2 -fno-strict-aliasing -fno-common -Uarm -fno-common -pipe -mapcs-32 -D__LINUX_ARM_ARCH__=5 -mcpu=xscale -mtune=xscale -malignment-traps -msoft-float $(WFLAGS)
        - EXTRA_CFLAGS := -v $(WFLAGS) -I$(RT28xx_DIR)/include -mbig-endian
 + EXTRA_CFLAGS := -v $(WFLAGS) -I$(RT28xx_DIR)/include
 export CFLAGS       
endif

 

3、  编译源码
make通过,在2011_0107_RT3070_RT3370_Linux_STA_v2.5.0.1_DPO/os/linux目录下生成了rt3070sta.ko,也就是RT3070的驱动了

 

4.   拷贝驱动到目标系统
把RT2870STA.dat拷贝到/etc/Wireless/RT2870STA目录下
把rt3070sta.ko拷贝到/xxx/ 目录下 xxx自定


 

5. 加载驱动模块
insmod /xxx/rt3070sta.ko

出现以下错误
rt3070sta: Unknown symbol usb_alloc_urb
rt3070sta: Unknown symbol usb_free_urb
rt3070sta: Unknown symbol usb_register
rt3070sta: Unknown symbol usb_put_dev
rt3070sta: Unknown symbol usb_get_dev
rt3070sta: Unknown symbol usb_submit_urb
rt3070sta: Unknown symbol usb_control_msg
rt3070sta: Unknown symbol usb_deregister
rt3070sta: Unknown symbol usb_kill_urb
rt3070sta: Unknown symbol usb_buffer_free
rt3070sta: Unknown symbol usb_buffer_alloc
insmod: cannot insert `rt3070sta.ko': Unknown symbol in module (-1): No such file or directory

原因未加载USB驱动

 

5.1 加载usbcore.ko
insmod /lib/modules/2.6.14-hi3511v100dmeb-release/kernel/drivers/usb/core/usbcore.ko

显示
usbcore: registered new driver usbfs
usbcore: registered new driver hub

加载成功

 

5.2.1 如果为USB1.1 加载hi3511_usb_1-1.ko

insmod /lib/modules/2.6.14-hi3511v100dmeb-release/misc/hi3511_usb_1-1.ko

显示
USB1_1-M0001C030002 @Hi3511v110_OSDrv_1_0_0_1 2008-11-03 18:35:15
Clock to USB host has been enabled
hisilicon-ohci hisilicon-ohci.0: hisilicon OHCI
hisilicon-ohci hisilicon-ohci.0: new USB bus registered, assigned bus number 1
hisilicon-ohci hisilicon-ohci.0: irq 20, io mem 0xa0000000
hub 1-0:1.0: USB hub found
hub 1-0:1.0: 2 ports detected
usb 1-1: new full speed USB device using hisilicon-ohci and address 2

加载成功

 

5.2.2 如果为USB2.0 加载hiusb.ko

insmod /lib/modules/2.6.14-hi3511v100dmeb-release/misc/hiusb.ko

显示
<6>hiusb-hcd hiusb-hcd.0: Hisilicon USB host controller
hiusb-hcd hiusb-hcd.0: new USB bus registered, assigned bus number 1
hiusb-hcd hiusb-hcd.0: irq 23, io base 0x80090000
hub 1-0:1.0: USB hub found
hub 1-0:1.0: 1 port detected

加载成功

 

5.3 然后再加载rt3070sta.ko
insmod /xxx/rt3070sta.ko
显示
rtusb init rt2870 --->

=== pAd = d1af4000, size = 514424 ===

<-- RTMPAllocTxRxRingMemory, Status=0
<-- RTMPAllocAdapterBlock, Status=0
usbcore: registered new driver rt2870

加载成功

#ifconfig -a 可以查看到ra0设备的存在

若无密码或密码为WEP加密,则此时可以启动无线, 若密码为WPA加密,则需移植wpa_supplicant,往后再说移植

 

6.无密码或密码为WEP加密:
6.1 启动无线
#ifconfig ra0 up  
(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

启动成功

 

6.2 设置ip
#ifconfig ra0 192.168.1.230 netmask 255.255.255.0

 

6.3 扫描无线网络
#iwlist ra0 scan
===>rt_ioctl_giwscan. 9(9) BSS returned, data->length = 1476
ra0       Scan completed :
          Cell 01 - Address: F0:7D:68:96:A6:C2
                    Protocol:802.11b/g/n
                    ESSID:"dlinktf"
                    Mode:Managed
                    Frequency:2.412 GHz (Channel 1)
                    Quality=18/100  Signal level=-83 dBm  Noise level=-92 dBm
                    Encryption key:on
                    Bit Rates:54 Mb/s
          Cell 02 - Address: F4:EC:38:55:AF:BC
                    Protocol:802.11b/g/n
                    ESSID:"visview"
                    Mode:Managed
                    Frequency:2.427 GHz (Channel 4)
                    Quality=18/100  Signal level=-83 dBm  Noise level=-91 dBm
                    Encryption key:off
                    Bit Rates:54 Mb/s

显示以上信息说明模块已经正常工作

 

6.4 设置SSID和WEP加密算法
可以参考里面的iwpriv_usage.txt进行配置,


6.4.1 无密码
Config STA to link with AP which is OPEN/NONE(Authentication/Encryption)
1. iwpriv ra0 set NetworkType=Infra
2. iwpriv ra0 set AuthMode=OPEN
3. iwpriv ra0 set EncrypType=NONE
4. iwpriv ra0 set SSID="AP's SSID"

 

6.4.2 WEP加密算法
iwpriv ra0 set NetworkType=Infra
iwpriv ra0 set AuthMode=SHARED
iwpriv ra0 set EncrypType=WEP
iwpriv ra0 set DefaultKeyID=1
iwpriv ra0 set Key1="AP's wep key"
iwpriv ra0 set SSID="AP's SSID"

设置完一会,等网络连接好就可以了。

你可能感兴趣的:(驱动,LINUX)