It was a lot easier to set up QEMU than I expected it would be. Easier even than the online tutorials make it seem.
apt-get install qemu-kvm qemu-kvm-extras
- Download a prebuild image for the guest system you want to run. In my case, I wanted
armel
, which meant I also had to downloadinitrd
andvmlinuz
images. - If you want to copy files from the host system (i.e., your computer) into the guest, you need to make a “raw” image that you can mount from both sides:
$ qemu-img create data.img <SIZE> Formatting 'data.img', fmt=raw size=... $ mke3fs -j data.img mke2fs 1.41.9 (22-Aug-2009) data.img is not a block special device. Proceed anyway? (y,n) y ... $ sudo mount -o rw,loop data.img <MOUNT_POINT>
<SIZE>
is a size in kilobytes, or use suffixesM
andG
for megabytes/gigabytes. The image only has to be big enough to temporarily hold the data you want to copy; you can move it to the guest’s root filesystem before you start working with it.<MOUNT_POINT>
is any existing empty directory where you want to mount the image. I just made a directoryfoo
in the same directory as the image.You should copy over any data now, because apparently it would be VERY BAD to do that while QEMU is running.
- Now it’s time to start the sucker. An example command line will be given in the
README
for the image you downloaded. I use:qemu-system-arm -M versatilepb -kernel vmlinuz-2.6.26-1-versatile \ -initrd initrd.img-2.6.26-1-versatile -hda debian_lenny_armel_small.qcow2 \ -hdb data.img -append "root=/dev/sda1"
Notice the
-hdb data.img
argument. That sets up the data image we set up in the last step as a disk drive in the guest system. You can probably login asuser
with passworduser
. The root password is probablyroot
. - Once you’re logged in, make a directory to use as a mount point, then
su
and do:mount -t ext3 /dev/sdb <MOUNT_POINT>
- Now you can copy over your data. And here’s the beautiful part: you should be able to get on the network with no problem. If you need anything that’s not installed, just
apt-get update
and thenapt-get install
the missing package. Should work, no problem.