Browse Source

Enable VirtIO support in the kernel

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.
master
Andrea Bolognani 6 years ago
parent
commit
e362b8bbd4
  1. 8
      tools/build-kernel-qemu

8
tools/build-kernel-qemu

@ -99,6 +99,14 @@ CONFIG_NET_9P=y
CONFIG_NET_9P_VIRTIO=y
CONFIG_9P_FS=y
CONFIG_9P_FS_POSIX_ACL=y
CONFIG_VIRTIO=y
CONFIG_VIRTIO_BLK=y
CONFIG_SCSI_VIRTIO=y
CONFIG_VIRTIO_NET=y
CONFIG_VIRTIO_CONSOLE=y
CONFIG_VIRTIO_BALLOON=y
CONFIG_VIRTIO_INPUT=y
CONFIG_VIRTIO_PCI=y
EOF

Loading…
Cancel
Save