RaLink RT2561/RT61 PCI Wireless Card Linux Installation

by Richard Sonnenfeld
< pcardout*AT*gmailDOTcom>
October 2007

Based substantially on Stewart Rackham's 2004 page [srackham*AT*methodsDOTcoDOTnz]

and Peter's 2005 update [peterthevicar*AT*linkDOTfreeukDOTcom].

Debian 2.6.18 kernel ("etch"). Linksys WMP54G PCI 802.11g wireless card with RaLink RT2561/RT61 chipset. The installation works for me under the conditions described. Rackham and Peterthevicar used older drivers and slightly different hardware, yet the instructions have not changed much. Maybe this means they will work for you!


The RT2561/RT61 chipset is used to implement 802.11g Wireless LAN NICs. These notes describe how I installed a RaLink based NIC (the Linksys WMP54G PCI 802.11g card) under Debian Linux ("etch").


The installation involves:

Selecting and Downloading the proper drivers

Install the NIC and check it has been detected on the PCI bus:

$ lspci
 03:06.0 Network controller: RaLink RT2561/RT61 802.11g PCI

I got my driver from http://www.ralinktech.com/ralink/Home/Support/Linux.html and selected RT2501 PCI

A link at the bottom of the RAlink page pointed me at: The rt2X00 Open Source Project, where I tried to follow the instructions I found.

I was told to

mkdir /home/myself/temp
cp IS_Linux_STA_6x_D_1.1.1.0.tar.gz /home/myself/temp/IS_Linux_STA_6x_D_1.1.1.0.tar.gz
cd /home/myself/temp
tar -xzvf IS_Linux_STA_6x_D_1.1.1.0.tar.gz
cd ./IS_Linux_STA_6x_D_1.1.1.0/Module
make install

This is where I ran into trouble!!

make -C /lib/modules/2.6.18-5-k7/build SUBDIRS=/home/myself/IS_Linux_STA_6x_D_1.1.1.0/Module modules
make: *** /lib/modules/2.6.18-5-k7/build: No such file or directory.  Stop.
make: *** [all] Error 2

The Makefile failed. Why? Clearly there was no build directory. It appears that some of the makefiles make invalid assumptions about where your kernel source is. These assumptions are not correct for Debian. Here are two ways to fix it.

The Hard Way: Installing the Kernel Headers and Modifying the Makefile

Whereas some other distros require a kernel source code installation to compile a module, Debian provides kernel headers for this purpose.

Since uname -r returned, I Googled "debian headers 2.6.18-5-k7" and it took me to http://packages.debian.org/etch/linux-headers-2.6.18-5-vserver-k7:

This site recommended that I install the following packages:

 apt-get install linux-headers-$(uname -r)
 apt-get install linux-kbuild

Note the trick with -$(uname -r) which substitutes your kernel string into apt-get.

To fix the broken Makefile, I had to give it my proper headers directory. Below is an excerpt from the Makefile. You see two lines that I commented out and replaced with my /usr/src/ directory for my specific distro.

#       make -C /lib/modules/$(shell uname -r)/build SUBDIRS=$(shell pwd) modules
        make -C /usr/src/linux-headers-2.6.18-5-k7 SUBDIRS=$(shell pwd) modules

        rm -rf *.o *~ .*.cmd *.ko *.mod.c .tmp_versions built-in.o

#       make -C /lib/modules/$(shell uname -r)/build \
        make -C /usr/src/linux-headers-2.6.18-5-k7 \

Now you can go ahead and clean up make clean, then compile the driver with make, and install with make install. Because I had to hack a non-working Makefile, I'm not sure that it ever worked perfectly. However, compiling the driver was the only really important thing it had to do. To find out if you have compiled the driver, look in the directory from which you just ran make. Before it had some .bin files, but now it should also have an rt61.ko file. This driver can be manually copied to /lib/modules/2.6.18-5-k7/kernel/net/wireless/rt61.ko.

The Easy Way: Avoiding modifying the Makefile

You still need to install the kernel headers as described above.

The Makefile expected to see a /build directory. The headers actually installed a /source directory -- but it had the right .h files in it. So the workaround is to make a symbolic link, e.g.:

ln -s /lib/modules/$(uname -r)/build /lib/modules/$(uname -r)/source

Installing module into kernel

To install the module into the kernel, it's just

depmod -a
insmod rt61.ko

Check that it loaded with lsmod.

Clean-up and Configuration

Although the module Makefile appends the ra0 module alias to /etc/modules.conf this is not where it's meant to go in Debian — manually add the following line to the end of the `/etc/modprobe.d/aliases' file:

alias ra0 rt61

You should now find two RT25xx/rt61 related aliases in the modprobe(8) configuration:

$ modprobe -c|grep rt61
alias ra0 rt61
alias pci:v00001814d00000101sv*sd*bc*sc*i* rt61

Now logon as root and check the driver loads:

$ su
# ifconfig ra0
ra0       Link encap:Ethernet  HWaddr 00:08:A1:77:13:08

Executing ifconfig(8) will automatically load the rt61 driver (aliased to ra0 for convenience).

You can check the driver has loaded with:

$ lsmod | grep rt61
rt61                  214276  1

Configuring the TCP/IP Wireless Connection

Add something like the following the /etc/network/interfaces file:

  auto ra0
  iface ra0 inet static
    up \
    /sbin/iwconfig ra0 mode Managed && \
    /sbin/iwconfig ra0 essid Flophouse

Now check the inteface configuration by taking ra0 down and up:

# ifdown ra0
# ifup ra0
# ifconfig ra0
ra0   Link encap:Ethernet  HWaddr 00:08:A1:77:13:08
      inet addr:  Bcast:  Mask:

The ra0 auto directive ensure the wireless interface is brought up automatically by /etc/init.d/networking at system boot.

See also:

interfaces(5), wireless(7), ifup(8), iwconfig(8).