How to Transfer files between Host and Qemu
If the image support networking, you could use ssh (install dropbear server in qemu) or nfs to transfer files between the host computer and qemu, or even run your program from the NFS share. This should be possible to do that on the Overo emulator since it support Ethernet. However, although I can access Internet, I cannot access the host via ssh as the host is in a private subnetwork (192.168.0.0) and qemu in another (10.0.2.0). We would probably have to enable bridge networking for that but the tun driver is apparently not compiled in ALIP kernel. I’ll look into that later on. [Update: Finally, we don’t need tun/tap to make this work, please read http://www.cnx-software.com/2011/10/02/how-to-transfer-files-between-host-and-qemu-via-ssh-and-nfs/ for details.]
Today, I’ll just show how to mount a Qemu image and copy files as described on the “Updating Image Contents” section of https://wiki.linaro.org/Resources/HowTo/Qemu-beagleboard:
- Find the ext3 partition inside the image file:
#fdisk -lu overo_sd_alip.img | grep overo
You must set cylinders.
You can do this from the extra functions menu.
Disk overo_sd_alip.img: 0 MB, 0 bytes
overo_sd_alip.img1 * 63 106494 53216 c W95 FAT32 (LBA)
overo_sd_alip.img2 106496 6291455 3092480 83 Linux
- Take the “start” number of the qemu image (106496) and mount the qemu image at this offset (start multiplied by block size (512)):
sudo mount -o loop,offset=$[106496*512] overo_sd_alip.img mnt
That’s it. You should now be able to access the rootfs in mnt directory and transfer files between the host and the qemu image. Once you are done simply “umount mnt” and start qemu again.