Skip to contentSkip to conversation

crosvm: add recipe for ChromeOS Virtual Machine Monitor (VMM)

PATCH Bruce Ashfield 1 participant 2 messages Feb 23 3 messages not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

A message that is not in the archive (sent off-list or not yet received): [email protected]

#2 lore raw

Thanks for the contribution! See below for questions.

In message: [PATCH v4 1/1] crosvm: add recipe for ChromeOS Virtual Machine Monitor (VMM)

Quoted 2 lines · on 19/02/2026 Keerthivasan Raghavan wrote:

Introduces a new recipe for integrating crosvm into the meta-virtualization layer. crosvm is a lightweight, Rust-based virtual

We can drop the "meta-virtualization layer" from the description, we know the layer just by it being here :)

Quoted 6 lines

machine monitor originally developed for ChromeOS, and provides an alternative to traditional VMMs such as QEMU.

Adding crosvm to meta-virtualization offers users of the layer a modern, secure-by-design VMM option suited for embedded, containerized, and edge computing deployments.

We can drop the marketing for crosvm from the commit. Users will make their own choice on what they want to use, so we don't need the elevator pitch.

Quoted 5 lines

Build tested using meta-qcom MACHINE(qcs9100-ride-sx, aarch64) and meta-qcom-distro DISTRO(qcom-distro-kvm). Runtime is validated by running VM till boot-to-shell. The kernel and rootfs used are same as that of the target.

Which unfortunately means I'd have no way of being able to build and test it myself. Getting this working under genericarm64 or better qemuarm64 machine definitions (at list minimal functionality is critical for being able to support it).

Quoted 6 lines

Command used to run the VM:

crosvm --log-level "debug,disk=off" run \
       --disable-sandbox  /boot/Image \
       --block /rootfs.img,root \
       -p "console=ttyS0 root=/dev/vda rw"

I've started creating a pytest infrastructure for new packages (and eventually the old ones) in the layer. If we get a machine working that is more generic, we can add those. At a minimum a README along side the recipe with testing instructions should be done.

Quoted 23 lines
---
 recipes-devtools/crosvm/crosvm-crates.inc | 966 ++++++++++++++++++++++
 recipes-devtools/crosvm/crosvm_0.1.0.bb   |  26 +
 2 files changed, 992 insertions(+)
 create mode 100644 recipes-devtools/crosvm/crosvm-crates.inc
 create mode 100644 recipes-devtools/crosvm/crosvm_0.1.0.bb
recipes-devtools/crosvm/crosvm-crates.inc new file +8 -0
new file mode 100644
index 00000000..5cc3fa9e
@@ -0,0 +1,966 @@
+# Autogenerated with 'bitbake -c update_crates crosvm'
+
+# from Cargo.lock
+SRC_URI += " \
+    crate://crates.io/addr2line/0.21.0 \
+    crate://crates.io/adler/1.0.2 \
+    crate://crates.io/ahash/0.8.6 \
+    crate://crates.io/aho-corasick/0.7.18 \

<snip>

Quoted 10 lines
recipes-devtools/crosvm/crosvm-crates.inc new file +10 -0
+    crate://crates.io/zerocopy-derive/0.8.14 \
+    crate://crates.io/zeroize/1.5.7 \
+    crate://crates.io/zstd/0.13.2 \
+    crate://crates.io/zstd-safe/7.2.1 \
+    crate://crates.io/zstd-sys/2.0.13+zstd.1.5.6 \
+"
+
+SRC_URI[addr2line-0.21.0.sha256sum] = "8a30b2e23b9e17a9f90641c7ab1549cd9b44f296d3ccbf309d2863cfe398a0cb"
+SRC_URI[adler-1.0.2.sha256sum] = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe"
+SRC_URI[ahash-0.8.6.sha256sum] = "91429305e9f0a25f6205c5b8e0d2db09e0708a7a6df0f42212bb56c32c8ac97a"

<snip>

recipes-devtools/crosvm/crosvm_0.1.0.bb line 1

