WL500gpv2 Page

Many other examples of embedded linux can be found in wireless router applications, typically either OpenWRT or DD-WRT projects, which build upon OpenEmbedded. For page, we concentrate on the WL500g Professional Version 2, and the "Kamikaze" build of OpenWRT. Though the most recent versions of OpenWRT using the Linux 2.6 kernel don't work with this platform, it is possible to use a 2.4 kernel and get wireless (802.11), wired (Ethernet), and USB devices all running.

Summary how-to pages:

Note that in order to set up firewall or USB or DHCP on this device, you typically need to install packages, which can be found here.

Some Experience

Here's my story of installing Kamikaze on the WL500g. The Asus WL500gp V2 was chosen over other hackable WiFi( routers because it has reasonable resource (memory, flash), ample Ethernet ports, and two (2) USB ports. Using USB is great for having access to external storage (USB drives and so on).

BUT, the drawback is that many embedded Linux versions did not support both WiFi and USB for this device, at least when I investigated the platform. Two sources for the embedded Linux are OpenWRT and DD-WRT projects. Earlier reports from the "White Russian" version of OpenWRT indicate that the WL500gp is supported, but documentation is sketchy; it now appears that the Kamikaze version of OpenWRT (8.09 as of this writing) can support the platform, though only using kernel 2.4 instead of 2.6, unfortunately.

For an initial demonstration of the viability, I downloaded and installed this:

    openwrt-brcm-2.4-squashfs.trx

It's Linux 2.4 for broadcom, and I did get WiFi to work after adjusting the etc/config/wireless file to enable wireless. This distribution also included the user-friendly web administrator package. It might be worth saving directories from this distribution in case some content, particularly configuration files, are needed to customize the homebuilt system.

Building Our Own

The problem is that I want to do more than just run a router as a typical consumer might do; I want to use USB and perhaps run some custom daemons of our own programming. That implies we need to have access to cross compilers and a development environment.

Installing OpenWRT

To install OpenWRT, I download and unpack

   kamikaze_8.09_source.tar.bz2

from a suitable website, preferable one that explicitly mentions Linux 2.4 and WL500gp or similar. Basically, we're looking for a website with the openwrt-brcm-2.4-squashfs.trx that works, and also has the tar file above.

After extracting OpenWRT, I need a configuration file for the router. I wasn't able to find one laying about; instead, I found

   kamikaze_8.09/target/linux/brcm-2.4/config-default

and then copied this file to kamikaze_8.09/.config (the non-visible configuration file for make). Next, I used

   make oldconfig

to process the .config file, replying with the default to all questions. After this, you can use

   make menuconfig

to adjust the choices. One thing to change is the target platform, so that it specifies the WL500gp (professional version). Also, make sure that the USB core module is enabled and the target image is squashfs, so that it will generate the trx file.

At this point, it's best to do a simple make and try to install, just to make sure the process works. You'll need either tftp or atftp installed (tftp was a choice with Slackware).

Installing on the Router

I used a crossover ethernet cable that I made myself following instructions on the net, after buying a few RJ45 connectors from the engineering shop, cutting up some spare patch cords, and borrowing a crimper from our CSG staff. You can buy these ready made, or skip this entirely if you have an Ethernet hub or switch of your own.

Within the desktop Linux, you need to set up a subnet for the router,for example (as root)

   # killall dhcpcd  
   # ifconfig eth1 down
   # ifconfig eth1 192.168.1.12 

