#!/bin/bash
CHRT="ROOT"
if [ $# != 1 ]; then
echo "usage: $0 image"
exit 1
fi
function mnt(){
mount -o bind $1 ${CHRT}$1
}
[ -f /proc/sys/fs/binfmt_misc/arm ] || echo ':arm:M::\x7fELF\x01\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x28\x00:\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff\xff:/usr/bin/qemu-arm-static:' > /proc/sys/fs/binfmt_misc/register
mount -o loop,offset=62914560 $1 ${CHRT}
#mount -o loop,offset=8652849152 $1 ${CHRT}/Data
mnt /dev
mnt /dev/pts
mnt /sys
mount -t proc none ${CHRT}/proc
mnt /run
chroot ${CHRT}