Quoted 11 lines
recipes-devtools/crosvm/crosvm-crates.inc new file +4 -0
+SRC_URI[windows_i686_msvc-0.52.0.sha256sum] = "ffe5e8e31046ce6230cc7215707b816e339ff4d4d67c65dffa206fd0f7aa7b9a"
+SRC_URI[windows_x86_64_gnu-0.52.0.sha256sum] = "3d6fa32db2bc4a2f5abeacf2b69f7992cd09dca97498da74a151a3132c26befd"
+SRC_URI[windows_x86_64_gnullvm-0.52.0.sha256sum] = "1a657e1e9d3f514745a572a6846d3c7aa7dbe1658c056ed9c3344c4109a6949e"
+SRC_URI[windows_x86_64_msvc-0.52.0.sha256sum] = "dff9641d1cd4be8d1a070daf9e3773c5f67e78b4d9d42263020c057706765c04"
recipes-devtools/crosvm/crosvm_0.1.0.bb new file +1 -0
new file mode 100644
index 00000000..4cbe9879
@@ -0,0 +1,26 @@
+SUMMARY = "crosvm"

crossvm is a little bit short for SUMMARY :)

recipes-devtools/crosvm/crosvm_0.1.0.bb line 8

Quoted 7 lines
recipes-devtools/crosvm/crosvm_0.1.0.bb new file +7 -0
+
+DESCRIPTION = "Rust-based KVM virtual machine monitor with a minimal, \
+               security-focused architecture and sandboxed device processes."
+
+HOMEPAGE = "https://github.com/google/crosvm"
+
+LICENSE = "BSD-3-Clause-Clear"

With that many crates. Are there really no variation in the license at all ? Note: other recipes are guilty of this as well, and it's on my list to fix the up as well.

recipes-devtools/crosvm/crosvm_0.1.0.bb line 13

Quoted 5 lines
recipes-devtools/crosvm/crosvm_0.1.0.bb new file +5 -0
+LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/BSD-3-Clause-Clear;md5=7a434440b651f4a472ca93716d01033a"
+
+inherit cargo pkgconfig cargo-update-recipe-crates features_check
+
+SRC_URI = "gitsm://chromium.googlesource.com/crosvm/crosvm.git;branch=main;protocol=https"

I'm on the record as really not liking gitsm fetched repos (see the ones I've expanded in meta-virtualization previously), since it makes it very hard to bump the components of have visibility into what is being cloned.

I probably won't insist on it, but have you tried breaking this down into the individual clones ?

recipes-devtools/crosvm/crosvm_0.1.0.bb line 16

Quoted 3 lines
recipes-devtools/crosvm/crosvm_0.1.0.bb new file +3 -0
+SRCREV = "b04c13a65b93034010b20612e3566d4f9d83c4f0"
+
+PKGV = "0.1.0+git${SRCPV}"

I think there are some stragglers in the layer, and maybe it is my memory of PV crossing with PKGV (I prefer we use PV), but do we need the ${SRCPV} ? the +git normally triggers it to be filled in.

recipes-devtools/crosvm/crosvm_0.1.0.bb line 18

Quoted 2 lines
recipes-devtools/crosvm/crosvm_0.1.0.bb new file +2 -0
+
+DEPENDS += "libcap wayland wayland-native protobuf-native wayland-protocols"

With the hard dependency on wayland, is this always graphical ?

recipes-devtools/crosvm/crosvm_0.1.0.bb line 24

Quoted 6 lines
recipes-devtools/crosvm/crosvm_0.1.0.bb new file +6 -0
+
+REQUIRED_DISTRO_FEATURES = "kvm"
+
+COMPATIBLE_HOST = "(aarch64|x86_64).*-linux.*"
+
+BBCLASSEXTEND = "native"

Why the native variant ?

Bruce

Quoted 5 lines
recipes-devtools/crosvm/crosvm_0.1.0.bb new file +2 -0
+
+require crosvm-crates.inc
Signature · 1 line
2.34.1

A message that is not in the archive (sent off-list or not yet received): BL0PR02MB38446DEFF4AB9BC4C90B4C91F377A@BL0PR02MB3844.namprd02.prod.outlook.com

#4 lore raw

In message: Re: [PATCH v4 1/1] crosvm: add recipe for ChromeOS Virtual Machine Monitor (VMM)

