# HOWTO: Install an RT73 based wifi network card using rt2x00

## fatshady

I had big problems getting this sorted so I'm writing this to help anyone else... I did this using a D-Link DWL-122G H/W Version C1.

The irony of this is, you need a working network card to do this (or to put everything on a CD before you start).

I. Update kernel

Ensure you are running kernel version 2.6.17 as a minimum.

The next job is to turn on the relevent parts of the kernel:

```
# nano /usr/src/linux/.config 
```

Within the file use ctrl+w to search for the following items, and make sure they are on, ie no # at the start of the line.

```
CONFIG_NET_RADIO=y

CONFIG_USB=y

CONFIG_FW_LOADER=y

CONFIG_CRYPTO=y

CONFIG_CRYPTO_AES=y

CONFIG_CRYPTO_AES_586=y (Only for x86, for x86-64 this will be CONFIG_CRYPTO_AES_X86-64=y)

CONFIG_CRYPTO_ARC4=y
```

Then recompile and install your kernel:

```
# mount /boot

# cd /usr/src/linux

# make && make modules_install

# cp arch/[$ARCH]/boot/bzImage /boot/[$KERNELNAME]
```

II. Installing rt2x00 software

Now to install rt2x00 for the drivers. They are masked, as they are beta development so we need to unmask them.

```
# nano /etc/portage/package.keywords
```

Add a line that says:

```
net-wireless/rt2x00
```

Now they are unmasked we can emerge them. We also need to emerge hotplug, as although this is not a requirement in portage it is a requirement of the package from the developer.

```
# emerge hotplug rt2x00
```

When that is finished add hotplug to start automatically when linux starts:

```
# rc-update add hotplug default
```

III. Setting up rt2x00

To install the device properly we need to use the firmware for it - this is called rt73.bin

This needs to be put in the firmware directory. This is not in the file structure we we need to make it:

```

# cd /

# mkdir /lib/firmware
```

Now to download the firmware. It might be on the disc for your device. For the D-link device I had to download the linux information from ralink website.

This I got from http://www.ralinktech.com/supp-1.htm and then clicking on the RT2571W/RT2671 USB link. Download the file, untar it and copy the firmware:

```
# wget http://www.ralinktech.com/drivers/Linux/RT73_Linux_STA_Drv1.0.3.6.tar.gz

# tar -zxvf RT73_Linux_STA_Drv1.0.3.6.tar.gz

# cp RT73_Linux_STA_Drv1.0.3.6/Module/rt73.bin /lib/firmware/
```

IV. Getting the interface up and running

Now to load the modules - this can be a problem as modprobe doesn't load all of the modules if you try:

```
# modprobe rt73usb
```

You need to laod all the modules individually in the correct order:

```
# modprobe 80211

# modprobe rate_control

# modprobe crc-itu-t

# modprobe rt73usb
```

The light should now be on on the wireless adapter. You can now set up using this article from the Gentoo-Wiki - http://gentoo-wiki.com/HOWTO_Wireless_Configuration_and_Startup

To set the modules to load automatically when you start Gentoo place the module names in the order in the autoload file:

```
# nano /etc/modules.autoload.d/kernel-2.6
```

Insert: 

```
80211

rate_control

crc-itu-t

rt73usb
```

And close the file. To make the adapter start, create a link from /etc/init.d/net.lo 

```
# ln -s /etc/init.d/net.lo /etc/init.d/wlan0

# rc-update add net.wlan0 default
```

V. Debugging

This is basic debugging for the problems I had

If you get errors stating:

```
wmaster0: Failed to select ratecontrol algorithm

wmasetr0: Failed to initialise rate control algorithm

rt73usb: Failed to initialise device

rt73usb: Failed to allocate device 
```

 in you log files, this is because the rate_control module has not loaded.

Please give me feedback or point out any errors, but I think this is how I made it work.

[EDIT] There are some issues with the driver which means it is not working, and timing out when trying to contact the AP...

----------

## jimmy09

Hi fatshady, I tried using your method. When i went to start the device the light went on, but it just froze. Do you remember having a similar problem? If so how did you fix it? 

Thanks, Jimmy

----------

## fatshady

Hi Jimmy,

