The instructions in my previous post about building an image for the Beagelbone Black rely on a pre-packaged root filesystem. Here are a few simple steps on how I build my own rootfs.

We need:

apt-get install debootstrap qemu-user-static

Run debootstrap, need to be root for all of these tasks.

mkdir -p /tmp/rootfs
debootstrap --no-check-gpg     --arch=armhf     --include=ssh     --foreign     wheezy /tmp/rootfs http://ftp.ca.debian.org/debian

Now perform any customizations needed. I.e. the rootfs changes in the previous post instructions could be performed now.

Copy the qemu binary to the chroot future chroot.

cp /usr/bin/qemu-arm-static /tmp/rootfs/usr/bin/

Now chroot to the new install and run second stage debootstrap. Also create a place to mount uboot and create an archive of the file system.

chroot /tmp/rootfs /bin/bash
/debootstrap/debootstrap --second-stage
mkdir /boot/uboot
tar cpf archive.tar --exclude=qemu-arm-static --exclude=archive.tar .
exit

Cleanup.

rm /tmp/rootfs/usr/bin/qemu-arm-static

Now we have a complete proper root filesystem. The tar archive is at /tmp/rootfs/archive.tar.

Enjoy!