Things I'll Forget In A Month Tech scratchpad and musings


Configuring the GuruPlug as a wireless client

Update (Nov. 2012): Several people have noted that the links to the GuruPlug kernel files have broken. I've mirrored them on the blog and changed the links below.

By default, the GuruPlug comes configured to act as an access point, which is probably not what most people want. Unfortunately, getting the plug to act as a reliable wifi client is nontrivial. Most existing tutorials on the topic are pretty in-depth - I'm going to give a quick and dirty method for getting wifi configured and working reliably. It's been working nonstop on my plug for several weeks with no dropouts, kernel panics, or the like.

Most of this howto is derived from info gleaned from the Plug Computer wiki, the Plug Computer forum, and tweaks I made myself.

We're going to install a custom kernel. A prebuilt image and modules are provided on the Plug Computer wiki. A note about u-boot: I'm not sure if the included bootloader on the plugs can boot custom kernels, but if you opt to upgrade it, I recommend the version linked here. I'm not going to discuss the bootloader setup any further in this post.

Login to your plug as root, then download and install the kernel image:

cp uImage- /boot/uImage
chown root:root /boot/uImage

And now the kernel modules:

tar xvfj modules-
mv /lib/modules/

Now we'll grab an archive of the wifi drivers and firmware, some custom wifi initialization scripts, and the wifi configuration file. We'll store all this stuff in /root.

