Running Raspbian on Qemu with libvirt

I followed this great tutorial to get Raspbian running on Qemu. I have all my other virtual servers managed by libvirt, so I wanted to integrate  the Raspbian Qemu instance into it.

Here is my working libvirt xml for a headless installation:

<domain type='qemu' id='3' xmlns:qemu=''><!--We need the qemu extensions, to be able to set a custom cpu-->
  <memory unit='KiB'>262144</memory>
  <currentMemory unit='KiB'>262144</currentMemory>
  <vcpu placement='static'>1</vcpu>
    <type arch='armv7l' machine='versatilepb'>hvm</type><!--libvirt does not know about armv6l, so use armv7l. The custom cpu setting will choose the correct architecture anyway-->
    <kernel>/var/lib/libvirt/boot/zImage_3.10.26_arm6l</kernel><!--The kernel from -->
    <cmdline>root=/dev/sda2 panic=1 rootfstype=ext4 console=ttyAMA0</cmdline><!--Select the correct root file system from the Raspbian image. Also set the console, so that we can see something-->
    <boot dev='hd'/>
  <clock offset='utc'/>
    <disk type='file' device='disk'>
      <driver name='qemu' type='raw'/>
      <source file='/var/lib/libvirt/images/2014-01-07-wheezy-raspbian.img'/>
      <target dev='hda' bus='scsi'/>
      <alias name='scsi0-0-2'/>
      <address type='drive' controller='0' bus='0' target='0' unit='2'/>
    <controller type='usb' index='0'>
      <alias name='usb0'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/>
    <controller type='pci' index='0' model='pci-root'>
      <alias name='pci.0'/>
    <controller type='scsi' index='0'>
      <alias name='scsi0'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
    <interface type='network'>
      <mac address='52:54:00:50:2f:ce'/>
      <source network='default'/>
      <target dev='vnet0'/>
      <model type='smc91c111'/><!--This is the network card, supported by the raspberry pi-->
      <alias name='net0'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x0'/>
    <serial type='pty'>
      <source path='/dev/pts/16'/>
      <target port='0'/>
      <alias name='serial0'/>
    <console type='pty' tty='/dev/pts/16'>
      <source path='/dev/pts/16'/>
      <target type='serial' port='0'/>
      <alias name='serial0'/>
    <sound model='es1370'>
      <alias name='sound0'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
  <qemu:commandline><!--we need to set a custom cpu-->
    <qemu:arg value='-cpu'/>
    <qemu:arg value='arm1176'/>

I took the kernel from the tutorial mentioned above, and also prepared the image according to the tutorial.

I haven’t tried to get graphics support to work.

This xml works fine for me with Ubuntu 14.04 as host.