Script to debootstrap Ubuntu [en]

During the last days I made some progress with my script to debootstrap Ubuntu for Raspberry Pi 2 and Banana Pi (M1, Pro and R1). The script creates images of any size with your package selection based on any Ubuntu release (just Trusty, Vivid and Wily make sense). Since the script does not support cross compiling it has to be executed on a board with an ARMv7 CPU. And since kernels are being compiled the userland has to be ARMv7 as well. I suggest using my latest PiBuntu Minimal (download link on the right hand).

First check out the script and associated config files:

cd /usr/src
git clone https://github.com/mschlenker/Pi-Scripts

Now change to a folder (mount point) with enough free space. Because of the two kernel builds and the large git repo of RPi’s bootloader, 12GB are recommended. Here you can start building the image. Environment variables steer the build process. This example builds a 2GB minimal image based on Vivid (15.04):

cd /mnt/archiv/pibootstrap
PIDISTRO=vivid \
PIUSER=pi \
PIHOSTNAME=pi \
PISIZE=2000000000 PISWAP=500000000 \
PILANG=en_US.UTF-8 \
bash /usr/src/Pi-Scripts/shellscripts/pi-buntu-strap.sh

And to build a 4GB image based on Ubuntu 15.10 (Beta!) with Mate desktop and german keyboard as well as localization, issue:

PIDISTRO=wily \
PIUSER=pi \
PIHOSTNAME=pi \
PIPACKAGES='ubuntu-mate-core '\
'ubuntu-mate-desktop '\
'language-pack-en language-pack-de '\
'language-pack-fr language-pack-es '\
'language-pack-pt' \
PISIZE=4000000000 PISWAP=500000000 \
PILANG=de_DE.UTF-8 \
PIXKBLAYOUT="de" \
bash /usr/src/Pi-Scripts/shellscripts/pi-buntu-strap.sh

The resulting image is saved as disk.img.

There is still room for improvement: Alls steps should be moved to functions, there is currently no possibility to build images for RPi2 or BPi, the GitHub repo for the RPi bootloader takes some three Gigs and both kernels are linked again prior to installation (this costs a few minutes). And there is no possibilty to install to SD card directly.

Comments? Please use Google+: