AWS ARM instances for building Pi binaries

I wanted to build ROS Kinetic for the Pi Zero W for an upcoming project. The Zero itself is too slow, but it turns out you can use a chroot on an Amazon a1 instance and build there instead. The a1 instances go up to 16 vCPUs and 32 GiB of memory with good storage and networking so it’s much faster than a Pi with a SD card.

The rough steps are:

Get the latest Raspbian rootfs:

sudo apt install emacs-nox kpartx unzip schroot
wget https://downloads.raspberrypi.org/raspbian_lite_latest
unzip raspbian_lite_latest.zip
kpartx -v -a 2019-04-08-raspbian-stretch-lite.img
sudo mount /dev/mapper/loop2p2 /mnt

Copy /mnt into /srv/chroot/pi.

Use schroot to give a shell into the chroot.