Versatile Express support in QEMU

This page briefly summarises the status of QEMU's Versatile Express model and explains how to get a Linaro snapshot running on it.

Status of Versatile Express support

The Versatile Express model generally works, although a few items are missing. Support is complete enough for the Linaro images to boot to a root prompt and display graphics (including working keyboard and mouse support). It is at the same level or better than the existing qemu support for the 'versatilepb' or 'realview-pbx' models.

Implemented components:

  • Quad-core A9MP
  • Up to 1GB RAM
  • SD/MMC card
  • CLCD graphics, keyboard and mouse
  • Serial ports
  • Timers and RTC
  • LAN9118 ethernet

Missing components:

  • No USB (no model of the ISP1761 USB chip)
  • No modelling of the Flash memory
  • Components like the PL341 dynamic memory controller, PL354 static memory controller, PL310 L2 cache controller are not implemented (not even as dummy registers). This causes no problems for Linux booting but will probably be needed if we want to run u-boot or the VE boot ROM or other low level setup code
  • No Trustzone support (either in QEMU's A9 core model or in the Trustzone address space controller etc on the board)
  • We provide a PL110 CLCD controller, not a PL111
  • No Compact Flash
  • No audio (no PL041 model)
  • We don't implement remapping low memory; it is always RAM
  • No support for running the VE boot ROM -- you must provide the kernel and initrd directly to qemu

Note: there is no PCI, and therefore no way to expose an IDE or SCSI controller to the guest; the only available block device is the SD card. This is a limitation of the hardware, not a missing feature in qemu.

Creating Linaro Versatile Express images for qemu-linaro

The simplest thing is to get a vexpress SD card image file from releases.linaro.org (for instance images/12.01/oneiric/nano/ -- adjust to taste for a different release or image). Or you can use linaro-media-create to create your own if you're after a snapshot image. Uncompress the image if it's gzipped.

Now you need to extract the kernel and initrd from the image file. The following command uses file and awk to find out the offset of the second partition in the image file, and then mounts it via a loopback mount onto /mnt/mnt.

  • (IMG=vexpress.img ; if [ -e "$IMG" ] ; then sudo mount -o loop,offset="$(file "$IMG" | awk 'BEGIN { RS=";"; } /partition 2/ { print $7*512; }')" -t auto "$IMG" /mnt/mnt; else echo "$IMG not found"; fi )

Copy the kernel and initrd out of /mnt/mnt/boot and then unmount the image:

  • sudo cp -vr /mnt/mnt/boot .
    sudo chown -R youruser:youruser boot
    sudo umount /mnt/mnt

In some images the boot files are in the first partition of the image:

  • sudo mount -o loop,offset=$((63*512)) vexpress.img /mnt

If what you have is a uImage and a uInitrd, you can use the former as your kernel, but you need to extract the u-boot header from the latter to be able to use it as the initrd:

  • dd if=uInitrd of=initrd skip=64 bs=1

Running the model

Once you have extracted the kernel and initrd, you can run qemu like this (kernel/initrd filenames may vary with other hwpacks):

  • 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

If you want you can add "-smp 4" to make it boot as a 4-core SMP model. However you should be aware that this is likely to reduce performance, not increase it, so is rarely what you want.


CategoryHowTo

PeterMaydell/QemuVersatileExpress (last modified 2012-02-20 19:13:49)