The work continues in https://github.com/openrightsgroup/lepidopter. Please join us there instead.
lepidopter - Create OONI powered Raspberry Pi images based on spindle
spindle is a set of scripts to aid building and working on a distribution image. I've been using this tool to generate Debian wheezy images for the Raspberry Pi, with the aim of producing reproducible, unbooted, clean setups that require no manual intervention. It works by producing a series of image files in QEMU's QED format (I exploit the format's support for backing files and copy on write).
It's not massively user friendly yet, but hopefully that should soon change (and of course, patches are welcome).
setup_spindle_environment
: Sets up an schroot using wheezy and installs the pre-requisites needed for spindle (mainly QEMU, as it turns out I haven't used augeas). If you don't use this, please make sure you have at least QEMU 1.0.1wheezy-stage0
: Create and partition an SD card image, perform the initial debootstrap on the host and copy the files to the SD image.wheezy-stage1
: Complete second stage of debootstrap under QEMU after first setting up a squashfs filesystem derived from Rob Landley's excellent Aboriginal Linux. Setup dropbear.wheezy-stage2-lepidopter
: Add in Raspberry Pi 'firmware' and do misc config (e.g.
fstab, network interfaces, hostname). The resulting image is bootable.wheezy-stage3-lepidopter
: Install and configure a few useful packages (such as ifplugd, sudo).wheezy-stage4-lepidopter
: Install ooni-probe and needed dependencirs.
The following describes how to start building SD card images using spindle.
The process isn't massively user friendly for people with no experience at
all, but if you're currently doing this by hand then hopefully you'll find it
helpful. Note that executing the downgrade_qemu
script is necessary on most
Debian and Ubuntu versions right now.
sudo ./setup_spindle_environment my_spindle_chroot
sudo modprobe nbd max_part=16
schroot -c spindle
sudo ./downgrade_qemu
./wheezy-stage0
./wheezy-stage1
./wheezy-stage2-lepidopter
./wheezy-stage3-lepidopter
./wheezy-stage4-lepidopter
./helper export_image_for_release out/stage4-lepidopter.qed lepidopter.img
Now you can write stage4-lepidopter.img to SD card or test the image under QEMU (see section Testing image with QEMU).
.. ..
Requires a kernel image, build your own or use cnxsoft's zImage_3.1.9
- Run lepidopter image in QEMU and redirect SSH connections from host port 2222 to SSH port on the guest:
qemu-system-arm -M versatilepb -cpu arm1136-r2 -hda lepidopter.img -kernel zImage_3.1.9 \
-m 256 -append "root=/dev/sda2" -redir tcp:2222::22
- You can now connect to lepidopter SSH (use password pi):
ssh -P 2222 pi@localhost