驱动源码:DPO_RT5572_LinuxSTA_2.6.1.3_20121022

直接接入板子,安装驱动之后生成的节点名称叫ra0

对应修改hostapd配置文件,重启服务,提示failed

参考文章

1)http://forum.armbian.com/index.php/topic/157-add-wifi-driver-ralink-rt5572-rt2800usb/

2)http://elinux.org/RPi_USB_Wi-Fi_Adapters

·        RT5572 USB ID 148f:5572 nativedriver available in Kernel 3.10.36+ (rt2800usb). For earlier kernel versions:under Raspbian, OpenELEC, raspbmc (neither under x86 Linux) for the Ralink 5572chipset but works using Ralink drivers (requiring compilation - guidance, requires source for the running kernel) including withwpa_supplicant. Supports dual band 2.4GHz/5GHz. No need for firmwareinstallation. Needs a powered hub.

A20内核版本是3.4.79,因此断定原因是A20内核驱动rt2800usb不支持rt5572

需要用到文章1)中提到的backport,即

hi,

 

only for info:

TheDPO_RT5572_LinuxSTA_2.6.1.3_20121022.tar.gz / rt5572sta.ko-stuff does not work with sunxi-3.4.10x-kernel.

 

 

I got this "ralink rt5572" onkernel 3.4.10x to work with driver backports:

echo "see:https://backports.wi....php/Main_Page"

wget https://www.kernel.o....11.8-1.tar.bz2

tar xvf backports-3.12.8-1.tar.xz

cd backports-3.12.8-1

make defconfig-wifi

time make -J2

echo "BACKUP YOUR old 3.4.10x-modulesin /lib/modules/3.4.10xy /lib/modules/3.4.10xy_backup to  if you want toswitch back...ok?"

read

make install

reboot

 

...............................................................................................

root@Dev:~# modinfo rt2800usb | grep"version\|5572"
version:        backported from Linux(v3.12.8-0-g97f15f1) using backports v3.12.8-1-0-geb41fad
version:        2.3.0
srcversion:     D0035750636933A8C0E52C5
alias:         usb:v148Fp5572d*dc*dsc*dp*ic*isc*ip*
vermagic:       3.4.108schaschr1+ SMP preemptmod_unload modversions ARMv7 p2v8
 

 

regards

 

本人使用backports-3.11.8-1.tar.bz2

需要修改Makefile:

#KLIB := /lib/modules/$(shell uname -r)/

KLIB:=/opt/kaifaban/A20_SDK2015/linux-sdk-card/output/cb2/cb2-cubieez/card0-rootfs/lib/modules/3.4.79/

KLIB 表示内核模块目录

cd backports-3.11.8-1

make defconfig-wifi

make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf-

参考文章3

http://stackoverflow.com/questions/31213910/build-a-linux-kernel-module-from-a-source-tree

 

按照如下顺序安装驱动:

insmod compat.ko

insmod lib80211.ko

insmod cfg80211.ko(注意1

insmod mac80211.ko

insmod rt2x00lib.ko

insmod rt2x00usb.ko

insmod rt2800lib.ko

insmod rt2800usb.ko

(以上ko都来自backports)

insmod rt5572sta.ko(来自DPO_RT5572_LinuxSTA_2.6.1.3_20121022)

 

此时ifconfig查看生成的节点名是wlan0,恢复hostpad配置文件

 

重启hostapd服务时,如果出如下打印

<4>ieee80211 phy0:rt2800usb_entry_txstatus_timeout: Warning - TX status timeout for entry 0 inqueue 0

ieee80211 phy0:rt2800usb_entry_txstatus_timeout: Warning - TX status timeout for entry 0 inqueue 0

请检查是否使用2A电源

20161117更新,后续测试发现,正常运行时,也会出现以上打印,怀疑和网卡驱动有关,出现如上打印时,严重影响网络传输性能。

参考链接:https://dev.openwrt.org/ticket/13523#no2

https://bugzilla.redhat.com/show_bug.cgi?id=913631

https://bugzilla.kernel.org/show_bug.cgi?id=62781

 

进行如下修改测试:


Diffstat

-rw-r--r--

drivers/net/wireless/rt2x00/rt2800usb.c

12

1files changed, 8 insertions, 4 deletions

diff --git a/drivers/net/wireless/rt2x00/rt2800usb.c b/drivers/net/wireless/rt2x00/rt2800usb.c
index 96961b9..4feb35a 100644
--- a/
drivers/net/wireless/rt2x00/rt2800usb.c
+++ b/
drivers/net/wireless/rt2x00/rt2800usb.c

@@ -148,6 +148,8 @@ static bool rt2800usb_txstatus_timeout(struct rt2x00_dev *rt2x00dev)

    return false;

 }

 

