Hardware
- Wireless network connection
- Asus N13 Realtek Dongle (£16)
- Wireless keyboard and mouse
- Logitech mk260 (£17)
- Single power source for USB hub & Pi
- D-Link H7 (£22)
- Debian Image (debian6-19-04-2012)
- Passwordless SSH on boot
- VNC server on boot
The Plan
There's nothing quite like research when it comes to setting up new hardware, especially kit as experimental as the Pi. Here are the websites to whom I'm truly thankful for advice and instruction.
- Raspberry Pi (http://www.raspberrypi.org). Register to post!
- Raspberry Pi WiFi adapter testing (http://www.element14.com/community/docs/DOC-44703)
- Raspberry Pi meets Edimax EW-7811Un wireless adapter (http://www.ctrl-alt-del.cc/2012/05/raspberry-pi-meets-edimax-ew-7811un-wireless-ada.html)
- Mr Engman's wifi adapter & updater script (http://dl.dropbox.com/u/80256631/install-rtl8188cus.txt)
Setting up tutorial
Part A: pre switch on
You need a host machine to preconfigure your SD card. If you've not got one, don't bother reading further. Sell your Pi on ebay, and go for a pint instead. If on the other hand, you are up for the challenge read on. The first section deals with getting the pi to boot with wifi enabled. It borrows heavily from the pi startup guide and Tomasz Miklas posting on ctrl-alt-del.cc.
- Download debian6-19-04-2012 image. Get your image here http://www.raspberrypi.org/downloads
- Copy the image to an SD card. In linux we dd, on Windows you'll do something else. My SD card is /dev/sdc, and I'd changed directory to be in the same place as the image input file
- Sync the SD card before removing it to ensure data writing completes without error
- Remove SD card, then reinsert in to the host machine. There's much more preparation to be done before getting anywhere near the Pi. On inserting the card into a Linux host, two new volumes will appear. One is the 79 Mb DOS boot disc, the other is the 2 Gb root volume. I have a 4 Gb SD card, so I need to resize the partitions on the new volumes to reclaim lost space. I did this in graphical parted (Gparted)· Note that the volumes must be unmounted before Parted can work on them. My linux automounts SD cards under /media using volume UUIDs as names for mount points.
- Move swap to end of volume on right
- Resized Root to use maximum free space Finally remove & reinsert the SD card to remount mount it on the host machine for further file copying
- Download and copy over firmware updates and kernel modules. GitHub hosts the necessary files, so you'll need github core tools installed to carry out the next steps. Git Help at https://github.com/raspberrypi
- Copy all files from /firmware/boot and firmware/opt/vc to their respective places on the SD card. Note that on Linux if you copy in a file with the same name, the original file is replaced without warning.
cd /media/95F5-0D7A/boot cp -r ~/git_pi/firmware/boot/* . rm -rf /media/18c27e44-ad29-4264-9506-c93bb7083f47/opt/vc cp -r ~/git_pi/firmware/opt/vc /media/18c27e44-ad29-4264-9506-c93bb7083f47/opt/ rm -r /media/18c27e44-ad29-4264-9506-c93bb7083f47/lib/modules/3.1.9+ cp -r ~/git_pi/firmware/lib/modules/3.1.9+ /media/18c27e44-ad29-4264-9506-c93bb7083f47/lib/modules/
- Now git clone firmware tools, as below, and copy over libstdc++.so.6.0.14
cd ~/git_pi git clone git://github.com/raspberrypi/tools.git cd tools git checkout 3aba47b cp arm-bcm2708/linux-x86/arm-bcm2708-linux-gnueabi/sys-root/lib/libstdc++.so.6.0.14 \
/media/18c27e44-ad29-4264-9506-c93bb7083f47/usr/lib/.
- Finally, copy over the wireless driver module
cd ~/pi_git/ wget http://www.electrictea.co.uk/rpi/8192cu.tar.gz gunzip -c 8192cu.tar.gz |tar -xf - cp 8192cu.ko /media/18c27e44-ad29-4264-9506-c93bb7083f47/lib/modules/3.1.9+/kernel/net/wireless/.
- Now we do a bit of configuration before firing up the pi. Set configuration for WPA2 (or whatever you need), load wireless module every time and make active at boot.
nano /media/18c27e44-ad29-4264-9506-c93bb7083f47/etc/wpa_supplicant.conf
Enter text as shown (replacing your SSID and passphrase)ctrl_interface=/var/run/wpa_supplicant network={ ssid="_your_SSID_" scan_ssid=1 proto=RSN key_mgmt=WPA-PSK pairwise=CCMP TKIP group=CCMP TKIP # to get encoded PSK run: wpa_passphrase
Two things to note: 1) double quotes around SSID, 2) PSK is the output of wpa_passphrase _your_SSIDpsk=YOUR KEY } - Configure network interfaces
- Disable loading of native wifi driver, ensure our wifi driver loads, even when dongle isn't present.
echo '8192cu' >> /media/18c27e44-ad29-4264-9506-c93bb7083f47/etc/modules echo 'blacklist rtl8192cu' >> /media/18c27e44-ad29-4264-9506-c93bb7083f47/etc/modprobe.d/blacklist.conf
- Enable ssh at boot
cd /media/95F5-0D7A mv boot_enable_ssh.rc boot.rc
sudo dd if=debian6-19-04-2012.img of=/dev/sdc
Being executed from the command line, it may appear as if nothing happens. Mine took around 4 min to complete.
sudo sync
sudo umount /media/18c27e44-ad29-4264-9506-c93bb7083f47/
sudo umount /media/95F5-0D7A/
I fired up Gparted, selected /dev/sdc as the target volume and did two things
cd
mkdir git_pi
cd git_pi
git clone git://github.com/raspberrypi/firmware.git
cd firmware
git checkout a8f8d24
Key in these steps are ensuring that we use firmware previously shown to work - the checkout command specifies the code revision we will use. Big thumbs up to Tomasz Miklas.
nano /media/18c27e44-ad29-4264-9506-c93bb7083f47/etc/network/interfaces
This is what I have ...
auto lo
iface lo inet loopback
iface eth0 inet dhcp
auto wlan0
iface wlan0 inet dhcp
pre-up wpa_supplicant -Dwext -i wlan0 -c /etc/wpa_supplicant.conf -B
Headless Pi powered from USB hub (white kindle cable), wireless dongle at back (under power lead) keyboard / mouse receiver disconnected for boot |
Power on wasn't so straight forward. I found out by trial and error that the USB receiver for the keyboard / mouse conflicted with the WiFi Dongle, and needed to be disconnected at boot. Other than that, I was able to SSH in to the Pi within 2 min of turning on. In the next post I'll describe the elementary set up to get VNC at boot, create local accounts and set up passwordless SSH.
No comments:
Post a Comment