In this post I will explain how to install Debian Armel under QEMU.
Well, there are various reasons to you have a ARM Linux distro inside a Virtual Machine. One of them would be to have a test environment to you validate your programs before to release to an embedded linux (ARM).
Debian was choosed because is the most supported ARM distro and you will have an compatible environment with your embedded system (eglibc).
Hey! Ho! Let’s go:
  • Download a ARM kernel and a vmlinuz image under debian.org FTP site (I choosed squeeze/testing flavor):
wget http://ftp.debian.org/debian/dists/testing/main/installer-armel/current/images/versatile/netboot/vmlinuz-2.6.32-5-versatile

wget http://ftp.debian.org/debian/dists/testing/main/installer-armel/current/images/versatile/netboot/initrd.gz
  • Create a disk image (please, create a raw disk! It will be useful future):
qemu-img create -f raw debian.img 10G
  • Start Debian image using qemu:
qemu-system-arm -m 256 -M versatilepb -kernel vmlinuz-2.6.32-5-versatile -initrd initrd.gz -hda debian.img -append "root=/dev/ram"
  • After install Debian in the disk image, we will mount the contents of disk image:
sudo kpartx -av debian.img

sudo mount /dev/mapper/loop1p1 ./mnt/ -o loop
PS: I installed Debian with one only partition (/dev/sda1 is my root filesystem). Kpartx is needed because my disk image has 2 partitions (root filesystem and swap)
  • Copy the initrd image and the kernel to your system (outside of mountpoint). These two files will be used to start our Debian installation:
cp ./mnt/boot/initrd.img .

cp ./mnt/boot/vmlinuz-2.6.32-5-versatile .
  • Now, we can start Debian image installed in the disk image:
qemu-system-arm -m 256 -M versatilepb -kernel vmlinuz-2.6.32-5-versatile -initrd initrd.img -hda debian.img -append "root=/dev/sda1"
In the next posts I will talk about ARM architecture, toolchains, cross compilers and embedded linux. ;)