I haven't has the problem... What exectly do you mean by freeze? When I bring the interface up, the link light comes on, and the act light flashes quickly at random times?

I presume you don't have any of the interfaces? Which card are you running?

Cheers

Dan

----------

## jimmy09

Hi again, well i tried to do /etc/init.d/wlan0 start, and it just sat there. The link light does come on, but no activity. So I thought I might have to restart, but on booting it timed out trying to start the device. I have got it going with the rt73 driver from ralinktech, but since I did an --update --deep world I haven't been able to start it at boot using rc. (See my post https://forums.gentoo.org/viewtopic-t-492893-highlight-rt73.html). The only way to get it going is with 'dhcpcd rausb0'. Which is why I was trying your way... Oh yeah, I'm using the DLink DWL-G122 Rev. C1

Well anyway, if you didn't have the same problem, it's hard for you to know what is happening. So thanks for trying.

Jimmy

----------

## fatshady

Did you read the README with the rt2x00 files? If you can't find it try downloading it from http://rt2x00.serialmonkey.com (I think you have to download the whole thing tar and them unpack it to find the readme)...

That has a whole bunch if info on getting it working...

----------

## rezende.danilo

Hi, I'm trying to follow your steps, but I get this problem with the rate_control.ko module:

localhost linux # emerge  rt2x00 Calculating dependencies... done!

>>> Emerging (1 of 1) net-wireless/rt2x00-9999 to /

 * checking ebuild checksums  :Wink:  ...                                                     [ ok ] * checking auxfile checksums  :Wink:  ...                                                    [ ok ] * checking miscfile checksums  :Wink:  ...                                                   [ ok ] * Determining the location of the kernel source code

 * Found kernel source directory:

 *     /usr/src/linux

 * Found sources for kernel version:

 *     2.6.17-gentoo-r7

 * Checking for suitable kernel configuration options...                                 [ ok ]>>> Unpacking source...

 * Fetching CVS module source/rt2x00 into /usr/portage/distfiles/cvs-src ...

 * Running  cvs -q -f -z3 -d ":pserver:anonymous:@rt2400.cvs.sourceforge.net:/cvsroot/rt2400" login

Logging in to :pserver:anonymous@rt2400.cvs.sourceforge.net:2401/cvsroot/rt2400

 * Running  cvs -q -f -z3 -d ":pserver:anonymous@rt2400.cvs.sourceforge.net:/cvsroot/rt2400" update -dP rt2x00-9999

 * Copying source/rt2x00 from /usr/portage/distfiles/cvs-src ...

 * CVS module source/rt2x00 is now in /var/tmp/portage/rt2x00-9999/work

>>> Source unpacked.

>>> Compiling source in /var/tmp/portage/rt2x00-9999/work/rt2x00-9999 ...

 * No module specified in USE flags - building everything.

 * Preparing 80211 module

  CC [M]  /var/tmp/portage/rt2x00-9999/work/rt2x00-9999/ieee80211/ieee80211.o

  CC [M]  /var/tmp/portage/rt2x00-9999/work/rt2x00-9999/ieee80211/ieee80211_ioctl.o

  CC [M]  /var/tmp/portage/rt2x00-9999/work/rt2x00-9999/ieee80211/ieee80211_scan.o

  CC [M]  /var/tmp/portage/rt2x00-9999/work/rt2x00-9999/ieee80211/ieee80211_sta.o

  CC [M]  /var/tmp/portage/rt2x00-9999/work/rt2x00-9999/ieee80211/ieee80211_dev.o

  CC [M]  /var/tmp/portage/rt2x00-9999/work/rt2x00-9999/ieee80211/ieee80211_iface.o

  CC [M]  /var/tmp/portage/rt2x00-9999/work/rt2x00-9999/ieee80211/ieee80211_rate.o

  CC [M]  /var/tmp/portage/rt2x00-9999/work/rt2x00-9999/ieee80211/ieee80211_sysfs.o

  CC [M]  /var/tmp/portage/rt2x00-9999/work/rt2x00-9999/ieee80211/ieee80211_sysfs_sta.o

  CC [M]  /var/tmp/portage/rt2x00-9999/work/rt2x00-9999/ieee80211/sta_info.o

  CC [M]  /var/tmp/portage/rt2x00-9999/work/rt2x00-9999/ieee80211/wme.o

  CC [M]  /var/tmp/portage/rt2x00-9999/work/rt2x00-9999/ieee80211/wep.o

  CC [M]  /var/tmp/portage/rt2x00-9999/work/rt2x00-9999/ieee80211/wpa.o

  CC [M]  /var/tmp/portage/rt2x00-9999/work/rt2x00-9999/ieee80211/michael.o

  CC [M]  /var/tmp/portage/rt2x00-9999/work/rt2x00-9999/ieee80211/tkip.o

  CC [M]  /var/tmp/portage/rt2x00-9999/work/rt2x00-9999/ieee80211/aes_ccm.o

  CC [M]  /var/tmp/portage/rt2x00-9999/work/rt2x00-9999/ieee80211/fifo_qdisc.o

  CC [M]  /var/tmp/portage/rt2x00-9999/work/rt2x00-9999/crc-itu-t/crc-itu-t.o

  CC [M]  /var/tmp/portage/rt2x00-9999/work/rt2x00-9999/ieee80211/rc80211_simple.o

  CC [M]  /var/tmp/portage/rt2x00-9999/work/rt2x00-9999/rfkill/rfkill.o

  CC [M]  /var/tmp/portage/rt2x00-9999/work/rt2x00-9999/rt2400pci.o

  CC [M]  /var/tmp/portage/rt2x00-9999/work/rt2x00-9999/rt2500pci.o

  CC [M]  /var/tmp/portage/rt2x00-9999/work/rt2x00-9999/rt2500usb.o

  CC [M]  /var/tmp/portage/rt2x00-9999/work/rt2x00-9999/rt61pci.o

  CC [M]  /var/tmp/portage/rt2x00-9999/work/rt2x00-9999/rt73usb.o

  LD [M]  /var/tmp/portage/rt2x00-9999/work/rt2x00-9999/80211.o

  LD [M]  /var/tmp/portage/rt2x00-9999/work/rt2x00-9999/rc80211_simple.o

  LD [M]  /var/tmp/portage/rt2x00-9999/work/rt2x00-9999/crc-itu-t.o

  LD [M]  /var/tmp/portage/rt2x00-9999/work/rt2x00-9999/rfkill.o

  Building modules, stage 2.

  MODPOST

  CC      /var/tmp/portage/rt2x00-9999/work/rt2x00-9999/80211.mod.o

  CC      /var/tmp/portage/rt2x00-9999/work/rt2x00-9999/crc-itu-t.mod.o

  CC      /var/tmp/portage/rt2x00-9999/work/rt2x00-9999/rc80211_simple.mod.o

  CC      /var/tmp/portage/rt2x00-9999/work/rt2x00-9999/rfkill.mod.o

  CC      /var/tmp/portage/rt2x00-9999/work/rt2x00-9999/rt2400pci.mod.o

  CC      /var/tmp/portage/rt2x00-9999/work/rt2x00-9999/rt2500pci.mod.o

  CC      /var/tmp/portage/rt2x00-9999/work/rt2x00-9999/rt2500usb.mod.o

  CC      /var/tmp/portage/rt2x00-9999/work/rt2x00-9999/rt61pci.mod.o

  CC      /var/tmp/portage/rt2x00-9999/work/rt2x00-9999/rt73usb.mod.o

  LD [M]  /var/tmp/portage/rt2x00-9999/work/rt2x00-9999/80211.ko

  LD [M]  /var/tmp/portage/rt2x00-9999/work/rt2x00-9999/crc-itu-t.ko

  LD [M]  /var/tmp/portage/rt2x00-9999/work/rt2x00-9999/rc80211_simple.ko

  LD [M]  /var/tmp/portage/rt2x00-9999/work/rt2x00-9999/rfkill.ko

  LD [M]  /var/tmp/portage/rt2x00-9999/work/rt2x00-9999/rt2400pci.ko

  LD [M]  /var/tmp/portage/rt2x00-9999/work/rt2x00-9999/rt2500pci.ko

  LD [M]  /var/tmp/portage/rt2x00-9999/work/rt2x00-9999/rt2500usb.ko

  LD [M]  /var/tmp/portage/rt2x00-9999/work/rt2x00-9999/rt61pci.ko

  LD [M]  /var/tmp/portage/rt2x00-9999/work/rt2x00-9999/rt73usb.ko

