When emulating a Raspberry Pi with QEMU, we don't actually
emulate the very exact hardware, but rather approximate it
using the versatilepb board instead.
The board comes with a built-in SCSI controller and network
interface, but it also has a standard PCI bus which allows
us to add more devices. For example, we can replace the
built-in devices with the VirtIO equivalent; however, driving
them requires support to be built into the kernel.
With a kernel build containing this patch and a build of
libvirt that contains commit 96d62d9721af, it's finally
possible to ditch custom QEMU launcher scripts, import a
vanilla Raspbian image using something along the lines of
$ virt-install \
--name pi \
--arch armv6l \
--machine versatilepb \
--cpu arm1176 \
--vcpus 1 \
--memory 256 \
--import \
--disk .../pi.raw,format=raw,bus=virtio \
--network default,model=virtio \
--video vga \
--graphics spice \
--channel name=org.qemu.guest_agent.0,char_type=unix \
--boot 'kernel=.../pi.kernel,dtb=.../pi.dtb,kernel_args=root=/dev/vda2'
and manage the emulated Raspberry Pi using the usual tools
such as virt-manager and virsh.