Petter Reinholdtsen: Teaching vmdebootstrap to create Raspberry Pi SD card images
The
vmdebootstrap
program is a a very nice system to create virtual machine images. It
create a image file, add a partition table, mount it and run
debootstrap in the mounted directory to create a Debian system on a
stick. Yesterday, I decided to try to teach it how to make images for
Raspberry Pi, as part
of a plan to simplify the build system for
the FreedomBox
project. The FreedomBox project already uses vmdebootstrap for
the virtualbox images, but its current build system made multistrap
based system for Dreamplug images, and it is lacking support for
Raspberry Pi.
Armed with the knowledge on how to build "foreign" (aka non-native
architecture) chroots for Raspberry Pi, I dived into the vmdebootstrap
code and adjusted it to be able to build armel images on my amd64
Debian laptop. I ended up giving vmdebootstrap five new options,
allowing me to replicate the image creation process I use to make
Debian
Jessie based mesh node images for the Raspberry Pi. First, the
--foreign /path/to/binfm_handler option tell vmdebootstrap to
call debootstrap with --foreign and to copy the handler into the
generated chroot before running the second stage. This allow
vmdebootstrap to create armel images on an amd64 host. Next I added
two new options --bootsize size and --boottype
fstype to teach it to create a separate /boot/ partition with the
given file system type, allowing me to create an image with a vfat
partition for the /boot/ stuff. I also added a --variant
variant option to allow me to create smaller images without the
Debian base system packages installed. Finally, I added an option
--no-extlinux to tell vmdebootstrap to not install extlinux
as a boot loader. It is not needed on the Raspberry Pi and probably
most other non-x86 architectures. The changes were accepted by the
upstream author of vmdebootstrap yesterday and today, and is now
available from
the
upstream project page.
To use it to build a Raspberry Pi image using Debian Jessie, first
create a small script (the customize script) to add the non-free
binary blob needed to boot the Raspberry Pi and the APT source
list:
#!/bin/sh
set -e # Exit on first error
rootdir="$1"
cd "$rootdir"
cat <<EOF > etc/apt/sources.list
deb http://http.debian.net/debian/ jessie main contrib non-free
EOF
# Install non-free binary blob needed to boot Raspberry Pi. This
# install a kernel somewhere too.
wget https://raw.github.com/Hexxeh/rpi-update/master/rpi-update \
-O $rootdir/usr/bin/rpi-update
chmod a+x $rootdir/usr/bin/rpi-update
mkdir -p $rootdir/lib/modules
touch $rootdir/boot/start.elf
chroot $rootdir rpi-update
Next, fetch the latest vmdebootstrap script and call it like this
to build the image:
sudo ./vmdebootstrap \
--variant minbase \
--arch armel \
--distribution jessie \
--mirror http://http.debian.net/debian \
--image test.img \
--size 600M \
--bootsize 64M \
--boottype vfat \
--log-level debug \
--verbose \
--no-kernel \
--no-extlinux \
--root-password raspberry \
--hostname raspberrypi \
--foreign /usr/bin/qemu-arm-static \
--customize pwd /customize \
--package netbase \
--package git-core \
--package binutils \
--package ca-certificates \
--package wget \
--package kmod
The list of packages being installed are the ones needed by
rpi-update to make the image bootable on the Raspberry Pi, with the
exception of netbase, which is needed by debootstrap to find
/etc/hosts with the minbase variant. I really wish there was a way to
set up an Raspberry Pi using only packages in the Debian archive, but
that is not possible as far as I know, because it boots from the GPU
using a non-free binary blob.
The build host need debootstrap, kpartx and qemu-user-static and
probably a few others installed. I have not checked the complete
build dependency list.
The resulting image will not use the hardware floating point unit
on the Raspberry PI, because the armel architecture in Debian is not
optimized for that use. So the images created will be a bit slower
than Raspbian based images.
Birthdays all round
This has been a particularly important year for the Debian Project, as the project celebrated our
Thank you
There are many people to thank for the success of these projects and the wider success of the Debian GSoC team:
This post is just a bunch of random notes, but I think that things are going
well, this time.
format 35
files are much smaller than the lower resolution 360p files (due to the
former being encoded in High profile vs. the latter being encoded in
Constrained Baseline profile).
Hacker News is a fairly influential link aggregation site, with stories submitted and voted on by users. As explained in the 
Ana Guerrero Lopez (ana)
Who are you?
I'm a 30-something years old geek. I'm from Andalusia, Spain but live in France.
What do you do in Debian?
I work mostly on my packages, in sponsoring new people's packages and in
this very blog you're reading now. I also maintain an unofficial Google+
page about Debian. At $PAID job, I work in an internal Debian distribution
so from time to time, I get the opportunity to contribute back some of the
stuff we do there.
How and why did you start contributing to Debian?
I started using Debian around 2003 switching from Mandrake. I was a happy
Debian user when the Debian Women project started in the summer 2004. When
I saw the project announced, I asked myself why I wasn't contributing to
Debian and the rest is history... in a couple of weeks it'll be my 7 years
DD-versary! If for some reason you want a longer reply to this question,
read
After upgrading my Sid virtual machine hosting my Jenkins, build after git push stopped working. This is because version 1.503 and above require an auth token for triggering the build. Since it took me some time to search the web, I ve decided to blog about it to save time to other Jenkins users.
Under each project configuration screen, in the Build Triggers section, tick the Trigger builds remotely (e.g., from scripts) option. Then enter a random token (I used a password generator for it). Then in your post-receive hook, use what s below:
As 

![Isaac Newton by Sir Godfrey Kneller [Public domain], via Wikimedia Commons Isaac Newton by Sir Godfrey Kneller [Public domain], via Wikimedia Commons](http://upload.wikimedia.org/wikipedia/commons/3/39/GodfreyKneller-IsaacNewton-1689.jpg)