sudo apt-get install qemu
Create a hard disk for your virtual machine with required capacity.
qemu-img create -f raw armdisk.img 8G
You can then install Debian using an ISO CD or directly from vmlinuz
First, you should decide what CPU and machine type you want to emulate.
You can get a list of all supported CPUs (to be passed with -cpu option, see later below):
qemu-system-arm -cpu help
You can get a list of all supported machines (to be passed with -M option, see later below):
qemu-system-arm -machine help
In this example, I chose the cortex-a9 CPU and vexpress-a9 machine. This is an ARMv7 CPU which Debian calls as armhf (ARM hard float). You must download vmlinuz and initrd files for, say Wheezy armhf netboot. Cortex-A8, A9, A15 are all ARMv7 CPUs.
You can emulate ARMv6 which Debian calls as armel by downloading the corresponding files for Wheezy armel netboot.
Note that you need 'armel' for ARM v5, v6. Raspberry Pi uses ARMv6. In this case, the cpu is arm926 and machine is versatilepb.
Create a virtual machine with 1024 MB RAM and a Cortex-A9 CPU:
qemu-system-arm -m 1024M -hda armdisk.img \
-M vexpress-a9 -cpu cortex-a9 \
-kernel vmlinuz-3.2.0-4-vexpress -initrd initrd.gz \
-append "root=/dev/ram"
Specifying -cpu is optional. It defaults to -cpu=any. However, -M is mandatory.
This will start a new QEMU window and the Debian installer will kick-in. Just proceed with the installation (takes maybe 3 hours or so).
You can start your virtual machine after the installation complete as follows:
qemu -m 1024 -hda armdisk.img
NOTE: For creating ARMv6, just pass versatilepb:
qemu-system-arm -m 1024M -M versatilepb \
-kernel vmlinuz-3.2.0-4-versatile -initrd initrd.gz \
-append "root=/dev/ram" -hda armdisk.img
Download netboot ISO for armhf or armel as needed.
WAIT! Apparently, these Debian CD images are not bootable! But Ubuntu's ARM CD image works [2].
[1] http://www.linuxforu.com/2011/05/quick-quide-to-qemu-setup/ [2] http://blog.troyastle.com/2010/07/building-arm-powered-debian-vm-with.html [3] Differences between ARM926, ARM1136, A8 and A9