在x86上chroot arm平台
Oct 3, 2015
个人兴趣使然购买了raspberry pi2,本着实践的精神尝试在上面安装Gentoo for ARM,嗯,一切都进展顺利,结果到了Chroot阶段就出了问题.
/bin/bash: Exec format error
一查发现不能直接Chroot,需要qemu这个神器来当胶水,Okay,开始配置qemu.
本文使用环境是Archlinux 64bit
yaourt -S qemu-user-static binfmt-support
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
如果以上命令失败的话请使用sudo.
之后只需要把qemu-static-arm拷贝到$Chroot_dir/usr/bin里面就好了
cp qemu-static-arm /mnt/gentoo/usr/bin/
chroot /mnt/gentoo /bin/bash
This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.