Skip to content

Instantly share code, notes, and snippets.

@oznu
Last active December 22, 2020 15:36
Show Gist options
  • Save oznu/b5efd7784e5a820ec3746820f2183dc0 to your computer and use it in GitHub Desktop.
Save oznu/b5efd7784e5a820ec3746820f2183dc0 to your computer and use it in GitHub Desktop.
Create a Raspbian Chroot Environment Emulating ARM
#!/bin/bash
CHROOT_DIR=/tmp/raspbian-chroot
MIRROR=http://archive.raspbian.org/raspbian
VERSION=jessie
CHROOT_ARCH=armhf
sudo apt-get install -y debootstrap qemu-user-static binfmt-support sbuild
sudo mkdir -p $CHROOT_DIR
sudo debootstrap --foreign --no-check-gpg --include=fakeroot,build-essential \
--arch=${CHROOT_ARCH} ${VERSION} ${CHROOT_DIR} ${MIRROR}
sudo cp /usr/bin/qemu-arm-static ${CHROOT_DIR}/usr/bin/
sudo chroot ${CHROOT_DIR} ./debootstrap/debootstrap --second-stage
sudo sbuild-createchroot --arch=${CHROOT_ARCH} --foreign --setup-only \
${VERSION} ${CHROOT_DIR} ${MIRROR}
# Now you can chroot into Raspbian:
# sudo chroot /tmp/raspbian-chroot bash
# root@server:/# cat /etc/*release*
# PRETTY_NAME="Raspbian GNU/Linux 7 (wheezy)"
# NAME="Raspbian GNU/Linux"
# root@server:/# uname -m
# armv7l
@oznu
Copy link
Author

oznu commented Jun 26, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment