I want to be able to build packages for Raspbian but on a regular machine. Luckily, there is the very handy qemu-debootstrap which will let you setup a normal debootstrap chroot that runs via qemu. Here’s how I did it (this is on Squeeze, for newer releases, you won’t need the backports. You need qemu-user-static v1.1.2 or newer):
sudo apt-get -t squeeze-backports install qemu-user-static sudo apt-get install dchroot schroot debootstrap wget wget https://archive.raspbian.org/raspbian/pool/main/r/raspbian-archive-keyring/raspbian-archive-keyring_20120528.2_all.deb sudo dpkg -i raspbian-archive-keyring_20120528.2_all.deb sudo mkdir /var/chroot/raspbian-armhf/ sudo qemu-debootstrap --keyring /usr/share/keyrings/raspbian-archive-keyring.gpg \ --arch armhf wheezy /var/chroot/raspbian-armhf http://archive.raspbian.org/raspbian echo raspbian-armhf | sudo tee /var/chroot/raspbian-armhf/etc/debian_chroot sudo ln -s ../proc/mounts /var/chroot/raspbian-armhf/etc/mtab sudo cp /etc/passwd /etc/group /etc/shadow /var/chroot/raspbian-armhf/etc
Then I edited my /etc/fstab
to add the mount points:
# # raspbian-armhf chroot # /home /var/chroot/raspbian-armhf/home none bind 0 0 /tmp /var/chroot/raspbian-armhf/tmp none bind 0 0 /dev /var/chroot/raspbian-armhf/dev none bind 0 0 proc-chroot /var/chroot/raspbian-armhf/proc proc defaults 0 0 devpts-chroot /var/chroot/raspbian-armhf/dev/pts devpts defaults 0 0
I edited /etc/dchroot.conf to add the new chroot:
raspbian-armhf /var/chroot/raspbian-armhf
And then /etc/schroot/schroot.conf to add the new chroot there:
[raspbian-armhf] description=raspbian wheezy armhf location=/var/chroot/raspbian-armhf users=pd groups=sbuild-security root-groups=root personality=linux32
Now I’m ready for the last steps, then I can use my chroot:
sudo mount -a dchroot -d -c raspbian-armhf
If it was successful, you should see your prompt change to:
(raspbian-armhf)pd@pdlab3:~$