Saturday, November 11, 2006

Making D-Link DWL-G510 to Work Under Slackware 11

[Updated Nov 12, 2006]
  • If during insmod or depmod the system complains of 'missing wireless_send_event', this means the Wireless LAN option is not compiled in. Just reconfigure the kernel and enable that, no need to select any other specific wireless driver under that option though.
I have been busy tinkering with my Linux box these days, and I am planning to write two blog entries to document my findings.

First will be this one, on how to make the DWL-G510 rev. C wireless card work under the 2.4 kernel of Slackware 11. If there are enough requests (pls drop a line at the blog comment field for that purposes), I will work on the 2.6 kernel also.
Second article will be on compiling GnuCash, I already settled the issue with guile and slib after 2 days of wrestling with it.

Back to the wireless card: I browsed the web and from this link I learned the rev. C card is using Ralink chipset. This piece of information is all I need to get started.

Before we start, here are my system specs:

- Slackware 11.0 running kernel version 2.4.33.3
- LinkSys WRT 54G as my router
- Wireless network is protected by WPAPSK with TKIP as encryption method
- My ISP doesn't require any authentication for network access
- My IP is static (WRT54G doesn't seem to work well with Linux, I can't get the DHCP to work)

Since you are using Slackware, I am assuming you have a healthy dose of background in Linux and knows how to untar files and invoke a compiler. But I am happy to add this info if there are requests.

Before you start, you need to:

Steps:
  • Untar the driver tar ball
  • cd to the 'Module' directory and read the 'readme', yes, it is important to read it.
  • [Optional] It seems the people in Ralink are using windows to edit the source codes (or the version control software automatically save files in Dos format). We need to rectify this or else 'make' will complain and choke. We can clean up the mess using the dos2unix command (if your system has it), or we can issue a perl one-liner, as documented below.
  • Command sequences:
  • cp Makefile.4 Makefile
    make
    perl -pi -e 's/\r\n/\n/g;' *
    mkdir -p /etc/Wireless/RT61STA
    cp rt*.bin /etc/Wireless/RT61STA/
    cp rt61sta.dat /etc/Wireless/RT61STA/

  • You will get a kernel moduel rt61.o, this is what you need
  • Edit the rt61sta.dat according to your need, if in doubt, please consult your service provider. The readme has a pretty decent explanations on the parameters.
  • Do a sanity check, no error should be seen:
  • /sbin/insmod rt61.o
    /sbin/ifconfig ra0 inet 192.168.1.2 up
    /sbin/route add default gw
  • Try to ping your router or any system in your subnet. If it works, then your wireless card is up.
  • Now to make it fully automatic, we need to integrate this into our system. Make the following directory: mkdir -p /lib/modules/`uname -r`/rt61, then copy the module in.
  • Execute depmod: 'depmod -a'
  • Edit /etc/modules.conf, add the following lines (I assume it is empty, or you need to adjust accordingly):
  • keep
    /lib/modules/`uname -r`/rt61
  • Next edit /etc/rc.d/rc.inet1.conf, edit the profile for wlan0 and replace accordingly with the following:
  • IFNAME[4]="ra0"
    IPADDR[4]="your IP"
    NETMASK[4]="your net mask"
  • Reboot the machine. You should be all set.

6 comments:

The Soothsayer said...

- My IP is static (WRT54G doesn't seem to work well with Linux, I can't get the DHCP to work)

I don't get it. Is the protocol different on Linux and Windows?

Cuppa Chai said...

Standard remains the same. In an ideal world, there shouldn't be any difference, but in reality, there is. There are some formatting difference in the DHCP requests. I may be wrong, but no matter how I pump the DHCP requests, the WRT54G is mute. :(

Anonymous said...

Ah Chai! Just found your lil blog. Joined the blogosphere eh?

Maybe I'll start one to bitch about management ;)

Cuppa Chai said...

Hey Fookie! Welcome to my blog. Ya start something as an online documentation. :) Hope to see your management-bitching blog soon. :P

The Soothsayer said...

Modify your Linux DHCP protocol. :)

Cuppa Chai said...

Actually I am highly suspecting it is the M$ protocol stack for DHCP is broken, but this device has not pissed me enough for me to fire up Ethereal and stuck a cable at its butt (ok, I mean the Ethernet port at its back). :P