>>> Source compiled.

>>> Test phase [not enabled]: net-wireless/rt2x00-9999

>>> Install rt2x00-9999 into /var/tmp/portage/rt2x00-9999/image/ category net-wireless

 * Installing 80211 module

 * Installing rate_control module

install: cannot stat `rate_control.ko': No such file or directory

!!! ERROR: net-wireless/rt2x00-9999 failed.

Call stack:

  ebuild.sh, line 1546:   Called dyn_install

  ebuild.sh, line 1020:   Called src_install

  rt2x00-9999.ebuild, line 112:   Called linux-mod_src_install

  linux-mod.eclass, line 497:   Called die

!!! doins rate_control.ko failed

!!! If you need support, post the topmost build error, and the call stack if relevant.

----------

## fatshady

This look like an error in copying the modules to the kernel directory, and from what you have posted it has not built the module. Your best bet is to post on the RT2x00 website and let them know, or retry downloading it later when the next nightly rebuild is done...

They're at http://rt2x00.serialmonkey.com

Cheers

Dan

----------

## lucidsmog

I'm pretty sure that for whatever reason rate_control.o is now rc80211_simple.o, as that is what is listed in the README as being the required module to insert.

I tried modifying the ebuild myself for this but portage complains bitterly about my changing the ebuild and I haven't yet figured out how to tell it that, yes, I really do want it to install using a modified ebuild.

----------

## rezende.danilo

Thanks for the feedback,

Everything is working now... I simply forgot about emerge rt2x00 ....  I've just downloaded the latest cvs and did a make && make install, loading the correct modules  in the new README file ...

 :Wink:  [/i]

----------

## The Sentry

Hi!

I spent the whole day trying to get this stupid thing to work. I did everything you described in your HOWTO, but it won't load the firmware. I even hacked the firmware loader module to get more output.

Kernel: 2.6.18-r8 (gentoo-sources)

DWL-G122 USB-WLAN-Adapter, HW Ver: C1, FW Ver 3.00 (so it says on the stick)

This is my output when I modprobe rt73usb:

```
Loading module: rt73usb - CVS (N/A) by http://rt2x00.serialmonkey.com.

wmaster0: Selected rate control algorithm 'simple'

usbcore: registered new driver rt73usb

fw_setup_class_device: retaval = 0

fw_setup_class_device: retaval = 0

_request_firmware: loading_timeout = 10

_request_firmware: fw_priv->fw->size=0, bool=1

request_firmware_work_func: ret=-2

rt73usb->rt73usb_init_firmware_cont: Error - Failed to load Firmware.
```

The return values are from debug outputs I added to the firmware_class.c to get more information. As we can see, the firmware struct reports a size of 0 for the firmware, the error code -2 stands for "No such file or directory".

The directory /lib/firmware exists, I tried 3 different versions of the rt73.bin, including the one installed under Windows.

What the hell am I doing wrong?

----------

## quique

Hi!

I got it working two days ago but yesterday night I recompiled the kernel and now I can't even insert the 80211 module. This is the interesting part of the output from dmesg:

```
80211: Unknown symbol mem_section

80211: Unknown symbol mem_section

rc80211_simple: Unknown symbol sta_info_put

rc80211_simple: Unknown symbol ieee80211_rate_control_unregister

rc80211_simple: Unknown symbol ieee80211_rate_control_register

rc80211_simple: Unknown symbol sta_info_get

80211: Unknown symbol mem_section

rt73usb: Unknown symbol ieee80211_free_hw

rt73usb: Unknown symbol ieee80211_alloc_hw

rt73usb: Unknown symbol ieee80211_register_hw

rt73usb: Unknown symbol ieee80211_wake_queue

rt73usb: Unknown symbol ieee80211_update_hw

rt73usb: Unknown symbol ieee80211_netif_oper

rt73usb: Unknown symbol ieee80211_start_queues

rt73usb: Unknown symbol __ieee80211_rx

rt73usb: Unknown symbol ieee80211_tx_status

rt73usb: Unknown symbol ieee80211_stop_queue

rt73usb: Unknown symbol ieee80211_stop_queues

