Skip to content

Instantly share code, notes, and snippets.

@victorloux
Created October 11, 2016 13:47
Show Gist options
  • Save victorloux/976cc8a1029778d09911825633b6ebde to your computer and use it in GitHub Desktop.
Save victorloux/976cc8a1029778d09911825633b6ebde to your computer and use it in GitHub Desktop.
Connect a Galileo or Yún to wifi and to an Eduroam network

This is a short guide to set up an Intel Galileo (or alternatively a Yún, or other small embedded systems who can run Linux) to connect to a wi-fi network, and particularly an eduroam network. Note that if you're using a Raspberry Pi I've found that it's significantly easier to use NetworkManager to do that, but this might not work on Yocto Linux.

(These notes were written in 2014 so they may be outdated by easier processes.)

FIRST you need to have your Galileo set up with the full Linux image (on a microSD card) and a working access to the terminal (via USB or UART). (If you're on OSX or Linux you're probably better off using screen, worked better than CoolTerm which didn't support backspaces and vi). There's plenty of tutorials online to do this. All commands here have to be typed in the terminal of the Galileo.

References

I must thank Sergey Malinov's guide and the wiki of Archlinux for being the most important sources in understanding how this work. I did reuse some of their code, but if you need to troubleshoot your board have a look at these pages as they are much more complete.

Installing drivers for the wifi chip

The default Linux image only has drivers for the Intel Centrino Wireless-N 135 and Advanced-N 6205. If you have another one (I had the N-2230) you need to install drivers for it. For this:

  • From your main computer, download the appropriate driver (the Linux version on board is 3.8.7 so all drivers there should work)
  • Extract the file, put the .ucode file on the SD card, then boot up on the Galileo and copy the firmware to /lib/firmware: cp /media/mmcblk0p1/name-of-driver.ucode /lib/firmware/
  • reboot the Galileo (reboot).

Check that the wifi card is working

Type ip link. You should see an interface called wlan0. If it is not present and you only see Ethernet (eth0) and loopback (lo) then something is wrong — check that the drivers are correctly installed and that the chip is well inserted.

Connect to a normal (non-eduroam) network

The configuration for networks is located in /etc/wpa_supplicant.conf. However you should hopefully not have to edit it manually so far; it is possible to use the wpa_passphrase tool to autogenerate the settings with the encrypted passphrase. The syntax is: wpa_passphrase [ssid] [password] And we will want to add the output of this to our wpa_supplicant conf file. This means you should run: wpa_passphrase your_ssid p4ssw0rd > /etc/wpa_supplicant.conf You should then type history -c to ensure the password is not visible in the history/scrollback. (You could also omit the password and it will take it from standard input).

Now try to launch the network using ifup wlan0. You should see a list of messages, no errors hopefully. If you see “wlan0: authenticated” it should be fine. Try ping google.com. If it works, congratulations! (use Ctrl-C to stop ping). If you get “Bad address: google.com” or “network unavailable” then something's wrong and you'll need to troubleshoot, Google is your friend. Note however that you may get new log messages after the initial attempt to connect, even after you got the prompt focus back. To turn Wi-Fi off, use ifdown wlan0.

Manual troubleshooting

For more commands you can use wpa_cli. This will run an interactive tool. You can use the commands scan then scan_results to see if networks are visible. Check the manpage for more info. If you get an error saying that wpa_supplicant cannot be reached, make sure you have launched it before with ifup wlan0. If this failed try to launch it manually with wpa_supplicant -B -i wlan0 -c /etc/wpa_supplicant.conf.

Starting the network on startup

Once this is working, you'll probably want the Galileo to try connecting to a wifi network when it boots up, otherwise you will have to manually get into it and type ifup wlan0 every time. To do so, edit /etc/network/interfaces with vi, and add auto wlan0 before the definition of the interface:

# Wireless interfaces
*auto wlan0*
iface wlan0 inet dhcp
        wireless_mode managed
        wireless_essid any

Package manager

Once you have Internet connectivity, feel free to do what you want. I missed some utilities though and found it hard to get explanations on how to install packages. A package manager is an utility similar to apt-get on Ubuntu, pacman on Debian or brew/port on OS X, that allows you to easily install and update software without having to go through the bother of manually compiling them. The distribution running Galileo contains a package manager called opkg. The main problem is that by default, no channels are defined, so you cannot install anything. Luckily someone created a repository of packages ready for the Galileo. To set it up, you must edit the file /etc/opkg/base-feeds.conf and add these lines using vi:

src/gz all     http://repo.opkg.net/galileo/repo/all
src/gz clanton http://repo.opkg.net/galileo/repo/clanton
src/gz i586    http://repo.opkg.net/galileo/repo/i586

Save it and run opkg update. Once this is done you will also want to run opkg install --force-overwrite uclibc, otherwise you will get weird errors when trying to install something. Ta-da! Now all you have to do is run opkg install <packagename> and it will be installed. There aren't that many packages available on the repository yet, but you can already install Apache 2, FFMpeg, git, PHP and update Node.js to the latest version, as well as getting all sorts of compiling tools and libraries. For general maintenance, you will probably want to install nano, a text editor that's much easier to use than vi (the one supplied with the Linux image).

Connecting to an eduroam network

Make sure that you have antennas for your wifi chipset or the authentication/connection will keep dropping if the signal is not strong enough.

Connecting to an eduroam, or authenticated network (aka a lot of university networks) is trickier because it uses entreprise WPA and authentication. You will need to add this block to your /etc/wpa_supplicant.conf file. Networks are tried first to last, so you might want to put it before the block for micro_controllers. Change your SSID, identity (i.e. your normal university username) and password. The other settings are normally available from your university's IT service website, on how to connect to their network from Linux.

network={
    ssid="UoD_WiFi"
    scan_ssid=1
    key_mgmt=WPA-EAP
    eap=PEAP
    identity="username"
    password="p4ssw0rd"
    ca_cert="/etc/cert/eduroam.pem"
    phase1="peaplabel=0"
    phase2="auth=MSCHAPV2"
}

Now you'll notice that there is a reference to a certificate there, which is the one you need to accept the first time you connect to the UoD_WiFi network from a new device. I am not so sure if it's possible to manually get it when connecting from the Galileo, what I've done is take the one from my computer and copy it on the Galileo, it works just as well as I believe it's the same certificate for everyone. On MacOS X you can do that by opening the Keychain Access app in Utilities; in Categories (bottom left part of the screen) choose Certificates and find the one that corresponds to your university (it often has “radius” in the name). If you have more than one, take the one that hasn't expired yet. Right-click on it, choose Export and export it somewhere, taking care to export it as a .pem file (not .cer). Copy that to your SD card, then put it back in the Galileo and copy it to /etc/cert/eduroam.pem (you might have to mkdir /etc/cert first). On Windows or Linux, you will have to Google it as I haven't tried on these systems, but it should be possible to export the certificate. Once your certificate is there and your conf file updated, try restarting the network (reboot, or /etc/init.d/networking restart). And if you're lucky you should be able to connect to the network everywhere in the university!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment