Sunday, November 23, 2008

wifi - ralink pci rt2600 drama

--(edited 20090421)--
I had occasion to reinstall Slackware the other day. Default distribution drivers for the ralink rt2600 are the rt61pci series drivers which seem to provide only flaky and, therefore, annoying connections.

drivers
First, retrieve the latest drivers from Ralink's linux page . For me, this was the 2008_0723_RT61_Linux_STA_v1.1.2.2.tar.bz2 driver. Unfortunately, the README was almost unintelligible, without even proper line returns. It only gives a portion of the necessary information, and hours are required to find the solution. Highly annoying. Taken together with the drivers, both the kernel source and headers are required. So:
a. drivers
b. kernel source
c. kernel headers

file changes
Prior to compiling, there are some changes, at least to these 2008 and 2009 versions. After copying Makefile.6 to Makefile, change the CFLAGS statement around line 28 to:

EXTRA_CFLAGS+= $(WFLAGS)
If you don't like to change the Makefile, you can export the KBUILD_NOPEDANTIC just prior to compiling, but this is a necessary environment variable, one way or the other.

Another change, this one suggested, is near the end of the rtmp_main.c file. Here, we want to change as follows: from
static INT __init rt61_init_module(VOID)
{
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0)
   return pci_register_driver(&rt61_driver);
#else
   return pci_module_init(&rt61_driver);
#endif
}
to this:
static INT __init rt61_init_module(VOID)
{
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0)
   return pci_register_driver(&rt61_driver);
#else
   return pci_register_driver(&rt61_driver);
#endif
}


environment
As noted above and described here, if you don't change the enviroment setting in the Makefile, you'll need to add
$export KBUILD_NOPEDANTIC=1
as a command just prior to compiling. For systems with csh and tcsh environments, the command is apparently
$setenv KBUILD_NOPEDANTIC 1

putting it together

$ tar -xvjf 2008_0723_RT61_Linux_STA_v1.1.2.2.tar.bz2
$ cd 2008*
$ cd Module
$ cp Makefile.6 Makefile
$ chmod 755 Configure
$ Configure
$ export KBUILD_NOPEDANTIC=1 (if you didn't change the Makefile)
$ make

Root up

# mkdir /etc/Wireless
# mkdir /etc/Wireless/RT61STA
# cp *.bin /etc/Wireless/RT61STA (three firmware files)
# cp sta.dat /etc/Wireless/RT61STA (configuration file)
# cp rt61.ko /lib/modules/<kernel>/kernel/drivers/net/wireless
final steps
# nano /etc/modprobe.d/blacklist
blacklist rt61pci
blacklist rt2x00pci
blacklist rt2x00lib (save and close)

# nano /etc/modprobe.d./modprobe.conf
alias ra0 rt61 (save and close)

# depmod -a

No comments: