Bootstrapping Ubuntu MATE for an armhf base

The following was built on a Raspberry Pi 2 running Raspbian. I chose to build it on the Pi because the host and guest architecture are both armhf and hence the bootstrapping process is easier. Should you choose to build it on an x86 based architecture, using qemu for emulation is a good idea.

Create a directory where you wish to build the system -

mkdir -p $D

Bootstrap a base armhf system -

debootstrap vivid $D

Note: vivid can be replaces with trusty, utopic etc.

Mount required filesystems -

mount -t proc none $D/proc
mount -t sysfs none $D/sysfs

Setup the initial sources.list in $D/etc/apt/sources.list -

deb vivid main restricted universe multiverse
deb vivid-updates main restricted universe multiverse
deb vivid-security main restricted universe multiverse
deb vivid-backports main restricted universe multiverse

Update your installation -

chroot $D apt-get update && apt-get -y -u dist-upgrade

Install Standard packages -

chroot $D apt-get -y install ubuntu-standard initramfs-tools language-pack-en

Install the MATE Desktop Environment -

chroot $D apt-get -y install ubuntu-mate-core ubuntu-mate-desktop

If you are building for the Raspberry Pi 2, you will have to download packages from Ryan Finnie’s PPA and install them manually using dpkg -

chroot $D dpkg -i <packagename>.deb

Copy the kernel to the boot directory -

VMLINUZ="$(ls -1 $D/boot/vmlinuz-* | sort | tail -n 1)"
[ -z "$VMLINUZ" ] && exit 1
cp $VMLINUZ $D/boot/firmware/kernel7.img

Setup the following -

  1. fstab by editing $D/etc/fstab
  2. hostname by editing $D/etc/hostname
  3. hosts by editing $D/etc/hosts
  4. Add a default user using adduser and set a password.
  5. interfaces by editing $D/etc/network/interfaces
  6. Load the sound modules on boot by adding snd_bcm2835 and bcm2708_rng to $D/lib/modules-load.d/rpi2.conf

Unmount mounted filesystems -

umount $D/proc
umount $D/sys

Now you have a fully functional Ubuntu MATE 15.04 armhf system present in the directory, which can also be converted to an image file :smiley: