notes/Chroot for cross arch ARM-eCgTh158.sh
#!/bin/bash
dir="debian_armel_wheezy"
ver="wheezy"
#create empty image and mount it
img=debian_arm.img
dd bs=512 count=5400000 if=/dev/zero of=$img #creates a empty IMG file that is about 2GB
fdisk $img
mkfs.ext4 $img
mkdir $dir
modprobe loop
mount -o loop $img $dir
#sudo cp -pfr squashfs-root/* op/ #copies with permissions intact
#https://wiki.debian.org/EmDebian/CrossDebootstrap#QEMU.2Fdebootstrap_approach
apt-get install binfmt-support qemu qemu-user-static debootstrap
#mkdir $dir
debootstrap --foreign --arch armel $ver $dir http://ftp.debian.org/debian/
cp /usr/bin/qemu-arm-static $dir/usr/bin
DEBIAN_FRONTEND=noninteractive DEBCONF_NONINTERACTIVE_SEEN=true \
LC_ALL=C LANGUAGE=C LANG=C chroot $dir /debootstrap/debootstrap --second-stage
DEBIAN_FRONTEND=noninteractive DEBCONF_NONINTERACTIVE_SEEN=true \
LC_ALL=C LANGUAGE=C LANG=C chroot $dir dpkg --configure -a
echo "Welcome to your ARM chroot!"
chroot $dir bash
################notes##########
echo “deb http://http.debian.net/debian wheezy main non-free contrib” > /etc/apt/sources.list
echo “export PATH=/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/sbin” >> /root/.bashrc
echo “export TERM=xterm” >> /root/.bashrc
###########bashrc######
export PATH=/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/sbin
export TERM=xterm
export HOME=/root
syntax highlighted by Code2HTML, v. 0.9.1