Quoted 17 lines · on 23/02/2026 Keerthivasan Raghavan wrote:
Quoted 2 lines

We can drop the "meta-virtualization layer" from the description, we know the layer just by it being here :)

Ack.

Quoted 3 lines

We can drop the marketing for crosvm from the commit. Users will make their own choice on what they want to use, so we don't need the elevator pitch.

Ack.

Quoted 5 lines

Which unfortunately means I'd have no way of being able to build and test it myself. Getting this working under genericarm64 or better qemuarm64 machine definitions (at list minimal functionality is critical for being able to support it).

Quoted 5 lines

Ack. I will try to run the arm64 guest image(generated from yocto using a generic arm64 machine) that exposes /dev/kvm on top of an arm64 host(my target with native arm64 cpu). I am banking on using nested kvm virtualization to get this to work(and hopefully it will) as the guest image containing the crosvm is the end goal to reproduce a consistent test environment. Should I add this test image into meta-virtualization provided it works out ?

Possibly, yes.

I'd like to do the same for the VMMs that I've done for containers and just define a VMM_PROFILE that is selected, and that configures everything we need. That would allow me to collapse all the specific host images into one (just like I did with container-image-host).

But leave that part to me, as I'd be pretty specific about how I'd want it done. Define a minimal image for it, and then I can look for a pattern later and refactor/consolidate things.

Quoted 52 lines

The bellow ascii diagram captures the intent:

+==================================================================================================+
|                               L0: ARM64 HOST (Generic Armv8 CPU)
+==================================================================================================+
|  Hardware
|    - Armv8-A CPU
|    - EL2 virtualization support
|    - (must support nested virtualization for L1)
----------------------------------------------------------------------------------------------------
|  Host Linux Kernel
|    - KVM host support
|    - /dev/kvm
----------------------------------------------------------------------------------------------------
|  Userspace
|    - qemu-system-aarch64
|    - accel: KVM
|    - cpu: host
|    - machine: virt,virtualization=on
----------------------------------------------------------------------------------------------------
|                                      Runs the L1 VM
+-----------------------------------------------+--------------------------------------------------+
                                                |
                                                v
+==================================================================================================+
|                        L1: ARM64 GUEST (Yocto Test Appliance, generic Armv8)
+==================================================================================================+
|  Guest Kernel
|    - AArch64
|    - KVM guest support enabled
|    - /dev/kvm  <-- present only if nested virtualization is supported by L0
----------------------------------------------------------------------------------------------------
|  Rootfs (Yocto-built)
|    - crosvm
|    - test orchestration / CI hooks
|
|    - Packaged L2 artifacts
|        /opt/l2/
|          ├── Image            (L2 kernel, generic Armv8)
|          ├── rootfs.ext4      (L2 root filesystem)
|          ├── initrd.img       (optional)
|          ├── *.dtb            (optional)
|          └── cmdline.txt      (optional)
+-----------------------------------------------+--------------------------------------------------+
                                                |
                                                v
+==================================================================================================+
|                          L2: NESTED GUEST VM (generic Armv8, test target)
+==================================================================================================+
|  Booted by crosvm using packaged artifacts
|  Ideally KVM-accelerated via nested virtualization
Quoted 5 lines

----------------------------------------------------------------------------------------------------
| Test boot to shell of the VM.
+==================================================================================================+

NOTE: The above was generated using gen AI, due credits to M365.

I'm about to push a complete re-working of the Xen guest image bundling to match the container image bundling. So for now, ignore/skip the need to provide / build the guest images and bundles in meta-virtualization. Since they'd need to follow a pattern that isn't quite visible yet (I'm just chasing a few regressions on container bundling).

Quoted 7 lines

My pessimism originates dues to the levels of nested virtualization, but given that cloud providers like AWS have introduced nested virtualization for its ec2/compute instances (I came across a post on LinkedIn that announced this, will need to check the offcial ec2 doc), I think this is a good enough generic test-setup arch that one uses to test userspace vmm solutions. What remains is to prove this works as a stable test infra setup without jitter of random failures due to environment/machine drift, across the 2/3 layers of virtualization.

It should work, or at least I've been using nested virtualization in the meta-virtualization context for over a decade to test Xen and the container stacks. There may need to be some additions to the host kernel, etc, to make it work, but that is something we can solve and key off the distro feature.

It does need to use the OEcore and meta-virtualization components for the kernel, etc, otherwise, we have depdendencies and a test matrix that is getting larger. For things that absolutely need hardware, there are the dynamic layers, but I don't use those for core functionality testing.

Quoted 7 lines
Quoted 6 lines

I've started creating a pytest infrastructure for new packages (and eventually the old ones) in the layer. If we get a machine working that is more generic, we can add those. At a minimum a README along side the recipe with testing instructions should be done.

Quoted 5 lines

Ack. Will get the README based on the above diagram that captures testing. Can you please provide some references or pointers on the pytest aspect. It looks like a we trying to automate the end to end test functionality of userspace virtual machine monitor recipes ? I can maybe follow this up with the test cases that can be plugged into this pytest setup.

Yes, there are some end to end tests for containers and I'm adding them for Xen right now. Even just basic boot to prompt is good enough for a start, it doesn't have to be elaborate. That gets us build, kernel, packaging and a runtime smoke test.

Quoted 9 lines
Quoted 2 lines

crossvm is a little bit short for SUMMARY :)

Ack. Will think of a few appropriate words.

Quoted 3 lines

With that many crates. Are there really no variation in the license at all ? Note: other recipes are guilty of this as well, and it's on my list to fix the up as well.

Quoted 5 lines

It is what is available in the crosvm codebase and I think the recipe should reflect the same. Here is the reference: https://github.com/google/crosvm/blob/main/LICENSE
Could you please provide insights on what you meant by "variations" ? (or) what "variations" were you expecting that would seem appropriate to model this composite sw ?

I mean that do all the crates it is pulling in for the build really all have the exact same license ? There's no variations in the open source license at all ?

Some of the recent rust recipes in various layers have been scanning all the crates for their licenses and doing a combined license in the main recipe.

Quoted 9 lines
Quoted 8 lines

I'm on the record as really not liking gitsm fetched repos (see the ones I've expanded in meta-virtualization previously), since it makes it very hard to bump the components of have visibility into what is being cloned.

I probably won't insist on it, but have you tried breaking this down into the individual clones ?

Quoted 6 lines

No. Git submodules exposes
the commits, so I do not understand what you mean by "lack of visibility". Judging by the context you meant at the level of the "recipe". Will stick to "gitscm" as it is a more of a recommendation. But I would like to read your insights on judging why it makes things difficult.

I don't like to pull the main git repository and have the iteration and chaining to the submodes within the fetcher and not visible in the main recipe.

I want all the git:// repositories visible, with commit hashes that can be tweaked. Even if that means duplicating the information from the git submodules, it is my preference as I've been biten many times with updating gitsm based recipes.

Quoted 8 lines
Quoted 5 lines

I think there are some stragglers in the layer, and maybe it is my memory of PV crossing with PKGV (I prefer we use PV), but do we need the ${SRCPV} ? the +git normally triggers it to be filled in.

Need to do some digging on this. Will get back to you on this in another reply.

Quoted 7 lines
Quoted 1 line

With the hard dependency on wayland, is this always graphical ?

There are many cargo feature flags that need a recipe level package config mapped to the cargo feature flags. The default target builds graphical support. So I left it at that. I do not have much clarity on this due the flag explosion. Maybe follow the initial commit with support for granular feature selection ?

That's fine with me.

Quoted 8 lines
Quoted 2 lines

Why the native variant ?

Well, it is a guilty pleasure that one day maybe it becomes a ||le alternative to qemu for testing the created distro, referring to the "run qemu" scripts that oe provides. It is an indicator/signal that this would be possible, nothing more. Also was easy to test x86-64 builds, not the runtime though.

There's been requests for kvmtool for this sort of thing before and it is what I did with some of the recent container work. There's no harm in putting it there for now, but having a unified way to allow runqemu variation would be required once I've collected up all the options. It just won't be tested right now, and that's fine. No worries if you leave it.

Bruce

Quoted 7 lines

Thank you, Bruce.

Looking forward to your reply.

Thank you,
Keerthivasan Raghavan