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