+#define TXSTATUS_READ_INTERVAL 1000000

+

 static bool rt2800usb_tx_sta_fifo_read_completed(struct rt2x00_dev *rt2x00dev,

                         int urb_status, u32 tx_status)

 {

@@ -176,8 +178,9 @@ static bool rt2800usb_tx_sta_fifo_read_completed(struct rt2x00_dev *rt2x00dev,

        queue_work(rt2x00dev->workqueue, &rt2x00dev->txdone_work);

 

    if (rt2800usb_txstatus_pending(rt2x00dev)) {

-       /* Read register after 250 us */

-       hrtimer_start(&rt2x00dev->txstatus_timer, ktime_set(0, 250000),

+       /* Read register after 1 ms */

+       hrtimer_start(&rt2x00dev->txstatus_timer,

+                 ktime_set(0, TXSTATUS_READ_INTERVAL),

                  HRTIMER_MODE_REL);

        return false;

    }

@@ -202,8 +205,9 @@ static void rt2800usb_async_read_tx_status(struct rt2x00_dev *rt2x00dev)

    if (test_and_set_bit(TX_STATUS_READING, &rt2x00dev->flags))

        return;

 

-   /* Read TX_STA_FIFO register after 500 us */

-   hrtimer_start(&rt2x00dev->txstatus_timer, ktime_set(0, 500000),

+   /* Read TX_STA_FIFO register after 2 ms */

+   hrtimer_start(&rt2x00dev->txstatus_timer,

+             ktime_set(0, 2*TXSTATUS_READ_INTERVAL),

              HRTIMER_MODE_REL);

 }

 

 

注意1

cfg80211.ko确定使用的是backports的,需要重新配置a20内核和将自带的cfg80211驱动配置成模块方式(默认是builtin),因为这里需要使用backports生成的ko

方法是修改内核源码目录net/wireless/Kconfig

config CFG80211

         tristate"cfg80211 - wireless configuration API"

+       depends on m

         dependson RFKILL || !RFKILL

<3>cfg80211: exports duplicate symbol__ieee80211_get_channel (owned by kernel)

cfg80211: exports duplicate symbol__ieee80211_get_channel (owned by kernel)

将编译生成的ko集成到文件系统

cd /media/usrtest/softap/backport3.11(此处为虚拟机挂载到开发板的目录)

mkdir /lib/modules/3.4.79/kernel/compat

cp compat.ko/lib/modules/3.4.79/kernel/compat/

mkdir backup

cp/lib/modules/3.4.79/kernel/net/wireless/lib80211.ko backup/

cp lib80211.ko  /lib/modules/3.4.79/kernel/net/wireless/

cp cfg80211.ko/lib/modules/3.4.79/kernel/net/wireless/

cp/lib/modules/3.4.79/kernel/net/mac80211/mac80211.ko backup/ 

cp mac80211.ko/lib/modules/3.4.79/kernel/net/mac80211/

cp/lib/modules/3.4.79/kernel/drivers/net/wireless/rt2x00/ backup/ -r

cp rt2x00/*/lib/modules/3.4.79/kernel/drivers/net/wireless/rt2x00/

cp rt5572sta.ko/lib/modules/3.4.79/kernel/drivers/net/wireless/rtxx7x/

cd /lib/modules/3.4.79/

depmod -a

此时的3.4.79整个目录下的内容就可以直接拷贝到文件系统对应目录下了

经测试,最后通过SDK编译生成的镜像同时支持RT3070和RT5572

 

附图:Ubuntu 内核版本3.16.0-23-generic的menuconfig可以和A20的对比

 

 

 

问题解决:

rt5572sta: version magic '3.4.79 mod_unloadmodversions ARMv5 p2v8 ' should be '3.4.79 SMP preempt mod_unload ARMv7 p2v8

解决:

重新制定内核源码路径

Logo

更多推荐