• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1[package]
2name = "crosvm"
3version = "0.1.0"
4authors = ["The ChromiumOS Authors"]
5edition = "2021"
6default-run = "crosvm"
7
8[[bin]]
9name = "crosvm"
10path = "src/main.rs"
11
12[profile.release]
13panic = 'abort'
14opt-level = 3
15overflow-checks = true
16
17[profile.release-test]
18inherits = 'release'
19panic = 'unwind'
20
21# Reproduces the options used when building crosvm for ChromeOS.
22[profile.chromeos]
23inherits = "release"
24strip = "symbols"
25
26# Enables LTO to further reduce the size of the binary.
27[profile.lto]
28inherits = "chromeos"
29lto = true
30
31# Set codegen units to 1 to further reduce binary size.
32[profile.largecodegen]
33inherits = "lto"
34codegen-units = 1
35
36[workspace]
37# Explicitly list all crates of crosvm as workspace members since not all of them may be referenced
38# by dependencies.
39members = [
40    "aarch64",
41    "acpi_tables",
42    "android_audio",
43    "arch",
44    "argh_helpers",
45    "audio_util",
46    "audio_streams_conformance_test",
47    "base",
48    "base_tokio",
49    "bit_field",
50    "broker_ipc",
51    "common/audio_streams",
52    "common/balloon_control",
53    "common/data_model",
54    "common/sync",
55    "cros_async",
56    "cros_fdt",
57    "cros_tracing",
58    "crosvm_cli",
59    "crosvm_control",
60    "crosvm_plugin",
61    "devices",
62    "disk",
63    "e2e_tests",
64    "ext2",
65    "fuse",
66    "fuzz",
67    "gpu_display",
68    "hypervisor",
69    "hypervisor/hypervisor_test_macro",
70    "io_uring",
71    "kernel_cmdline",
72    "kernel_loader",
73    "kvm_sys",
74    "kvm",
75    "libcras_stub",
76    "linux_input_sys",
77    "media/ffmpeg",
78    "metrics",
79    "metrics_events",
80    "net_sys",
81    "net_util",
82    "power_monitor",
83    "prebuilts",
84    "protos",
85    "proto_build_tools",
86    "resources",
87    "rutabaga_gfx",
88    "serde_keyvalue",
89    "snapshot",
90    "swap",
91    "system_api",
92    "third_party/vmm_vhost",
93    "tools/impl/catapult_converter",
94    "usb_sys",
95    "usb_util",
96    "vendor/generic/anti_tamper",
97    "vendor/generic/crash_report",
98    "vendor/generic/crypto",
99    "vfio_sys",
100    "vhost",
101    "virtio_sys",
102    "vm_control",
103    "vm_memory",
104    "x86_64",
105]
106
107# Exclude crates from crosvm builds completely. Avoid using this if possible as crates added here
108# will not be tested in CI and may break at any time.
109exclude = [
110    "sandbox",
111    "tools/audio_streams_conformance_test",
112    "tools/examples/baremetal",
113    "perfetto",
114
115    # This crate depends on optional features and is compiled via dependencies when enabled.
116    "media/libvda",
117]
118
119[workspace.dependencies]
120tokio = { version = "1.29.1", features = ["net", "rt-multi-thread", "time", "sync", "macros"] }
121snapshot = { path = "snapshot" }
122
123[features]
124## Default features of crosvm. This selection is somewhat arbitrary for historical reasons.
125default = ["audio", "balloon", "config-file", "document-features", "gpu", "qcow", "usb", "libvda-stub", "net", "slirp"]
126
127## Enables support for the Android [sparse image format](https://android.googlesource.com/platform/system/core/+/HEAD/libsparse/sparse_format.h)
128## in the block device.
129android-sparse = ["disk/android-sparse"]
130
131## Enables cross-platform audio devices
132audio = ["devices/audio", "vm_control/audio"]
133
134## Enables the virtio-balloon device which allows dynamic scaling of memory via `vm_control`
135## commands. See [Balloon Device](https://crosvm.dev/book/devices/balloon.html) for more
136## information.
137balloon = ["devices/balloon", "vm_control/balloon"]
138
139## Enables the composite-disk format, which adds protobufs as a dependency of the build. This format
140## is intended to speed up crosvm's usage in CI environments that might otherwise have to
141## concatenate large file system images into a single disk image.
142composite-disk = ["protos/composite-disk", "protobuf", "disk/composite-disk"]
143
144## Enables support for using a seekable zstd archive of a raw disk image as a read-only disk.
145## See [Format Specs](https://github.com/facebook/zstd/tree/v1.5.6/contrib/seekable_format) for
146## more information.
147zstd-disk = ["disk/zstd-disk"]
148
149## Enables virtiofs uid-gid mapping from the host side through command line when user-namespace
150## isn't available for non-root users. This format is supported only for vhost-user-fs.
151fs_runtime_ugid_map = ["devices/fs_runtime_ugid_map"]
152
153## Enables support for JSON configuration files that can be specified using `--cfg`. See
154## [Configuration Files](https://crosvm.dev/book/running_crosvm/options.html#configuration-files)
155## for more information.
156config-file = []
157
158## Enables using gdb to debug the guest kernel. See
159## [GDB Support](https://crosvm.dev/book/running_crosvm/advanced_usage.html#gdb-support) for more
160## information.
161gdb = [
162    "aarch64/gdb",
163    "arch/gdb",
164    "gdbstub",
165    "gdbstub_arch",
166    "riscv64/gdb",
167    "vm_control/gdb",
168    "x86_64/gdb",
169]
170
171## Enables virtio-net and vhost-user-net backend.
172net = ["devices/net"]
173
174## Enables PCI hotplug. Only available on Linux, and currently only for x86/x86-64.
175pci-hotplug = ["devices/pci-hotplug", "vm_control/pci-hotplug"]
176
177## Enables virtio-pvclock. Currently only available for x86-64 and aarch64.
178pvclock = ["devices/pvclock"]
179
180## Enables the use of the qcow format for block devices.
181qcow = ["disk/qcow"]
182
183## Enables the registered_events mechanisms.
184registered_events = ["protos/registered_events", "protobuf", "base/proto_tube", "vm_control/registered_events", "devices/registered_events"]
185
186## Enables vmm-swap of guest memory. This is only available on Linux.
187swap = ["aarch64/swap", "arch/swap", "devices/swap", "vm_control/swap", "x86_64/swap", "swap/enable"]
188
189## Enables collection of VM statistics.
190stats = ["devices/stats"]
191
192## Supports tokio as an asynchronous executor.
193tokio = ["cros_async/tokio"]
194
195## Enables USB host device passthrough via an emulated XHCI controller.
196## USB is supported only on unix/linux. The feature is a no-op on windows.
197usb = ["devices/usb"]
198
199## Enables the non-upstream virtio wayland protocol. This can be used in conjuction with the gpu
200## feature to enable a zero-copy display pipeline.
201wl-dmabuf = ["devices/minigbm"]
202
203## Enables the usage of the X11 protocol for display on the host.
204x = ["devices/x"]
205
206#! ### Graphics features
207
208## Enables basic virtio-gpu support. This includes basic display and input features, but lacks 3D
209## acceleration in the absence of other crosvm features.
210gpu = ["devices/gpu", "gpu_display", "vm_control/gpu"]
211
212## Enables 3D acceleration for guest via the gfxstream protocol over virtio-gpu. This is used for
213## compatibility with the Android Emulator. The protocol provides the best speed and compatibility
214## with GL/vulkan versions by forwarding the guest's calls to the host's graphics libraries and GPU.
215## However, this means the sandbox is not enabled for the virtio-gpu device.
216gfxstream = ["devices/gfxstream"]
217
218## Adds a stub implementation of gfxstream to allow us to compile the gfxstream feature without
219## access to the gfxstream library.
220## Note that this feature only allows compilation of gfxstream and will not be functional at
221## runtime.
222gfxstream_stub = ["rutabaga_gfx/gfxstream_stub"]
223
224## Enables 3D acceleration for the guest via the virglrenderer library over virtio-gpu.
225virgl_renderer = ["devices/virgl_renderer"]
226
227## Enables the usage of Vulkan for display on the host.
228vulkan_display = ["gpu_display/vulkan_display"]
229
230# Enables the highly experimental vulkan graphics buffer allocator.
231# see rutabaga_gfx/Cargo.toml for instructions on building with enabled.
232vulkano = ["rutabaga_gfx/vulkano"]
233
234# Enables the GPU display backend for Android. The backend uses Android surface as the backing
235# store.
236android_display = ["devices/android_display"]
237
238# Stub implementation of the Android display backend. This is only used for building and testing the
239# Android display backend on a non-Android target
240android_display_stub = ["devices/android_display_stub"]
241
242#! ### Video features
243#!
244#! See [Video Device](https://crosvm.dev/book/devices/video.html) for more information.
245
246## Enables the video decoding device
247video-decoder = ["devices/video-decoder"]
248
249## Enables the video encoding device
250video-encoder = ["devices/video-encoder"]
251
252## Enables the ffmpeg backend of video devices.
253ffmpeg = ["devices/ffmpeg"]
254
255# Enables the VAAPI backend of video devices.
256vaapi = ["devices/vaapi"]
257
258## Enables the virtio-media device.
259media = ["devices/media"]
260
261#! ### Linux-specific feature flags
262
263## Enables the use of the GenieZone hypervisor
264geniezone = ["devices/geniezone", "hypervisor/geniezone"]
265
266## Enables the use of the Gunyah hypervisor
267gunyah = ["devices/gunyah", "hypervisor/gunyah"]
268
269## Enables the Linux trace_marker backend for cros_tracing. This backend is only
270## supported on Linux systems. It sends all cros_tracing tracepoints to the tracefs
271## filesystem if mounted, for easier debugging with tools like trace-cmd.
272trace_marker = ["cros_tracing/trace_marker"]
273
274## Facilitate tracing all syscalls by sandboxed processes.
275seccomp_trace = ["jail/seccomp_trace","base/seccomp_trace","devices/seccomp_trace"]
276
277## Enables virtio-gpu devices to request a non-coherent memory mapping from the
278## hypervisor. Currently only supported in KVM on x86 and requires kernel
279## patches from:
280## <https://lore.kernel.org/all/20240105091535.24760-1-yan.y.zhao@intel.com/>
281noncoherent-dma = ["devices/noncoherent-dma", "hypervisor/noncoherent-dma"]
282
283#! ### Windows-specific feature flags
284#!
285#! These feature flags are only available on Windows builds of crosvm.
286
287## Enables the use of the HAXM hypervisor
288haxm = ["hypervisor/haxm"]
289
290## Enables the use of the WHPX hypervisor
291whpx = ["devices/whpx", "hypervisor/whpx"]
292
293## Enables a libslirp based network device. Currently only supported on Windows.
294slirp = ["devices/slirp", "net_util/slirp"]
295
296## Enables slirp debugging.
297slirp-debug = ["net_util/slirp-debug"]
298
299## Enables slirp capture.
300slirp-ring-capture = [
301    "net_util/slirp-ring-capture",
302    "devices/slirp-ring-capture",
303]
304
305#! ### Non-additive feature flags
306#!
307#! These feature flags change the behavior of crosvm instead of adding functionality.
308#! This is deprecated and will be phased out.
309
310## Run crosvm with `--disable-sandbox` by default.
311default-no-sandbox = []
312
313#! ### Project specific features
314#!
315#! These features are specific to downstream projects and may not be functional or useful
316#! for standard linux builds of crosvm.
317#! They are however enabled in upstream builds for compile and test coverage in CI.
318
319#! #### ChromeOS
320#!
321#! These features will only be functional in ChromeOS builds running on ChromeOS.
322
323## Enables ARCVM specified virtio-fs feature including:
324## - Support quota reporting for ARCVM
325##   Requires access to the org.chromium.ArcQuota dbus service.
326## - Support for FS_IOC_SETPERMISSION ioctl
327## - Support for FS_IOC_SETPATHXATTR ioctl
328arc_quota = ["devices/arc_quota"]
329
330## Enables use of Android AAudio virtio-snd backend.
331audio_aaudio = ["devices/audio_aaudio"]
332
333## Stub implementation of Android AAudio NDK library. This is only used for building and testing the
334## Android audio on a non-Android target
335libaaudio_stub = ["android_audio/libaaudio_stub"]
336
337## Enables use of the ChromeOS audio server. ChromeOS builds will replace libcras_stub with an
338## implementation that talks to the audio server. In upstream builds, using this option will panic.
339audio_cras = ["devices/audio_cras"]
340
341## Enables the VDA backend of the video devices. This feature requires the ChromeOS only
342## libvda library and can be compiled but not linked. See b/244619291.
343libvda = ["devices/libvda"]
344
345## Builds the VDA video backend with a set of no-ops stubs instead of linking with libvda, which is
346## only available on ChromeOS.
347libvda-stub = ["devices/libvda-stub"]
348
349## Enables the crosvm plugin API where functionality is provided via a FFI plugin API.
350## This feature is used to integrate Parallels with crosvm and is not functional upstream.
351plugin = ["protos/plugin", "crosvm_plugin", "kvm", "kvm_sys", "protobuf"]
352
353## Enables battery reporting via the ChromeOS powerd. Requires access to the
354## `org.chromium.PowerManager` dbus service.
355power-monitor-powerd = ["arch/power-monitor-powerd"]
356
357## Enables a virtualized TPM device that uses the `org.chromium.Vtpm` dbus service.
358vtpm = ["devices/vtpm"]
359
360#! #### Windows-future
361#!
362#! These features will only be functional in future builds of windows crosvm.
363
364## Enables reporting of crosvm crashes
365crash-report = ["broker_ipc/crash-report", "crash_report"]
366
367gvm = []
368perfetto = []
369process-invariants = []
370prod-build = []
371sandbox = []
372
373#! ### Platform Feature Sets
374#!
375#! These feature flags enable all features that are supported for a given platform.
376#! Note that these may include project specific features that will not be functional at runtime but
377#! are enabled for compile and test coverage.
378
379## All features that are compiled and tested for aarch64 and x86_64
380all-default = [
381    "android-sparse",
382    "arc_quota",
383    "audio_cras",
384    "composite-disk",
385    "crash-report",
386    "default",
387    "ffmpeg",
388    "fs_runtime_ugid_map",
389    "gdb",
390    "geniezone",
391    "gfxstream",
392    "gfxstream_stub",
393    "libvda-stub",
394    "media",
395    "net",
396    "noncoherent-dma",
397    "pci-hotplug",
398    "power-monitor-powerd",
399    "pvclock",
400    "registered_events",
401    "slirp",
402    "swap",
403    "tokio",
404    "trace_marker",
405    "vaapi",
406    "video-decoder",
407    "video-encoder",
408    "virgl_renderer",
409    "vtpm",
410    "wl-dmabuf",
411    "x",
412    "zstd-disk"
413]
414
415## All features that are compiled and tested for aarch64
416all-aarch64 = [
417    "audio_aaudio",
418    "all-default",
419    "android_display",
420    "android_display_stub",
421    "gunyah",
422    "libaaudio_stub",
423]
424
425## All features that are compiled and tested for riscv64
426all-riscv64 = [
427    "gdb",
428]
429
430## All features that are compiled and tested for x86_64
431all-x86_64 = [
432    "audio_aaudio",
433    "all-default",
434    "android_display",
435    "android_display_stub",
436    "libaaudio_stub",
437    "plugin",
438    "scudo"
439]
440
441## All features that are compiled and tested for armhf
442## Note: This platform is deprecated and will be phased out.
443all-armhf = [
444    "android-sparse",
445    "composite-disk",
446    "default",
447    "gdb",
448    "libvda-stub",
449    "net",
450]
451
452## All features that are compiled and tested for mingw64
453all-mingw64 = [
454    "android-sparse",
455    "audio",
456    "balloon",
457    "crash_report",
458    "gpu",
459    "haxm",
460    "net",
461    "slirp",
462    "slirp-debug",
463    "stats",
464    "vulkan_display",
465    "pvclock",
466]
467
468## All features that are compiled and tested for msvc64
469all-msvc64 = [ "all-mingw64" ]
470
471## All features that are compiled and tested for android builds
472all-android = [
473    "android-sparse",
474    "audio",
475    "audio_aaudio",
476    "balloon",
477    "composite-disk",
478    "config-file",
479    "fs_runtime_ugid_map",
480    "gdb",
481    "gdbstub",
482    "gdbstub_arch",
483    "geniezone",
484    "gunyah",
485    "libaaudio_stub",
486    "net",
487    "qcow",
488    "usb",
489]
490
491[dependencies]
492anyhow = "1"
493arch = { path = "arch" }
494argh = "0.1.10"
495argh_helpers = { path = "argh_helpers" }
496audio_streams = "*"
497base = { path = "base" }
498bit_field = { path = "bit_field" }
499broker_ipc = { path = "broker_ipc" }
500cfg-if = "1.0.0"
501crash_report = { path = "vendor/generic/crash_report", optional = true }
502cros_async = { path = "cros_async" }
503cros_tracing = { path = "cros_tracing" }
504crosvm_cli = { path = "crosvm_cli" }
505crosvm_plugin = { path = "crosvm_plugin", optional = true }
506devices = { path = "devices" }
507disk = { path = "disk" }
508document-features = { version = "0.2", optional = true }
509enumn = "0.1.0"
510ext2 = { path = "ext2" }
511gdbstub = { version = "0.7.0", optional = true }
512gdbstub_arch = { version = "0.3.0", optional = true }
513rutabaga_gfx = { path = "rutabaga_gfx"}
514hypervisor = { path = "hypervisor" }
515jail = { path = "jail" }
516kernel_cmdline = { path = "kernel_cmdline" }
517kernel_loader = { path = "kernel_loader" }
518kvm = { path = "kvm", optional = true }
519kvm_sys = { path = "kvm_sys", optional = true }
520libc = "0.2.153"
521libcras = "*"
522# Compile out trace statements in release builds
523log = { version = "0", features = ["release_max_level_debug"]}
524merge = "0.1.0"
525metrics = { path = "metrics" }
526metrics_events = { path = "metrics_events" }
527net_util = { path = "net_util" }
528once_cell = "1.7"
529protobuf = { version = "3.2", optional = true }
530protos = { path = "protos", optional = true }
531remain = "0.2"
532resources = { path = "resources" }
533scudo = { version = "0.1", optional = true }
534serde = { version = "1", features = ["rc"] }
535serde_json = "1"
536serde_keyvalue = { path = "serde_keyvalue", features = ["argh_derive"] }
537snapshot = { workspace = true }
538smallvec = "1.6.1"
539static_assertions = "1.1"
540swap = { path = "swap" }
541sync = { path = "common/sync" }
542thiserror = { version = "1.0.20" }
543vm_control = { path = "vm_control" }
544acpi_tables = { path = "acpi_tables" }
545vm_memory = { path = "vm_memory" }
546vmm_vhost = { path = "third_party/vmm_vhost" }
547uuid = { version = "1", features = ["v4"] }
548zerocopy = { version = "0.8.13", features = ["derive"] }
549
550[target.'cfg(target_arch = "riscv64")'.dependencies]
551riscv64 = { path = "riscv64" }
552
553[target.'cfg(target_arch = "x86_64")'.dependencies]
554x86_64 = { path = "x86_64" }
555
556[target.'cfg(any(target_arch = "aarch64", target_arch = "arm"))'.dependencies]
557aarch64 = { path = "aarch64" }
558
559[target.'cfg(any(target_os = "android", target_os = "linux"))'.dependencies]
560minijail = "*" # provided by ebuild
561p9 = "0.3.1"
562vhost = { path = "vhost" }
563android_audio = { path = "android_audio"}
564
565[target.'cfg(windows)'.dependencies]
566anti_tamper = { path = "vendor/generic/anti_tamper" }
567cros_async = { path = "cros_async" }
568ctrlc = "3"
569futures = "0.3"
570gpu_display = { path = "gpu_display", optional = true }
571rand = "0.8"
572sandbox = { path = "sandbox" }
573cros_tracing = { path = "cros_tracing" }
574tube_transporter = { path = "tube_transporter" }
575winapi = "0.3"
576win_audio = { path = "win_audio" }
577win_util = { path = "win_util" }
578
579[dev-dependencies]
580rand = "0.8"
581tempfile = "3"
582
583[patch.crates-io]
584audio_streams = { path = "common/audio_streams" }
585cros_async = { path = "cros_async" }
586data_model = { path = "common/data_model" }
587libcras = { path = "libcras_stub" } # ignored by ebuild
588sync = { path = "common/sync" }
589minijail = { path = "third_party/minijail/rust/minijail" } # ignored by ebuild
590