[PATCH v1] crosvm: replace monolithic DEPENDS with PACKAGECONFIG flags

Keerthivasan Raghavan <[email protected]> Mon, 27 Jul 2026 01:50:28 +0530
Newsgroups org.yoctoproject.lists.meta-virtualization
Message-ID <[email protected]>
Previously, all crosvm feature dependencies were unconditionally added
to DEPENDS, with no way to enable or disable individual Cargo features
at the distro or machine level. Replace this with PACKAGECONFIG entries
that map each feature to its build-time dependencies. The default set
mirrors upstream crosvm defaults minus GPU, preserving existing
behaviour while allowing GPU (and its wayland pull-in) to be opted in
explicitly. Pass --no-default-features with the resolved PACKAGECONFIG
flags so Cargo feature selection is driven entirely from the recipe.

Tested by inspecting crosvm-image-minimal-qemux86-64.rootfs.manifest
to verify that installed packages match the expected PACKAGECONFIG and
dependency settings. Boot-to-shell into a crosvm guest was verified on
qemu x86-64 to confirm correct runtime behaviour. Build was also
verified on qemu aarch64.

Signed-off-by: Keerthivasan Raghavan <[email protected]>
---
 recipes-extended/crosvm/crosvm_0.1.0.bb | 22 +++++++++++++++++++---
 1 file changed, 19 insertions(+), 3 deletions(-)

diff --git a/recipes-extended/crosvm/crosvm_0.1.0.bb b/recipes-extended/crosvm/crosvm_0.1.0.bb
index c192ae25..6a876fa3 100644
--- a/recipes-extended/crosvm/crosvm_0.1.0.bb
+++ b/recipes-extended/crosvm/crosvm_0.1.0.bb
@@ -28,9 +28,25 @@ SRCREV_FORMAT = "crosvm_minijail"
 # consistency, not an upstream project release.
 PV = "0.1.0+git"
 
-# TODO: Break this down into pkgconfig flags mapped to
-# rust cargo feature flags.
-DEPENDS += "libcap wayland wayland-native protobuf-native wayland-protocols clang-native"
+
+DEPENDS += "libcap clang-native"
+
+# The default set of packageconfig has been mapped to
+# crosvm default features with gpu removed.
+PACKAGECONFIG ??= "audio balloon document-features qcow usb libvda-stub net slirp"
+
+PACKAGECONFIG[audio]             = "--features audio,,"
+PACKAGECONFIG[balloon]           = "--features balloon,,"
+PACKAGECONFIG[document-features] = "--features document-features,,"
+PACKAGECONFIG[gpu]               = "--features gpu,,wayland wayland-native wayland-protocols,"
+PACKAGECONFIG[qcow]              = "--features qcow,,"
+PACKAGECONFIG[usb]               = "--features usb,,"
+PACKAGECONFIG[libvda-stub]       = "--features libvda-stub,,"
+PACKAGECONFIG[net]               = "--features net,,"
+PACKAGECONFIG[slirp]             = "--features slirp,,"
+
+# Disable upstream Cargo defaults and drive features entirely via PACKAGECONFIG
+CARGO_BUILD_FLAGS:append = " --no-default-features ${PACKAGECONFIG_CONFARGS}"
 
 REQUIRED_DISTRO_FEATURES = "kvm"
 
-- 
2.34.1