rt73usb: Unknown symbol ieee80211_get_hdrlen

rt73usb: Unknown symbol ieee80211_unregister_hw

rt73usb: Unknown symbol ieee80211_get_hw

rt73usb: Unknown symbol ieee80211_beacon_get

```

What are those symbols?

----------

## The Sentry

Seems, you missed out a module. The Howto here says:

 *fatshady wrote:*   

> You need to laod all the modules individually in the correct order:
> 
> ```
> # modprobe 80211
> 
> ...

 

I don't remember exactly, but for one of the drivers available, you have to enable IEEE80211 in the kernel:

Networking -> Generic IEEE 802.11 Networking Stack

and maybe some of the suboptions of this. However, it could be, that you must NOT enable this options. I'm not quite sure, so just check, what you have selected and try the opposite.

----------

## quique

But isn't that the module I'm trying to insert? The problem is when I try modprobe 80211

----------

## quique

Solved. I just jad to re-emerge rt2x00  :Embarassed:   :Embarassed: 

----------

## The Sentry

I should read better before I respond  :Wink: 

Btw: Does it fully work? I still haven't solved my firmware problem. Where did you place your firmware and which one did you ude?

----------

## quique

I think it works, I can ifconfig wlan0 up, but I haven't still tried it. The firmware I used is the one in the package from rt2x00.serialmonkey.com

----------

## bazouu

Hi all,

I got some problems installing my DWL-G122 stick on my gentoo-2.6.17-gentoo-r8 box :s

I follow this HOW-TO, but when I do the 

```
ACCEPT_KEYWORDS="~x86" USE="rt73usb" emerge rt2x00
```

 I got the following error message

```
[...]

LD [M]  /var/tmp/portage/rt2x00-9999/work/rt2x00-9999/crc-itu-t.ko

  CC      /var/tmp/portage/rt2x00-9999/work/rt2x00-9999/rc80211_simple.mod.o

  LD [M]  /var/tmp/portage/rt2x00-9999/work/rt2x00-9999/rc80211_simple.ko

>>> Source compiled.

>>> Test phase [not enabled]: net-wireless/rt2x00-9999

>>> Install rt2x00-9999 into /var/tmp/portage/rt2x00-9999/image/ category net-wireless

 * Installing 80211 module

 * Installing rc80211_simple module

 * Installing crc-itu-t module

 * Installing rt73usb module

install: ne peut évaluer `rt73usb.ko': Aucun fichier ou répertoire de ce type

!!! ERROR: net-wireless/rt2x00-9999 failed.

Call stack:

  ebuild.sh, line 1546:   Called dyn_install

  ebuild.sh, line 1020:   Called src_install

  rt2x00-9999.ebuild, line 131:   Called linux-mod_src_install

  linux-mod.eclass, line 540:   Called die

!!! doins rt73usb.ko failed

!!! If you need support, post the topmost build error, and the call stack if relevant.

```

So I tried to install the module from the rt2x00 nightly CVS tarball. The make & make install worked well.

Yet I got this next error:

```
# modprobe rt73usb

WARNING: Error inserting 80211 (/lib/modules/2.6.17-gentoo-r8/rt2x00/80211.ko): Unknown symbol in module, or unknown parameter (see dmesg)

WARNING: Error inserting rt2x00lib (/lib/modules/2.6.17-gentoo-r8/rt2x00/rt2x00lib.ko): Unknown symbol in module, or unknown parameter (see dmesg)

FATAL: Error inserting rt73usb (/lib/modules/2.6.17-gentoo-r8/rt2x00/rt73usb.ko): Unknown symbol in module, or unknown parameter (see dmesg)

```

and there is a sample of my dmesg:

```
80211: Unknown symbol iw_handler_set_spy

80211: Unknown symbol iw_handler_get_thrspy

80211: Unknown symbol wireless_send_event

80211: Unknown symbol iw_handler_get_spy

80211: Unknown symbol iw_handler_set_thrspy

rt2x00lib: Unknown symbol ieee80211_ctstoself_get

rt2x00lib: Unknown symbol ieee80211_rts_get

rt73usb: Unknown symbol rt2x00lib_load_firmware_wait

rt73usb: Unknown symbol ieee80211_free_hw

rt73usb: Unknown symbol ieee80211_alloc_hw

