2013-06-20

Slitaz -- qemu-arm-static chroot-2

Chrooting to: /opt/rootfs-armhf/

root@slitaz:~# ls -l /opt/rootfs-armhf

1. download qemu-arm-static-1.1.2.tazpkg
http://tiny.cc/rh7wyw
# tazpkg -i qemu-arm-static-1.1.2.tazpkg

2. copy qemu-arm-static to rootfs-armhf
# cp /usr/bin/qemu-arm-static /opt/rootfs-armhf/usr/bin


3. Mount the binfmt_misc handler
# modprobe binfmt_misc
# mount -t binfmt_misc binfmt_misc /proc/sys/fs/binfmt_misc


4. register our format with the kernel via the procfs
root@slitaz:~# 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\x00\xff\xfe\xff\xff\xff:/usr/bin/qemu-arm-static:' > /proc/sys/fs/binfmt_misc/register


5. check register
root@slitaz:~# cat /proc/sys/fs/binfmt_misc/arm
enabled
interpreter /usr/bin/qemu-arm-static
flags:
offset 0
magic 7f454c4601010100000000000000000002002800
mask ffffffffffffff00ffffffffffff00fffeffffff


6. chroot rootfs-armhf
root@slitaz:~# tazdev -c /opt/rootfs-armhf/

Mounting virtual filesystems...                                    [ Done ]
Chrooting to: /opt/rootfs-armhf/

7.
root@slitaz:/# uname -m
armv6l


8.
root@slitaz:/# echo -e 'nameserver 8.8.8.8\n' > /etc/resolv.conf
root@slitaz:/# nslookup www.slitaz.org
Server:    8.8.8.8
Address 1: 8.8.8.8 google-public-dns-a.google.com

Name:      www.slitaz.org
Address 1: 94.23.61.29 pangolin.pimentvert.com
Address 2: 91.121.171.224 ks362096.kimsufi.com
root@slitaz:/#