QEMU KVM Quickstart

This page covers how to install the prebuilt KVM components and get a guest running under an ARM Fast Model.

A KVM system has:

  • An x86 host running the Fast Model
  • The boot-wrapper which does the initial startup before running the host
  • The host kernel and filesystem which runs inside the Fast Model
  • QEMU running on the host and managing the guest
  • The guest kernel and filesystem which runs inside the host

Install the Fast Model:

Create the host:

Note: The Fast Model won't mount images greater than 2G and shows INFO: mmc: no image file connected if you try.

Use boot wrapper to launch the host:

/path/to/RTSM_A15x124_VE/bin/RTSM_VE_Cortex-A15x1 \
  img.axf \
  -C motherboard.smsc_91c111.enabled=1 \
  -C motherboard.hostbridge.userNetworking=1 \
  -C motherboard.hostbridge.userNetPorts="5022=22" \
  -C motherboard.mmc.p_mmc_file=`ls *.img` \
  -C cluster.cpu0.semihosting-cmd_line=" \
     --kernel `ls vmlinu*` --initrd `ls initrd*` --dtb `ls *.dtb` \
     -- mem=2040M console=ttyAMA0,115200 migration_cost=500 \
     cachepolicy=writealloc root=/dev/mmcblk0p2"

You can now SSH into the host using ssh -p 5022 linaro@localhost. The password is linaro.

Create the guest:

  • Get the nano image from http://snapshots.linaro.org/ubuntu/images/nano/latest/

  • Reuse the hwpack and linaro-image-tools from earlier
  • Run linaro-media-create --image-file=guest.img --image-size=500M --output-directory=guest --dev fastmodel --hwpack hwpack_linaro*kvm_* --hwpack-force-yes --binary linaro-raring-nano*

BUG: faults as there's no AXF file

Transfer to the host:

  • scp -P 5022 guest.img linaro@localhost:~

Start the guest:

qemu-system-arm -enable-kvm -M vexpress-a15 \
  -drive file=guest.img,if=sd,cache=writeback -nographic \
  -append 'root=/dev/mmcblk0p2 rw console=ttyAMA0 rootwait' \
  -dtb ./*.dtb -kernel vmlinuz* -initrd initrd*

The guest is now running and can be used.

Notes

The boot wrapper is also available from a PPA:

  • add-apt-repository ppa:linaro-maintainers/staging-overlay

  • apt-get install kvm-boot-wrapper

  • Ends up in /usr/share/kvm-boot-wrapper/linux-system-semi.axf

You can also run a non-LPAE client in QEMU:

qemu-system-arm  -M vexpress-a15 -m 1024 \
  -kernel vmlinu* -initrd initrd* -dtb *dtb \
  -append 'root=/dev/mmcblk0p2 rw rootwait mem=1024M console=ttyAMA0,38400n8' \
  -drive if=sd,cache=writeback,file=fm.img \
  -redir tcp:5022::22 -nographic

The host image includes the latest QEMU. Installing manually involves:

  • add-apt-repository ppa:linaro-maintainers/staging-overlay (not needed on the LEB)

  • apt-get install qemu-system

Consider converting the guest image to sparse qcow2 format. This shrinks the initial image and reduces the copy time:

  • qemu-img convert -f raw -O qcow2 guest.img guest.qcow2

WorkingGroups/ToolChain/QEMU/KVMQuickstart (last modified 2013-09-06 10:07:58)