(maybe it's eth0, depending on your machine). This creates a subnet for 192.168.1.0 and leaves 192.168.1.1 undefined -- you'll need that as the router's IP address.

Press in the little button (it's marked as "RESTORE") on the WL500gpv2 and attach power, waiting until the light blinks once per second. The cable should be attached to LAN 1 on the router and to your ethernet port on the machine (or to the hub/switch if you have that instead). Now, on the desktop you should be able to

    $ ping 192.168.1.1

and see the router responding (and even blinking). It's waiting for you to upload the trx file with a new kernel. Here's how it's done, assuming you are in the directory containing openwrt-brcm-2.4-squashfs.trx OR kamikaze_8.09/bin/openwrt-brcm-2.4-squashfs.trx. The upload commands are:

    $ tftp 192.168.1.1
    $ binary
    $ trace
    $ put openwrt-brcm-2.4-squashfs.trx 

Wait until this finishes and wait ten seconds more, in case the router is slow to rewrite its flash. Then, disconnect power and reconnect, to force a reboot. Again, try

    $ ping 192.168.1.1

until it responds. Now, you should be able to do this:

    $ telnet 192.168.1.1

and you will be logged in as root. The advice on the message tells you to set a password, so do that. This will turn off the telnet port and enable an ssh port. Use "halt" to stop the router; disconnect power, reboot, and next time you can:

    $ ssh root@192.168.1.1

and log in as root. You'll need to follow the steps above or something similar each time you install a new kernel.

Gotcha Note: sometimes you'll see nasty messages when doing ssh or scp due to a stale key in your directory; if this occurs you may need to "rm ~/.ssh/known_hosts" and retry.

Cross Compiling

Part of the make procedure builds a toolchain, suitable for cross compiling. Sadly, the cross compilers hard link to files, so you can't easily use these cross compilers without the whole environment, right where it was initially unpacked and created -- meaning you cannot just rename and copy things and have it all work. My method is to unpack and build the OpenWRT development system, use it, and then tar to some offline place for later. Each time you want to work with this, you then need to untar it and remember how it all works. Not great, but easier than starting from scratch each time.

As for the cross compilers, I built the Mote directory and within that the CrossBin directory; then

  cp ../../kamikaze_8.09/staging_dir/
     toolchain-mipsel_gcc3.4.6/mipsel-linux-uclibc/bin/* .

which puts gcc and friends in the CrossBin directory. See the Makefile in the Mote directory for an example of how this is used. Once you have an executable made by the cross compile, use scp to copy it over to the router.

Packages for USB (and other things)

OpenWRT and other embedded Linux typically needs lots of modules loaded, so you need to have these in your system. The usual way to do this is to install them with the ipkg (or opkg) commands. These commands can go directly via the net to openwrt.org or similar sites and grab the packages, but here's what I did instead: copy the desired ipk files from

   kamikaze_8.09/bin/packages/mipsel/

into some directory, then tar this directory and scp it over to the router. Once untarred into /root on the router, you can use opkg to install each of the packages. Here are the packages I installed:

   kmod-fs-ext2_2.4.35.4-brcm-2.4-1_mipsel.ipk
   kmod-fs-ext3_2.4.35.4-brcm-2.4-1_mipsel.ipk
   kmod-fs-msdos_2.4.35.4-brcm-2.4-1_mipsel.ipk
   kmod-fs-vfat_2.4.35.4-brcm-2.4-1_mipsel.ipk
   kmod-usb-core_2.4.35.4-brcm-2.4-1_mipsel.ipk
   kmod-usb-ohci_2.4.35.4-brcm-2.4-1_mipsel.ipk
   kmod-usb-serial-ftdi_2.4.35.4-brcm-2.4-1_mipsel.ipk
   kmod-usb-serial_2.4.35.4-brcm-2.4-1_mipsel.ipk
   kmod-usb-storage_2.4.35.4-brcm-2.4-1_mipsel.ipk
   kmod-usb-uhci-iv_2.4.35.4-brcm-2.4-1_mipsel.ipk
   kmod-usb-uhci_2.4.35.4-brcm-2.4-1_mipsel.ipk
   kmod-usb2_2.4.35.4-brcm-2.4-1_mipsel.ipk

In addition to the above, you can optionally install the fancy web page administration interface (which I grabbed from x-wrt.org). The two files need that I found are

   haserl_0.9.24-1_mipsel.ipk
   webif_latest.ipk

After installing these, reboot and do lsmod to see all of the modules installed, and test the web page (just http://192.168.1.1 is enough).

USB Storage

I haven't figured out how to make this work as it really should; remember, this is Linux 2.4, which has a different device support than modern 2.6 kernels. I was able to see that the system recognized a USB stick by looking at "dmesg" output. But how to mount them? The answer can be something like this:

  mount /dev/scsi/host0/bus0/target0/lun0/part1 mnt

Crazy, no? At one point, I ended up manually creating /dev/sda and such, after searching on the web for "mknod /dev/sda" or something like that. I needed to do

   $ cd dev
   $ mknod sda b 8 0 
   $ mknod sda1 b 8 1

and so on, manually. Maybe I should have installed the hotplug2 package? Don't know. Anyways, creating these devices manually did allow me to

   $ mount -t vfat /dev/sda1 /mnt
   $ ls /mnt
   $ umount /mnt

and this worked.

WL500gpv2 (last edited 2014-05-25 18:15:49 by localhost)