rt73usb: Unknown symbol ieee80211_register_hw

```

I didn't install a new kernel since I tried to install this drivers.

So....I don't know what to try now   :Crying or Very sad: 

Anyone got an idea?

Thanks

----------

## gentooxic

Hello, i have too rt73 based card.

The best - easiest way to make this to work:

Download t73 USB nightly CVS tarball from: http://rt2x00.serialmonkey.com/wiki/index.php?title=Downloads

```
tar -xvzf rt73-cvs-daily.tar.gz

cd rt73-cvs-dateofdriver

cd Module

make

cp rt73.ko /lib/modules/version-of-kernel-what-u-are-using/kernel/drivers/net (for example...)

depmod -ae

modprobe rt73
```

/usr/src/linux must be a symlink to sources of kernel what is already in use, ofcourse...

That's all, emerge? - a lot of work for me I JUST WANT INTERNET  :Wink: 

----------

## bazouu

Thank you  :Smile: 

Indeed it was really easy this way!

Right now i'm not associated with the AP

```
wlan0     IEEE 802.11g  ESSID:"xxxxxxxx"

          Mode:Managed  Frequency:2.437 GHz  Access Point: Not-Associated

          RTS thr:off   Fragment thr=2346 B

          Encryption key:xxxx-xxxx-xx

          Link Quality:0  Signal level:0  Noise level:0

          Rx invalid nwid:0  Rx invalid crypt:0  Rx invalid frag:0

          Tx excessive retries:0  Invalid misc:0   Missed beacon:0
```

I don't know why but i will look at this problem farther this evening.

Thank you  :Smile: 

----------

## netguy

 *bazouu wrote:*   

> Thank you 
> 
> Indeed it was really easy this way!
> 
> Right now i'm not associated with the AP
> ...

 

I just got my EDIMAX EW-7318USg working,You may try this:

           iwlist scan ( check results for your AP's MAC address,it's uppercase )

           iwconfig wlan0 ap xx:xx:xx:xx:xx:xx

where xx is the MAC address in lowercase.Hope this help.

----------

## thecooptoo

heres my error 

```
U rt2x00-9999/rfkill/rfkill.c

U rt2x00-9999/rfkill/linux/rfkill.h

 * Copying source/rt2x00 from /usr/portage/distfiles/cvs-src ...

 * CVS module source/rt2x00 is now in /var/tmp/portage/rt2x00-9999/work

>>> Source unpacked.

>>> Compiling source in /var/tmp/portage/rt2x00-9999/work/rt2x00-9999 ...

 * No module specified in USE flags - building everything.

 * Preparing 80211 module

  CC [M]  /var/tmp/portage/rt2x00-9999/work/rt2x00-9999/ieee80211/ieee80211.o

In file included from <command line>:1:

/var/tmp/portage/rt2x00-9999/work/rt2x00-9999/rt2x00_compat.h:69:2: error: #error EEPROM_93CX6 has been disabled in your kernel!

/var/tmp/portage/rt2x00-9999/work/rt2x00-9999/rt2x00_compat.h:70:2: error: #error Please refer to README file for minimal requirements.

make[3]: *** [/var/tmp/portage/rt2x00-9999/work/rt2x00-9999/ieee80211/ieee80211.o] Error 1

make[2]: *** [_module_/var/tmp/portage/rt2x00-9999/work/rt2x00-9999] Error 2

make[1]: *** [modules] Error 2

make: *** [default] Error 2

!!! ERROR: net-wireless/rt2x00-9999 failed.

Call stack:

  ebuild.sh, line 1546:   Called dyn_compile

  ebuild.sh, line 937:   Called src_compile

  rt2x00-9999.ebuild, line 127:   Called linux-mod_src_compile

  linux-mod.eclass, line 510:   Called die

!!! Unable to make  KERNDIR=/usr/src/linux KERNOUT=/lib/modules/2.6.18-gentoo-r6/build  .

!!! If you need support, post the topmost build error, and the call stack if relevant.

lappy linux #                                                                                                              
```

more when i've tried to sort it out

----------

## tekknokrat

 *Quote:*   

> 
> 
> EEPROM_93CX6
> 
> 

 

imo this should be enabled in kernel

----------

