rt3070sta GNU / Linux 64 bit driver working

来源:互联网 发布:知乎怎么对用户提问 编辑:程序博客网 时间:2024/06/10 03:30


rt3070sta GNU / Linux 64 bit driver working(转)

原帖是西班牙文,使用google翻译过来的
原帖地址:http://7grados.injiniero.es/2014/03/19/rt3070sta-gnulinux-64-bits-working-driver/


Recently decided to upgrade the hardware of my main personal computer, so the old plate, ASUS P5E WS Pro with 4GB of RAM, and the microprocessor, Intel Core 2 Duo E8400 3GHz , the auxiliary has inherited my old computer which until now looked with great dignity an AMD Duron 1.3 GHz , with 1 GB of RAM-. Well, that machine I have it connected to the network with a USB Wi-Fi adapter, the Alfa Network Adapter Ralink 11n USB WiFi 5dBi 2W , bearing the chipset RT3070Ralink. With the driver UBUNTU leading 64 bits, the rt2800usb , the connection is achieved is very poor and unstable, when this chip is capable of much more, especially in N mode connected to the AP. In its day, the driver got off the chip RT3070 for GNU / Linux from Ralink's website (now Mediatek:http://www.mediatek.com/en/downloads/ ), was the version 2.5.0.3 (it is now 2.6.1.3 dated 22.10.2012 but then you talk about it). After adjusting some things in the configuration files, compiled for 32 - bit and worked the first time The connection was 150 Mbps (300 if using two channels) and very stable.

By changing the micro to a 64-bit, I had to recompile the driver. I install it and ... it works! :-)

I do some connection tests from the command line and everything goes well (apparently). I open the browser, a page charge ... lights scroll-lock and caps-lock start flashing while the system stops responding. It's a kernel panic! OMG!At first I thought it might be a hardware problem having the machine completely assembled recently. But no, then I discovered it was Ralink driver who caused the kernel panic.

alpha-network AWUS036NHResearching the problem, I came to this page from a Fedora forum:http://forums.fedoraforum.org/showthread.php?t=287273 , it is spoken of the same problem but different hardware. In that post he speaks of another thread in ubuntuforums: http://ubuntuforums.org/showthread.php?t=2092888 that gives us the final clue to solve the problem: The driver programmers have not taken into account that the structure sk_buff is defined differently in the 32 - bit architecture in 64 bits. Which can be seen in the file skbuff.h of our machine:

326
327
328
329
330
331
332
333
334
#if BITS_PER_LONG> 32
#define NET_SKBUFF_DATA_USES_OFFSET 1
#endif
 
#ifdef NET_SKBUFF_DATA_USES_OFFSET
typedefunsignedintsk_buff_data_t;
#else
typedefunsignedchar* sk_buff_data_t;
#endif

Something should at least warn the driver documentation.

As shown in this post, you have to make some changes in that structure macros that manage to make it work.

Here you can see the changes I've made in the original code that version of the driver, to solve the above problem, also I have eliminated 99% of the warnings of compilación-, and at the end of the article have a link to download and modified .

File include / os / rt_linux.h

870
871
872
873
874
875
876
#define GET_OS_PKT_DATATAIL (_pkt) \
    (Skb_tail_pointer (RTPKT_TO_OSPKT (_pkt)))
    / * (RTPKT_TO_OSPKT (_pkt) -> tail) * /
#define SET_OS_PKT_DATATAIL (_pkt, _start, _len) \
    (Skb_set_tail_pointer (RTPKT_TO_OSPKT (_pkt), \
     (Int) ((_ start) - GET_OS_PKT_DATAPTR (_pkt)) + (_len)))
    / * ((RTPKT_TO_OSPKT (_pkt)) -> tail) = (PUCHAR) ((_ start) + (_len)) * /

Macros which I spoke and managing reading and writing element tail . 
Also for the element end .

881
882
883
#define GET_OS_PKT_END (_pkt) \
  (Skb_end_pointer (RTPKT_TO_OSPKT (_pkt)))
    / * (RTPKT_TO_OSPKT (_pkt) -> end) * /

File os / linux / rt_linux.c

