Chroot is one of the (thousand) reason because I love Linux!
From Wikipedia
A chroot on Unix operating systems is an operation that changes the apparent root directory for the current running process and its children. A program that is run in such a modified environment cannot name (and therefore normally not access) files outside the designated directory tree. The term "chroot" may refer to the chroot system call or the chroot wrapper program. The modified environment is called a "chroot jail".
To execute a fully working chrooting you should know some trick:
xhost+ # be careful with this command, it disable x access policy
CHROOTDIR="/tmp/myfirstchrooting" # "destination" folder mount /dev/sdx $CHROOTDIR # if the source is a device mount /path/linux.img $CHROOTDIR -o loop # if the source is an image
(REMBEMBER THAT YOU ARE REPLACING)
sudo cp /etc/hosts $CHROOTDIR/etc/hosts sudo cp /etc/fstab $CHROOTDIR/etc/fstab sudo cp /etc/resolv.conf $CHROOTDIR/etc/resolv.conf
sudo mount -o bind /proc $CHROOTDIR/proc sudo mount -o bind /dev $CHROOTDIR/dev sudo mount -o bind /dev/pts $CHROOTDIR/dev/pts sudo mount -o bind /dev/shm $CHROOTDIR/dev/shm sudo mount -o bind /tmp $CHROOTDIR/tmp sudo mount -o bind /var/tmp $CHROOTDIR/var/tmp #sudo mount -o bind /proc/bus/usb $CHROOTDIR/proc/bus/usb # not more really useful sudo mount -o bind /sys $CHROOTDIR/sys
sudo chroot $CHROOTDIR /bin/bash
export DISPLAY=:1
This is the reason because I love Debian! :D You should do these two steps and then forget that chroot destination is a foreign architecture!
sudo apt-get install qemu-user-static binfmt-support
cp /usr/bin/qemu-arm-static /target_fs/usr/bin # replace "arm" with your foreign architecture