在线问答
直播中

L490351555

9年用户 112经验值
擅长:可编程逻辑 嵌入式技术
私信 关注

【OK210试用体验】之第九篇:编译适合ARM平台的RT3070网卡驱动

本帖最后由 L490351555 于 2015-10-14 18:13 编辑

1. 下载RT3070驱动源码版本:
2011_0107_RT3070_RT3370_Linux_STA_v2.5.0.1_DPO
2. RT3070驱动修改
解压 #tar -zxvf 2011_0107_RT3070_RT3370_Linux_STA_v2.5.0.1_DPO.tar.gz
进入RT3070_Linux_STA目录,看到有一个README_STA_u***文件,里面介绍了如何加载该驱动,先浏览一下

   2.1 先设好环境变量
export PATH=/usr/local/arm/arm-2007q1/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 =  /home/rpf413/at91/linux/linux-2.6.30
+ CROSS_COMPILE =  /usr/local/arm/arm-2007q1/bin/arm-none-linux-gnueabi-
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
出现以下错误
insmod: error inserting 'rt3070sta.ko': -1 Unknown symbol in module
rt3070sta: Unknown symbol u***_alloc_urb
rt3070sta: Unknown symbol u***_free_urb
rt3070sta: Unknown symbol u***_register
rt3070sta: Unknown symbol u***_put_dev
rt3070sta: Unknown symbol u***_get_dev
rt3070sta: Unknown symbol u***_submit_urb
rt3070sta: Unknown symbol u***_control_msg
rt3070sta: Unknown symbol u***_deregister
rt3070sta: Unknown symbol u***_kill_urb
rt3070sta: Unknown symbol u***_buffer_free
rt3070sta: Unknown symbol u***_buffer_alloc
insmod: cannot insert `rt3070sta.ko': Unknown symbol in module (-1): No such file or directory
原因未加载USB驱动
请修改UTIL/os/linux/u***_main_dev.c文件,在文件的开头加上如下一行程序:
MODULE_LICENSE(“GPL”)
重新编译:
Make ARCH=arm CROSS_COMPILE=/usr/local/arm/arm-2007q1/bin/arm-none-linux-gnueabi-
  
然后再加载rt3070sta.ko
手动添加:/etc/Wireless/RT2870STA/RT2870STA.dat
insmod /xxx/rt3070sta.ko显示
rtu*** init rt2870 --->
=== pAd = d1af4000, size = 514424 ===
<-- RTMPAllocTxRxRingMemory, Status=0
<-- RTMPAllocAdapterBlock, Status=0
u***core: registered new driver rt2870
加载成功
#ifconfig -a 可以查看到ra0设备的存在
若无密码或密码为WEP加密,则此时可以启动无线, 若密码为WPA加密,则需移植wpa_supplicant。


更多回帖

发帖
×
20
完善资料,
赚取积分