Arm qemu chroot: Difference between revisions

From VoIPmonitor.org
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
 
(2 intermediate revisions by the same user not shown)
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 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  $ sudo mount /dev/mapper/loop0p2 /mnt/temp


  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.


Line 17: Line 27:
   
   
  kpartx -d -v 2012-12-16-wheezy-raspbian.img
  kpartx -d -v 2012-12-16-wheezy-raspbian.img
= source =
http://sentryytech.blogspot.cz/2013/02/faster-compiling-on-emulated-raspberry.html
qemu-system-arm -kernel kernel-qemu -cpu arm1176 -m 256 -M versatilepb -no-reboot  -append "root=/dev/sda2 panic=1 console=ttyAMA0" -hda /root/raspberian_gcc4_8_1.img  -redir tcp:5022::22 -nographic

Latest revision as of 12:19, 22 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

source

http://sentryytech.blogspot.cz/2013/02/faster-compiling-on-emulated-raspberry.html

qemu-system-arm -kernel kernel-qemu -cpu arm1176 -m 256 -M versatilepb -no-reboot  -append "root=/dev/sda2 panic=1 console=ttyAMA0" -hda /root/raspberian_gcc4_8_1.img  -redir tcp:5022::22 -nographic