tar xvzf wifi-files.tar.gz
mv wifi-files/* /root/

There are three main wifi files. The script that runs before Linux brings up the wireless interface is /root/ and executes some firmware voodoo to get client mode working properly. The script that runs after the interface is up is /root/ and turns on a blue LED to give a visual indication that the wireless came up successfully. Finally, there's the wireless settings file /root/wifi.conf.

Open up wifi.conf and input your wireless settings. The file should be self-explanatory and basically fill-in-the-blanks for most setups, but you can read 'man wpa_supplicant.conf' for all the gory details and possible settings.

Now we need to configure Linux to cleanly bring up the wireless interface. Open up /etc/network/interfaces and input the following entry for the wireless interface mlan0:

auto mlan0
iface mlan0 inet dhcp
pre-up /root/
post-up /root/
wpa-conf /root/wifi.conf

This will cause the plug to DHCP a wireless address -- you can also assign a static IP as you would for any other interface.

Finally, the default GuruPlug filesystem includes a bunch of garbage in /etc/rc.local. Remove any stuff pertaining to wireless (my rc.local has nothing in it at all).

And that's pretty much it. Assuming your plug is properly configured to boot from /boot/uImage, you should be able to restart and Linux will bring up the wireless at the same time it brings up the wired interface (if configured in /etc/network/interfaces). The blue LED will confirm that the wireless came up successfully.

Update (4/11): One problem I've encountered that may bite you later is that the uImage file is (re)generated by updates to the installed kernel package -- which is probably still installed on the plug, even though we overwrote the kernel image. This means that the next time you update your software and an update to the (unneeded) kernel package is pulled down, your custom uImage will be overwritten and the plug will be rendered unbootable the next time it starts. You should be able to avoid this problem by renaming the custom uImage to something else (like /boot/uImage-custom) and then changing the bootloader to boot from that rather than the standard /boot/uImage. Otherwise, when your image gets overwritten, you'll need to manually replace your custom uImage (easy enough if you're running off an SD card).

Comments (21) Trackbacks (0)
  1. Getting some issues:

    sheevaplug-debian:~# insmod /root/mcypt.ko
    insmod: error inserting ‘/root/mcypt.ko’: -1 Invalid module format
    sheevaplug-debian:~# insmod /root/sd8xxx.ko
    insmod: error inserting ‘/root/sd8xxx.ko’: -1 Invalid module format

    any thoughts?

  2. My guess is that you’re not actually booting the right kernel. What’s the output of ‘uname -a’? It should be something like ‘Linux plugdeb #3 PREEMPT Thu Dec 9 14:14:08 EST 2010 armv5tel GNU/Linux’.

  3. My output looks similar (but not the same!)

    Linux sheevaplug-debian 2.6.32-00007-g56678ec #1 PREEMPT Mon Feb 8 03:49:55 PST2010 armv5tel GNU/Linux

  4. Yes, the key part is the version (2.6.xx) — the modules linked to from here are compiled against the kernel and will only work with that version. Your plug is still booting from a 2.6.32 kernel, so it won’t be able to load those modules. Did you follow the instructions about replacing your uImage and making sure you’re booting from it?

  5. ah, then i’m a little unclear about what your guide is saying, can i simply follow your instructions (which i did), or am i to grab this ( also?

    I copied uImage and rebooted, i take it that wasn’t enough?

    Thanks for the help so far!

  6. Copying the files is all you’d need to do assuming that u-boot is already set up to boot from /boot/uImage. In your case, it probably isn’t — you can figure out where u-boot is booting from by going into u-boot and running ‘printenv’ (if you have the jtag board that gives you console access); otherwise you can probably guess what you’re booting from by running ‘ls /boot’.

  7. So, I need to change my kernel and to do this I need to update uboot. I don’t suppose you could point to any tutorials in the same vane as yours (‘this will just work’) for this? I’m finding a lot of information and none of it is that clear

  8. I think I have possibly found the answer to my own question:

  9. Hey, i’m back. Finally got round to getting the proper kernel running:

    sheevaplug-debian:~# uname -a
    Linux sheevaplug-debian #3 PREEMPT Thu Dec 9 14:14:08 EST 2010 armv5tel GNU/Linux

    But i’m having trouble getting this to work, i’m booting up and it’s not connecting, so I try a bit of tinkering and:

    sheevaplug-debian:~# /sbin/wpa_supplicant -i mlan0 -c wifi.conf -B
    ioctl[SIOCSIWPMKSA]: Invalid argument
    ioctl[SIOCSIWESSID]: Network is unreachable
    ioctl[SIOCSIWPMKSA]: Invalid argument

    DMESG says ‘WLAN FW is active’ which seems good to me.

    Any pointers?


  10. The ‘WLAN FW is active’ indicates that the kernel is correctly configured and wifi is working. The next thing to look at is your wifi.conf file — what’s your wifi network configuration (minus your password, obviously)?

  11. My wifi.conf looks like this:

    ssid=”SSI D”

  12. Your network is WPA and not WPA2? If the latter, you need to change proto to WPA2 (but don’t change key_mgmt). Since your SSID and PSK are both in quotes, they should be given in plaintext (presumably that’s what you’re doing).

  13. How’d I miss that?! I read that bloody file 10 times. Thanks for all the help Sean, that did the trick!

    For anyone else who comes across this post and is getting:

    ioctl[SIOCSIWPMKSA]: Invalid argument
    ioctl[SIOCSIWESSID]: Network is unreachable
    ioctl[SIOCSIWPMKSA]: Invalid argument

    I still get them (I will investigate this after i stop celebrating about finally getting this plug on my wifi..) and it works just fine so you’re probably doing something else wrong.

  14. How do I go into uBoot?
    Thanks, Jason

  15. For the GuruPlug, you’ll need the separate JTAG debug board that allows you to get console output via a USB connector. If you have that, you can use minicom (or similar) to get a u-boot shell. There are plenty of tutorials online if you search for it.

  16. i want to install a program on my guruplug but it doesn’t connect to network. Could you please help me to connect it to network.Thanks!

  17. You’re going to need to give me some more information — are you trying to follow this guide to get wifi working? Does the blue LED come on (either blinking or solid)?

  18. Hi Sean, I think I got stucked (after trying many times)with what you was explaining in Update (4/11) -or maybe not -I cannot get out from the Marvell console and it’s not booting,Thanks a lot

  19. Did you recently upgrade your kernel, or was it never booting to begin with? If you didn’t upgrade your kernel, you need to make sure that your bootloader path to the kernel is set to the filename of the actual uImage. I can’t speculate too much on what your particular problem is without knowing what output you’re getting from the console.

  20. You wouldn’t happen to have the linked-to kernel and modules would you? The links are broken now.

  21. Hi there – sorry for the delay. I’ve mirrored the files and updated the links in the post.

Leave a comment

No trackbacks yet.