Skip to content

Instantly share code, notes, and snippets.

@javiermon
Last active December 17, 2015 07:08
Show Gist options
  • Save javiermon/5569997 to your computer and use it in GitHub Desktop.
Save javiermon/5569997 to your computer and use it in GitHub Desktop.
Script with gidelines for a 32bit chroot inside a amd64 os.
#!/bin/bash
# http://www.gentoo.org/proj/en/base/amd64/howtos/chroot.xml
USER=jmonteagudo
CHROOT=/chroot/precise-32
# mount the usual suspects
mount -o bind /tmp $CHROOT/tmp/
mount -t proc proc $CHROOT/proc/
mount -t sysfs sys $CHROOT/sys/
mount -o bind /dev $CHROOT/dev/
mount -t devpts pts $CHROOT/dev/pts/
# replicate network & time settings
cp -pf /etc/resolv.conf $CHROOT/etc/
cp -pf /etc/hosts $CHROOT/etc
cp -Ppf /etc/localtime $CHROOT/etc
# mount development directory
mount --bind /home/$USER/dev $CHROOT/home/$USER/dev/
# chroot like this is a 32 bit system
linux32 chroot $CHROOT/ /bin/bash
# clean up after exit
umount $CHROOT/home/$USER/dev/
umount $CHROOT/dev/pts/
umount $CHROOT/dev/
umount $CHROOT/sys/
umount $CHROOT/proc/
umount $CHROOT/tmp/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment