[RFC PATCH 06/10] img/app: add support for testing in crosvm

Alyssa Ross
2022-09-30T12:50:25Z

This is useful because it allows comparing how our patched
cloud-hypervisor behaves against crosvm's implementation.

Signed-off-by: Alyssa Ross <alyssa.ross@unikie.com>
---
img/app/Makefile | 12 ++++++++++++
img/app/shell.nix | 2 +-
2 files changed, 13 insertions(+), 1 deletion(-)

diff --git a/img/app/Makefile b/img/app/Makefile
index 145001c..9f70032 100644
--- a/img/app/Makefile
+++ b/img/app/Makefile
@@ -8,6 +8,7 @@ QEMU_KVM = qemu-kvm
CLOUD_HYPERVISOR = cloud-hypervisor
CROSVM = crosvm
CROSVM_DEVICE_GPU = $(CROSVM) device gpu
+CROSVM_RUN = $(CROSVM) run

prefix = /usr/local
imgdir = $(prefix)/img
@@ -135,6 +136,17 @@ run-cloud-hypervisor: build/host/appvm/blk/root.img start-vhost-user-gpu
--serial pty
.PHONY: run-cloud-hypervisor

+run-crosvm: build/host/appvm/blk/root.img start-vhost-user-gpu
+ $(CROSVM_RUN) \
+ --disk build/host/appvm/blk/root.img \
+ --disk $(RUN_IMG) \
+ -p "console=ttyS0 root=PARTLABEL=root" \
+ --vhost-user-gpu vhost-user-gpu.sock \
+ --serial type=file,hardware=serial,path=/tmp/crosvm.log \
+ --serial type=stdout,hardware=virtio-console,stdin=true \
+ $(KERNEL)
+.PHONY: run-crosvm
+
run: run-$(VMM)
.PHONY: run

diff --git a/img/app/shell.nix b/img/app/shell.nix
index d6b627c..c9ed1a6 100644
--- a/img/app/shell.nix
+++ b/img/app/shell.nix
@@ -12,7 +12,7 @@ with config.pkgs;

{
nativeBuildInputs = nativeBuildInputs ++ [
- cloud-hypervisor jq qemu_kvm reuse
+ cloud-hypervisor crosvm jq qemu_kvm reuse
];

KERNEL = "${passthru.kernel.dev}/vmlinux";
--
2.37.1