I’ve installed qemu-linaro and run an ARM image based on the instructions on https://wiki.linaro.org/PeterMaydell/QemuVersatileExpress. I used Ubuntu 10.10 desktop edition.
First, install the Linaro images tools:
sudo apt-get install linaro-image-tools
Download the Linaro release and versatile hardware pack:
wget http://releases.linaro.org/platform/linaro-n/nano/alpha-3/linaro-natty-nano-tar-20110302-0.tar.gz
wget http://releases.linaro.org/platform/linaro-n/hwpacks/alpha-3/hwpack_linaro-vexpress_20110302-0_armel_supported.tar.gz
You can download another hwpack for omap3, i.mx51, pandaboard, beagleboard, ST U8500, etc.. if needed at http://releases.linaro.org/platform/linaro-n/hwpacks/alpha-3/
Download the source, extract it, then configure, build and install qemu linaro:
wget http://launchpad.net/qemu-linaro/trunk/2011.03-1/+download/qemu-linaro-0.14.50-2011.03-1.tar.gz
tar xzvf qemu-linaro-0.14.50-2011.03-1.tar.gz
cd qemu-linaro-0.14.50-2011.03-1
./configure –prefix=/usr
make
sudo make install
Make sure the prefix is set to /usr in order to overwrite any previous version of Qemu (It installed qemu linaro in /usr/local/ instead in my case). Failure to do so may generate the following error during linaro-media-create:
qemu: fatal: cp15 insn ee1d6f70
Instead of compiling qemu, you can install qemu-linaro with apt-get (this will avoid possible version issues between linaro-media-create and qemu):
sudo add-apt-repository ppa:linaro-maintainers/tools
sudo apt-get update
sudo apt-get install qemu-user-static qemu-system
Create a 2GB image file (it takes a while) based on the image and hwpack:
linaro-media-create –image_file vexpress.img –dev vexpress –console ttyAMA0,38400n8 –binary linaro-natty-nano-tar-20110302-0.tar.gz –hwpack hwpack_linaro-vexpress_20110302-0_armel_supported.tar.gz
It will automatically install some required tools during that step (debootstrap, qemu-arm-static and qemu-kvm-extras-static…) enter ‘Y’ to accept the installation of those tools.
Now you need to extract the kernel and initrd from the image file. To do this we must find the starting sector of the second partition and multiply it by the sector size to get a byte offset:
file vexpress.img
vexpress.img: x86 boot sector; partition 1: ID=0xe, active, starthead 1, startsector 63, 144522 sectors; partition 2: ID=0x83, starthead 0, startsector 144585, 4048380 sectors, code offset 0x0
$ dc -e ‘144585 512 * p’
74027520
…and then loopback mount the file and copy out the kernel:
sudo mount -o loop,offset=74027520 -t auto vexpress.img /mnt/mnt/
cp /mnt/mnt/boot/* .
sudo umount /mnt/mnt
and you can run qemu like this:
qemu-system-arm -kernel vmlinuz-2.6.37-1003-linaro-vexpress -M vexpress-a9 -cpu cortex-a9 -serial stdio -m 1024 -initrd initrd.img-2.6.37-1003-linaro-vexpress -append ‘root=/dev/mmcblk0p2 rw mem=1024M raid=noautodetect console=ttyAMA0,38400n8 rootwait vmalloc=256MB devtmpfs.mount=0’ -sd vexpress.img

Jean-Luc started CNX Software in 2010 as a part-time endeavor, before quitting his job as a software engineering manager, and starting to write daily news, and reviews full time later in 2011.
Support CNX Software! Donate via cryptocurrencies, become a Patron on Patreon, or purchase goods on Amazon or Aliexpress