Arm qemu chroot: Difference between revisions
Jump to navigation
Jump to search
(Created page with " apt-get install qemu-user-static We need to mount the image using loopback, but since the image contains multiple partitions, we require kpartx $ sudo kpartx -a -v 2012-12...") |
No edit summary |
||
Line 3: | Line 3: | ||
We need to mount the image using loopback, but since the image contains multiple partitions, we require kpartx | We need to mount the image using loopback, but since the image contains multiple partitions, we require kpartx | ||
sudo cp /usr/bin/qemu-arm-static /mnt/temp/usr/bin sudo mount -o bind /dev /mnt/temp/dev sudo mount -o bind /proc /mnt/temp/proc sudo mount -o bind /sys /mnt/temp/sys | $ sudo kpartx -a -v 2012-12-16-wheezy-raspbian.img | ||
add map loop0p1 (252:8): 0 114688 linear /dev/loop0 8192 | |||
add map loop0p2 (252:9): 0 5763072 linear /dev/loop0 122880 | |||
mount /dev/mapper/loop0p2 /mnt/temp | |||
cp /usr/bin/qemu-arm-static /mnt/temp/usr/bin | |||
sudo mount -o bind /dev /mnt/temp/dev | |||
sudo mount -o bind /proc /mnt/temp/proc | |||
sudo mount -o bind /sys /mnt/temp/sys | |||
This registers the static QEMU we copied as arm-interpreter to the kernel. The path specified needs to be the same on both your linux machine and the Raspberry Pi environment. | This registers the static QEMU we copied as arm-interpreter to the kernel. The path specified needs to be the same on both your linux machine and the Raspberry Pi environment. | ||
Revision as of 15:53, 18 June 2015
apt-get install qemu-user-static
We need to mount the image using loopback, but since the image contains multiple partitions, we require kpartx
$ sudo kpartx -a -v 2012-12-16-wheezy-raspbian.img add map loop0p1 (252:8): 0 114688 linear /dev/loop0 8192 add map loop0p2 (252:9): 0 5763072 linear /dev/loop0 122880 mount /dev/mapper/loop0p2 /mnt/temp
cp /usr/bin/qemu-arm-static /mnt/temp/usr/bin sudo mount -o bind /dev /mnt/temp/dev sudo mount -o bind /proc /mnt/temp/proc sudo mount -o bind /sys /mnt/temp/sys
This registers the static QEMU we copied as arm-interpreter to the kernel. The path specified needs to be the same on both your linux machine and the Raspberry Pi environment.
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
chroot /mnt/temp
Clean
umount /mnt/temp/dev umount /mnt/temp/proc umount /mnt/temp/sys umount /mnt/temp kpartx -d -v 2012-12-16-wheezy-raspbian.img