How to setup a linksys WMP54G in Gentoo Linux using the net-wireless/rt2500 package, while using WPA-PSK encryption

Summary

After having a hard time with my newly bought linksys WMP54G card and using ndiswrapper, I decided to go another way. I used the rt2500 open sourced drivers and a customised start up script, because I wanted to use WPA-PSK encryption. Up to now it is working, with the loss that my kernel is compiled without SMP (so, hyperthreading of my Pentium IV is disabled I guess).

Why aren't you using ndiswrapper?

Well, with ndiswrapper all seemed nice in the beginning, but I have suffered from several bugs in the code, which did not allow me to update my kernel to a newer version, so I was stuck with kernel 2.6.13 and ndiswrapper 1.2. Also I have seen several lock ups of the system even during boot, so I had to revert to a rescue disk.

So, rt2500 here we come!

For the rt2500 chipset (this is the chipset on my wireless Linksys WMP54Gv4-EU NIC) open source drivers are available (see: http://rt2x00.serialmonkey.com). In Gentoo there is even a package available:

net-wireless/rt2500

However, there are still some problems to be resolved with this package. SMP and pre-empt kernels are known to give problems. First thing I did was recompile my kernel with SMP and pre-empt disabled.

After recompiling the kernel I keyworded net-wireless/rt2500 in portage (because it is marked unstable):

# echo "net-wireless/rt2500 ~x86" >> /etc/portage/package.keywords

And then I emerged it, together with the net-wireless/wireless-tools package:

# emerge rt2500 wireless-tools

After installing the kernel module and utils should be available, with which you can get your wireless NIC working. Output of:

# lspci -v

should show something like:

02:0c.0 Network controller: RaLink Ralink RT2500 802.11G Cardbus/mini-PCI (rev 01)
 Subsystem: Linksys WMP54G 2.0 PCI Adapter
 Flags: bus master, slow devsel, latency 64, IRQ 11
 Memory at f7ffc000 (32-bit, non-prefetchable) [size=8K]
 Capabilities: [40] Power Management version 2

Now, we need a custom rc-script, because for WPA-PSK we need the iwpriv tool to be run. The configuration in /etc/conf.d/wireless shows an option for iwpriv, but because we need multiple 'set'-commands, we cannot use it. It will only accept the last command set, and will thus not work.

The contents of this rc-script (/etc/init.d/net.ra0, found somewhere at the gentoo forums and modified to suit my needs) look as follows:

#!/sbin/runscript
start() {
    einfo "Finding network"
    ifconfig ra0 up
    sleep 7s
    if [ "`iwlist ra0 scanning | grep -i MY_ESSID`" != "" ]; then
        ebegin "Found network"
            iwpriv ra0 set SSID=MY_ESSID
            iwpriv ra0 set NetworkType=Infra
            iwpriv ra0 set AuthMode=WPAPSK
            iwpriv ra0 set EncrypType=TKIP
            iwpriv ra0 set WPAPSK="MY_WPAPSK_PASSWORD"
                                                                    
            ifconfig ra0 MY_IP broadcast MY_BROADCAST netmask MY_NETMASK up
            route add default gw MY_GW
        eend 0
    else
        ebegin "No WPA work found"
            einfo "Network setup failed"
        eend 1
    fi
}
stop() {
    route delete default
    ifconfig ra0 down
}

In which all the variables prefixed with MY_ are changed to the relevant values.

Then we need to add this rc-script to our default runlevel:

# rc-update add net.ra0 default

That's it, enjoy!

Geldige HTML - Geldige CSS - Martijn Meijers - CCPL - 1999-2010