一、开发环境介绍:
1.板子的情况:SEED_DV357 v1.1,CPU是TI的Davinci DM357(ARM9),合众达(Seed)做的开发板,SDK是DVSDK_v1.20,Linux 版本:Montavista Linux pro 4.0,内核版本:2.6.10。
2.无线网卡:镭凌(RaLink)的RT2070,b/g,54M,驱动兼容RT3070,在镭凌的官网上可以下载到最新驱程源码:。
二、编译:
1.按照README_STA_usb中的说明,修改Makefile文件:
PLATFORM = 5VT (我看完全部的配置,好像只有这个和我的开发环境比较相近)
LINUX_SRC = /opt/mv_pro_4.0/montavista/pro/devkit/lsp/ti-davinci
CROSS_COMPILE = /opt/mv_pro_4.0/montavista/pro/devkit/arm/v5t_le/bin/arm_v5t_le-
2.改os/linux/config.mk
设置WPA,暂时设为:
'HAS_WPA_SUPPLICANT=y' and 'HAS_NATIVE_WPA_SUPPLICANT_SUPPORT=n'.
设置CC,LD :
CC := $(CROSS_COMPILE)gcc
LD := $(CROSS_COMPILE)ld
由于Montavista的gcc的版本是3.4.3,所以要使用 #GCC v4.0 and below 这一行下面的WFLAGS设置。
因为不是5VT平台,所以要把WFLAGS += -DCONFIG_5VT_ENHANCE去掉
CFLAGS设置:编译时出现错误:
cc1: error: unrecognized command line option "-Wno-pointer-sign"
把这个选项去掉,编译成功!
3.复制.dat文件到/etc/目录:
README上说是把RT2870STA.dat 复制到 /etc/Wireless/RT2870STA/RT2870STA.dat,
三、驱动加载:
1.一个非常低级的错误:USB主从设置!
原来这块开发板是可以用跳线设置USB的主从模式选择的,而且我刚好设置成了从模式。所以,usb插入和拔出总是没有反应(正常情况,应该在插入网卡的时候会出现类似这样的提示:usb 1-1: new high speed USB device using musb_hdrc and address 2)。
2.主从问题解决之后,插入网卡,安装编译好的驱动:
insmod rt3070sta.ko
天啊!出现无数的错误信息!
rtusb init --->
=== pAd = c2068000, size = 467040 ===
<-- RTMPAllocAdapterBlock, Status=0
#
RTUSB_VendorRequest failed(-19),TxFlags=0x0, ReqType=IN, Req=0x7, Index=0x1000
#
RTUSB_VendorRequest failed(-19),TxFlags=0x0, ReqType=IN, Req=0x7, Index=0x1000
#
......
#
RTUSB_VendorRequest failed(-19),TxFlags=0x0, ReqType=IN, Req=0x7, Index=0x1000
Unable to handle kernel NULL pointer dereference at virtual address 00000001
pgd = c06e4000
[00000001] *pgd=80f50031, *pte=00000000, *ppte=00000000
Internal error: Oops: 801 [#1]
Modules linked in: rt3070sta
CPU: 0
PC is at device_bind_driver+0x34/0x64
LR is at driver_probe_device+0x6c/0x74
pc : [] lr : [] Not tainted
sp : c0721ed8 ip : c0721ef0 fp : c0721eec
r10: 00000000 r9 : c0720000 r8 : 00000000
r7 : c02e52bc r6 : c02e5364 r5 : c1be0f1c r4 : c1be0ef8
r3 : c2068048 r2 : c1be0f08 r1 : c1be0f1c r0 : 00000001
Flags: nZCv IRQs on FIQs on Mode SVC_32 Segment user
Control: 5317F Table: 806E4000 DAC: 00000015
Process insmod (pid: 1077, stack limit = 0xc07201a0)
Stack: (0xc0721ed8 to 0xc0722000)
1ec0: bf09238c c1be0ef8
1ee0: c0721f04 c0721ef0 c01898fc c018983c c1be0f00 bf09238c c0721f24 c0721f08
1f00: c01899fc c01898a0 c01468a4 c02e5308 c02b577c bf09238c c0721f4c c0721f28
1f20: c0189cf4 c01899b4 bf09236c c02b577c c0720000 c02b576c 00000000 00000002
1f40: c0721f64 c0721f50 c01c4bd4 c0189c8c bf094760 c02b577c c0721f74 c0721f68
1f60: bf09701c c01c4b8c c0721fa4 c0721f78 c005dd0c bf097010 c0721fa4 00008ea4
1f80: 4012c008 00000003 00000080 c002d154 c0720000 00900080 00000000 c0721fa8
1fa0: c002c9c0 c005db4c 00008ea4 4012c008 4012c008 000be224 00012008 00080000
1fc0: 00008ea4 4012c008 00000003 befffcac 00100000 00000000 00012008 00000000
1fe0: 400cf470 befffc9c 00008d60 400cf47c 60000010 4012c008 ffffffff ffffffff
Backtrace:
[] (device_bind_driver+0x0/0x64) from [] (driver_probe_device+0x6c/0x74)
r5 = C1BE0EF8 r4 = BF09238C
[] (driver_probe_device+0x0/0x74) from [] (driver_attach+0x58/0x94)
r5 = BF09238C r4 = C1BE0F00
[] (driver_attach+0x0/0x94) from [] (bus_add_driver+0x78/0x120)
r6 = BF09238C r5 = C02B577C r4 = C02E5308
[] (bus_add_driver+0x0/0x120) from [] (usb_register+0x58/0xc4)
[] (usb_register+0x0/0xc4) from [] (init_module+0x1c/0x28 [rt3070sta])
r5 = C02B577C r4 = BF094760
[] (init_module+0x0/0x28 [rt3070sta]) from [] (sys_init_module+0x1d0/0x3dc)
[] (sys_init_module+0x0/0x3dc) from [] (ret_fast_syscall+0x0/0x2c)
Code: e2845024 e1a01005 e5843010 e5820004 (e5802000)
仔细一看,原来是一个Oops错误,看到:Unable to handle kernel NULL pointer dereference at ... ,应该是空指针引用吧。原厂驱动,应该不会有这样的事情啊,估计可能是GCC编译选项的问题,把CFLAGS中的-mabi=apcs-gnu去掉,再试,终于能够成功加载了!(为什么要去掉才行啊?难道是源代码不支持APCS的函数调用格式?但是这是Makefile原本就有的选项啊?奇怪!)
安装驱动后出现:
#insmod rt3070sta.ko
rtusb init --->
=== pAd = c2068000, size = 465408 ===
<-- RTMPAllockAdapterBlock, Status=0
usbcore: registered new driver rt2870
但是,当我执行ifconfig ra0 up时,错误再次出现:
<-- ERROR in Alloc TX TxContext[0] HTTX_BUFFER !!
<-- RTMPAllocTxRxRingMemory, Status=3
Error!!! RTMPAllocDMAMemory failed, Status[=0x00000003]
!!! rt28xx Intialized fail !!!
SIOCSIFFLAGS: Operation not permitted
寻求RaLink技术支持中......
也请高手指点一二,谢谢!
阅读(7793) | 评论(13) | 转发(1) |