Setup development environment for vhost-device

This is a description for how to setup development environment for vhost-virtio. In this documentation, it uses virtio-rng as an example for the building steps and how to launch the QEMU and vhost-virtio programs.

Build vhost-device

  1. Checkout the main branch of the vhost-device package:

    $ git clone https://github.com/rust-vmm/vhost-device
  2. Build the dependency libarary libgpiod:

    $ git clone --depth 1 --branch v2.0.x https://git.kernel.org/pub/scm/libs/libgpiod/libgpiod.git/ $ cd libgpiod $ ./autogen.sh --prefix="$PWD/install/" $ make install
  3. Build the vhost-device daemons. After building, binaries are located under the folder “target/debug/":

    $ cargo build

Build QEMU (v6.0.0)

  1. Download QEMU code base and checkout tag v6.0.0:

  2. Apply three offline patches:

    These three patches are placed in the folder hackbox2:/home/mathieu.poirier/for-leo/patches/qemu.

  3. Build QEMU:

Run virtual machine

  1. Run vhost-device-rng in the vhost-device directory:

  2. Run QEMU for creating Arm64 virtual machine:

    The images efi.img, varstore.img, disk.img, and Image have been uploaded in the folder hackbox2: /home/mathieu.poirier/for-leo/.

Notes

In the folder hackbox2: /home/mathieu.poirier/for-leo/patches/debug, there is a debug patch to apply to the vhost-device-rng to help understand how things work. There are instructions in the changelog to exercise the daemon from the virtualized kernel.