498
499
5 o'clock
501
502
/ * NdisMoveMemory (skb-> tail, pHeader802_3, HdrLen); * /
NdisMoveMemory (GET_OS_PKT_DATATAIL (SKB), pHeader802_3, HdrLen);
skb_put (SKB, HdrLen);
/ * NdisMoveMemory (skb-> tail, pData, DataSize); * /
NdisMoveMemory (GET_OS_PKT_DATATAIL (SKB), pData, DataSize);
654
655
SET_OS_PKT_DATATAIL (pClonedPkt, pClonedPkt-> data, pClonedPkt-> len);
/ * PClonedPkt-> tail = pClonedPkt-> data + pClonedPkt-> len; * /
700
701
702
pOSPkt-> len = ( UINT) DataSize;
SET_OS_PKT_DATATAIL (pOSPkt, pOSPkt-> data, pOSPkt-> len);
/ * POSPkt-> tail = pOSPkt-> data + pOSPkt-> len; * /

file Makefile

eleven
12
13
ifeq ($ (CHIPSET))
  CHIPSET = 3070
endif

To identify our chip.

388
389
Echo"is not necessary"
#cp -f $ (RT28xx_DIR) / os / linux / rt $ (CHIPSET) sta.ko / tftpboot

Unnecessary on a PC.

File chips / rtmp_chip.c

233
VOIDRT30xx_Init (IN PRTMP_ADAPTER pAd);
471
;// RT33xx_Init (PAD);

This fix solves a fatal compilation error that has nothing to do with the problem mentioned in this article but it is necessary.

File common / cmm_wpa.c

2456
WPA_MIX_PAIR_CIPHER FlexibleCipher = WPA_TKIPAES_WPA2_TKIPAES;  / * Provide the more flexibility it cipher combination in WPA-WPA2 and TKIPAES mode * /

Another necessary change if you use WPA or WPA2.

File include / rtmp_def.h

1476
1477
#define INF_MAIN_DEV_NAME "wlan"
#define INF_MBSSID_DEV_NAME "wlan"

This change is optional. What it does is change the name of the adapter (I prefer to be called wlan0 that RA0, matter of taste).

File os / linux / config.mk

55
56
# Support wpa_supplicant
HAS_WPA_SUPPLICANT = y
59
60
# Support for Native wpasupplicant Network Maganger
HAS_NATIVE_WPA_SUPPLICANT_SUPPORT = y

These changes need to be done if you use WPA or WPA2.

It will also have to adapt the file RT2870STA.dat to our needs.

Following these changes, the driver can be compiled with the command:

cd/ directory-of-driver
makeclean
make

E install with the command:

sudomakeinstall

In order for the driver to load automatically when you boot the machine, youhave to put on the blacklist the driver that comes with UBUNTU. Simply edit the file /etc/modprobe.d/balcklist.conf and add at the end:

# rt2800usb
rt2800usb blacklist
rt2870sta blacklist
rt2800lib blacklist
rt2x00usb blacklist
rt2x00lib blacklist

If we add support for DKMS , follow these steps:

Assuming we have the driver source code /home/usuario/drivers/rt3070sta-2.5.0.3, create a symbolic link to that directory in / usr / src like this :

cd/ usr / src
sudoln-s/ home / user / drivers / rt3070sta-2 .5.0.3 rt3070sta-2.5.0.3

In the root directory of the source code for the driver files must exist: copia-dat.sh and dkms.conf . 
The first is the script that runs after installing the driver and what it does is copy the file RT2870STA.dat to / etc / Wireless / RT2870STA (creating directories if not exist). 
the second is the configuration file for the DKMS .

To install the driver at our core, we execute the command:

sudodkmsinstallrt3070sta/ 2 .5.0.3

Both files you will find in the attached file and can modify them according to your needs.

I also downloaded the latest version of the driver, the 2.6.1.3, but although he also made changes I have described here, I have not gotten it to work. The driver compiles without errors, good load, but does not activate the wlan0 interface. I have not figured out the problem ... someday. :-)

download driver:2011_0719_RT3070_RT3370_RT5370_RT5372_Linux_STA_V2.5.0.3_DPO_ubuntu_12_04_x86_64_working.tar.bz2

0 0
原创粉丝点击