For each Cotswold Raspberry Jam, I produce a custom version of the Raspberry Pi’s Raspbian operating system, all set up ready for tutorials and other projects at the event. You can download the one for our Sat 2 July 2016 event (1GB .zip) using Bittorrent:
Bear in mind that if you’re attending the event, we’ll have plenty of ready-made SD cards for you to borrow (or buy for a fiver), so this isn’t a prerequisite for attendees.
After downloading, follow the instructions on how to install a Raspberry Pi operating system image. You’ll need at least a 4GB micro SD card, and any files already on that card will be erased.
Your Raspberry Pi will automatically reboot once only when it first uses our image. Details below, but essentially you don’t need to worry about it. The username and password remain the same as normal Raspbian; username pi with password raspberry .
Our custom image features:
- Raspbian Jessie, up-to-date as of the week it was produced, including GPIO Zero
- All the tutorial files
- All libraries & programs set up for our tutorials
- WiFi set up for our event (you’ll need a WiFi adapter or Pi3)
- 1GB zipped and under 3GB unzipped; Wolfram Alpha and Libreoffice have been removed to reduce the size of the image
- MT Paint graphics editor, Abiword wordprocessor, GNUmeric spreadsheet, Eye of Gnome image viewer / slideshow, FBI framebuffer image viewer / slideshow, VNC server & client have been added
In addition, we have a fancy automatic setup system. I’ll blog about that later (follow @CotswoldJam on Twitter). In brief, for the first time the image is booted (and not subsequent boots):
- From rc.local , it checks for the existence of the file /boot/1stboot.txt – if it can’t find it, it does nothing and exits
- It deletes /boot/1stboot.txt so it doesn’t do the process ever again
- It expands the filesystem to fill the whole SD card
- It sets the hostname to rpi-XXXX where XXXX is hopefully unique
- It reboots
This is why our image will reboot automatically when first used. This reboot should happen before the desktop appears (hopefully; I could really do with moving the script from rc.local to a proper systemd target).
XXXX is the last 4 digits of the SD card’s CID serial number. The CID should be unique to each and every SD card (if it isn’t, you’ve probably got a fake card). CIDs were originally designed to provide copy-protection for big music & movie companies – there’s a certain satisfaction in subverting it for use with free software for a children’s hacking club.
By setting a (hopefully) unique hostname, we can address any of the Raspberry Pis at our event, over the network, individually. This is done with Avahi/Zeroconf/Bonjour, a standard which (amongst other things) allows computers on a local network to find out each other’s IP addresses using hostnames without having to use a domain name server.
I’ve written a few command-line scripts to help manage this, and to browse the network for Zeroconf domains. I’ve also written a nice script to fully automate the process of squishing an SD card image down to minimum size (oh boy, does an SSD make a difference) and I have some tips on mass duplication of SD cards. I’ll explain in more detail in another blog post, and publish the scripts, hopefully next week.
— Andrew Oakley