| [package] |
| name = "crosvm" |
| version = "0.1.0" |
| authors = ["The ChromiumOS Authors"] |
| edition = "2021" |
| default-run = "crosvm" |
| |
| [[bin]] |
| name = "crosvm" |
| path = "src/main.rs" |
| |
| [profile.release] |
| panic = 'abort' |
| opt-level = 3 |
| overflow-checks = true |
| |
| [profile.release-test] |
| inherits = 'release' |
| panic = 'unwind' |
| |
| # Reproduces the options used when building crosvm for ChromeOS. |
| [profile.chromeos] |
| inherits = "release" |
| strip = "symbols" |
| |
| # Enables LTO to further reduce the size of the binary. |
| [profile.lto] |
| inherits = "chromeos" |
| lto = true |
| |
| # Set codegen units to 1 to further reduce binary size. |
| [profile.largecodegen] |
| inherits = "lto" |
| codegen-units = 1 |
| |
| [workspace] |
| # Explicitly list all crates of crosvm as workspace members since not all of them may be referenced |
| # by dependencies. |
| members = [ |
| "aarch64", |
| "aarch64_sys_reg", |
| "acpi_tables", |
| "android_audio", |
| "arch", |
| "argh_helpers", |
| "audio_util", |
| "audio_streams_conformance_test", |
| "base", |
| "base_tokio", |
| "bit_field", |
| "broker_ipc", |
| "common/audio_streams", |
| "common/balloon_control", |
| "common/data_model", |
| "common/sync", |
| "cros_async", |
| "cros_fdt", |
| "cros_tracing", |
| "crosvm_cli", |
| "crosvm_control", |
| "crosvm_plugin", |
| "devices", |
| "disk", |
| "e2e_tests", |
| "ext2", |
| "fuse", |
| "fuzz", |
| "gpu_display", |
| "hypervisor", |
| "hypervisor/hypervisor_test_macro", |
| "io_uring", |
| "kernel_cmdline", |
| "kernel_loader", |
| "kvm_sys", |
| "kvm", |
| "libcras_stub", |
| "linux_input_sys", |
| "media/ffmpeg", |
| "metrics", |
| "metrics_events", |
| "net_sys", |
| "net_util", |
| "power_monitor", |
| "prebuilts", |
| "protos", |
| "proto_build_tools", |
| "resources", |
| "rutabaga_gfx", |
| "serde_keyvalue", |
| "snapshot", |
| "swap", |
| "system_api", |
| "third_party/vmm_vhost", |
| "tools/impl/catapult_converter", |
| "usb_sys", |
| "usb_util", |
| "vendor/generic/anti_tamper", |
| "vendor/generic/crash_report", |
| "vendor/generic/crypto", |
| "vfio_sys", |
| "vhost", |
| "virtio_sys", |
| "vm_control", |
| "vm_memory", |
| "x86_64", |
| ] |
| |
| # Exclude crates from crosvm builds completely. Avoid using this if possible as crates added here |
| # will not be tested in CI and may break at any time. |
| exclude = [ |
| "sandbox", |
| "tools/audio_streams_conformance_test", |
| "tools/examples/baremetal", |
| "perfetto", |
| |
| # This crate depends on optional features and is compiled via dependencies when enabled. |
| "media/libvda", |
| ] |
| |
| [workspace.dependencies] |
| ciborium = "0.2.2" |
| tokio = { version = "1.29.1", features = ["net", "rt-multi-thread", "time", "sync", "macros"] } |
| snapshot = { path = "snapshot" } |
| |
| [features] |
| ## Default features of crosvm. This selection is somewhat arbitrary for historical reasons. |
| default = ["audio", "balloon", "config-file", "document-features", "gpu", "qcow", "usb", "libvda-stub", "net", "slirp"] |
| |
| ## Enables support for the Android [sparse image format](https://android.googlesource.com/platform/system/core/+/HEAD/libsparse/sparse_format.h) |
| ## in the block device. |
| android-sparse = ["disk/android-sparse"] |
| |
| ## Enables cross-platform audio devices |
| audio = ["devices/audio", "vm_control/audio"] |
| |
| ## Enables the virtio-balloon device which allows dynamic scaling of memory via `vm_control` |
| ## commands. See [Balloon Device](https://crosvm.dev/book/devices/balloon.html) for more |
| ## information. |
| balloon = ["devices/balloon", "vm_control/balloon"] |
| |
| ## Enables the composite-disk format, which adds protobufs as a dependency of the build. This format |
| ## is intended to speed up crosvm's usage in CI environments that might otherwise have to |
| ## concatenate large file system images into a single disk image. |
| composite-disk = ["protos/composite-disk", "protobuf", "disk/composite-disk"] |
| |
| ## Enables support for using a seekable zstd archive of a raw disk image as a read-only disk. |
| ## See [Format Specs](https://github.com/facebook/zstd/tree/v1.5.6/contrib/seekable_format) for |
| ## more information. |
| zstd-disk = ["disk/zstd-disk"] |
| |
| ## Enables virtiofs uid-gid mapping from the host side through command line when user-namespace |
| ## isn't available for non-root users. This format is supported only for vhost-user-fs. |
| fs_runtime_ugid_map = ["devices/fs_runtime_ugid_map"] |
| |
| ## Enables support for JSON configuration files that can be specified using `--cfg`. See |
| ## [Configuration Files](https://crosvm.dev/book/running_crosvm/options.html#configuration-files) |
| ## for more information. |
| config-file = [] |
| |
| ## Enables using gdb to debug the guest kernel. See |
| ## [GDB Support](https://crosvm.dev/book/running_crosvm/advanced_usage.html#gdb-support) for more |
| ## information. |
| gdb = [ |
| "aarch64/gdb", |
| "arch/gdb", |
| "gdbstub", |
| "gdbstub_arch", |
| "riscv64/gdb", |
| "vm_control/gdb", |
| "x86_64/gdb", |
| ] |
| |
| ## Enables virtio-net and vhost-user-net backend. |
| net = ["devices/net"] |
| |
| ## Enables PCI hotplug. Only available on Linux, and currently only for x86/x86-64. |
| pci-hotplug = ["devices/pci-hotplug", "vm_control/pci-hotplug"] |
| |
| ## Enables virtio-pvclock. Currently only available for x86-64 and aarch64. |
| pvclock = ["devices/pvclock"] |
| |
| ## Enables the use of the qcow format for block devices. |
| qcow = ["disk/qcow"] |
| |
| ## Enables the registered_events mechanisms. |
| registered_events = ["protos/registered_events", "protobuf", "base/proto_tube", "vm_control/registered_events", "devices/registered_events"] |
| |
| ## Enables vmm-swap of guest memory. This is only available on Linux. |
| swap = ["aarch64/swap", "arch/swap", "devices/swap", "vm_control/swap", "x86_64/swap", "swap/enable"] |
| |
| ## Enables collection of VM statistics. |
| stats = ["devices/stats"] |
| |
| ## Supports tokio as an asynchronous executor. |
| tokio = ["cros_async/tokio"] |
| |
| ## Enables USB host device passthrough via an emulated XHCI controller. |
| ## USB is supported only on unix/linux. The feature is a no-op on windows. |
| usb = ["devices/usb"] |
| |
| ## Enables the non-upstream virtio wayland protocol. This can be used in conjuction with the gpu |
| ## feature to enable a zero-copy display pipeline. |
| wl-dmabuf = ["devices/minigbm"] |
| |
| ## Enables the usage of the X11 protocol for display on the host. |
| x = ["devices/x"] |
| |
| #! ### Graphics features |
| |
| ## Enables basic virtio-gpu support. This includes basic display and input features, but lacks 3D |
| ## acceleration in the absence of other crosvm features. |
| gpu = ["devices/gpu", "gpu_display", "vm_control/gpu"] |
| |
| ## Enables 3D acceleration for guest via the gfxstream protocol over virtio-gpu. This is used for |
| ## compatibility with the Android Emulator. The protocol provides the best speed and compatibility |
| ## with GL/vulkan versions by forwarding the guest's calls to the host's graphics libraries and GPU. |
| ## However, this means the sandbox is not enabled for the virtio-gpu device. |
| gfxstream = ["devices/gfxstream"] |
| |
| ## Adds a stub implementation of gfxstream to allow us to compile the gfxstream feature without |
| ## access to the gfxstream library. |
| ## Note that this feature only allows compilation of gfxstream and will not be functional at |
| ## runtime. |
| gfxstream_stub = ["rutabaga_gfx/gfxstream_stub"] |
| |
| ## Enables 3D acceleration for the guest via the virglrenderer library over virtio-gpu. |
| virgl_renderer = ["devices/virgl_renderer"] |
| |
| ## Enables the usage of Vulkan for display on the host. |
| vulkan_display = ["gpu_display/vulkan_display"] |
| |
| # Enables the highly experimental vulkan graphics buffer allocator. |
| # see rutabaga_gfx/Cargo.toml for instructions on building with enabled. |
| vulkano = ["rutabaga_gfx/vulkano"] |
| |
| # Enables the GPU display backend for Android. The backend uses Android surface as the backing |
| # store. |
| android_display = ["devices/android_display"] |
| |
| # Stub implementation of the Android display backend. This is only used for building and testing the |
| # Android display backend on a non-Android target |
| android_display_stub = ["devices/android_display_stub"] |
| |
| #! ### Video features |
| #! |
| #! See [Video Device](https://crosvm.dev/book/devices/video.html) for more information. |
| |
| ## Enables the video decoding device |
| video-decoder = ["devices/video-decoder"] |
| |
| ## Enables the video encoding device |
| video-encoder = ["devices/video-encoder"] |
| |
| ## Enables the ffmpeg backend of video devices. |
| ffmpeg = ["devices/ffmpeg"] |
| |
| # Enables the VAAPI backend of video devices. |
| vaapi = ["devices/vaapi"] |
| |
| ## Enables the virtio-media device. |
| media = ["devices/media"] |
| |
| #! ### Linux-specific feature flags |
| |
| ## Enables the use of the GenieZone hypervisor |
| geniezone = ["devices/geniezone", "hypervisor/geniezone"] |
| |
| ## Enables the use of the Gunyah hypervisor |
| gunyah = ["devices/gunyah", "hypervisor/gunyah"] |
| |
| ## Enables the Linux trace_marker backend for cros_tracing. This backend is only |
| ## supported on Linux systems. It sends all cros_tracing tracepoints to the tracefs |
| ## filesystem if mounted, for easier debugging with tools like trace-cmd. |
| trace_marker = ["cros_tracing/trace_marker"] |
| |
| ## Facilitate tracing all syscalls by sandboxed processes. |
| seccomp_trace = ["jail/seccomp_trace","base/seccomp_trace","devices/seccomp_trace"] |
| |
| ## Enables virtio-gpu devices to request a non-coherent memory mapping from the |
| ## hypervisor. Currently only supported in KVM on x86 and requires kernel |
| ## patches from: |
| ## <https://lore.kernel.org/all/20240105091535.24760-1-yan.y.zhao@intel.com/> |
| noncoherent-dma = ["devices/noncoherent-dma", "hypervisor/noncoherent-dma"] |
| |
| #! ### Windows-specific feature flags |
| #! |
| #! These feature flags are only available on Windows builds of crosvm. |
| |
| ## Enables the use of the HAXM hypervisor |
| haxm = ["hypervisor/haxm"] |
| |
| ## Enables the use of the WHPX hypervisor |
| whpx = ["devices/whpx", "hypervisor/whpx"] |
| |
| ## Enables a libslirp based network device. Currently only supported on Windows. |
| slirp = ["devices/slirp", "net_util/slirp"] |
| |
| ## Enables slirp debugging. |
| slirp-debug = ["net_util/slirp-debug"] |
| |
| ## Enables slirp capture. |
| slirp-ring-capture = [ |
| "net_util/slirp-ring-capture", |
| "devices/slirp-ring-capture", |
| ] |
| |
| #! ### Non-additive feature flags |
| #! |
| #! These feature flags change the behavior of crosvm instead of adding functionality. |
| #! This is deprecated and will be phased out. |
| |
| ## Run crosvm with `--disable-sandbox` by default. |
| default-no-sandbox = [] |
| |
| #! ### Project specific features |
| #! |
| #! These features are specific to downstream projects and may not be functional or useful |
| #! for standard linux builds of crosvm. |
| #! They are however enabled in upstream builds for compile and test coverage in CI. |
| |
| #! #### ChromeOS |
| #! |
| #! These features will only be functional in ChromeOS builds running on ChromeOS. |
| |
| ## Enables ARCVM specified virtio-fs feature including: |
| ## - Support quota reporting for ARCVM |
| ## Requires access to the org.chromium.ArcQuota dbus service. |
| ## - Support for FS_IOC_SETPERMISSION ioctl |
| ## - Support for FS_IOC_SETPATHXATTR ioctl |
| arc_quota = ["devices/arc_quota"] |
| |
| ## Enables use of Android AAudio virtio-snd backend. |
| audio_aaudio = ["devices/audio_aaudio"] |
| |
| ## Stub implementation of Android AAudio NDK library. This is only used for building and testing the |
| ## Android audio on a non-Android target |
| libaaudio_stub = ["android_audio/libaaudio_stub"] |
| |
| ## Enables use of the ChromeOS audio server. ChromeOS builds will replace libcras_stub with an |
| ## implementation that talks to the audio server. In upstream builds, using this option will panic. |
| audio_cras = ["devices/audio_cras"] |
| |
| ## Enables the VDA backend of the video devices. This feature requires the ChromeOS only |
| ## libvda library and can be compiled but not linked. See b/244619291. |
| libvda = ["devices/libvda"] |
| |
| ## Builds the VDA video backend with a set of no-ops stubs instead of linking with libvda, which is |
| ## only available on ChromeOS. |
| libvda-stub = ["devices/libvda-stub"] |
| |
| ## Enables the crosvm plugin API where functionality is provided via a FFI plugin API. |
| ## This feature is used to integrate Parallels with crosvm and is not functional upstream. |
| plugin = ["protos/plugin", "crosvm_plugin", "kvm", "kvm_sys", "protobuf"] |
| |
| ## Enables battery reporting via the ChromeOS powerd. Requires access to the |
| ## `org.chromium.PowerManager` dbus service. |
| power-monitor-powerd = ["arch/power-monitor-powerd"] |
| |
| ## Enables a virtualized TPM device that uses the `org.chromium.Vtpm` dbus service. |
| vtpm = ["devices/vtpm"] |
| |
| #! #### Windows-future |
| #! |
| #! These features will only be functional in future builds of windows crosvm. |
| |
| ## Enables reporting of crosvm crashes |
| crash-report = ["broker_ipc/crash-report", "crash_report"] |
| |
| gvm = [] |
| perfetto = [] |
| process-invariants = [] |
| prod-build = [] |
| sandbox = [] |
| |
| #! ### Platform Feature Sets |
| #! |
| #! These feature flags enable all features that are supported for a given platform. |
| #! Note that these may include project specific features that will not be functional at runtime but |
| #! are enabled for compile and test coverage. |
| |
| ## All features that are compiled and tested for aarch64 and x86_64 |
| all-default = [ |
| "android-sparse", |
| "arc_quota", |
| "audio_cras", |
| "composite-disk", |
| "crash-report", |
| "default", |
| "ffmpeg", |
| "fs_runtime_ugid_map", |
| "gdb", |
| "geniezone", |
| "gfxstream", |
| "gfxstream_stub", |
| "libvda-stub", |
| "media", |
| "net", |
| "noncoherent-dma", |
| "pci-hotplug", |
| "power-monitor-powerd", |
| "pvclock", |
| "registered_events", |
| "slirp", |
| "swap", |
| "tokio", |
| "trace_marker", |
| "vaapi", |
| "video-decoder", |
| "video-encoder", |
| "virgl_renderer", |
| "vtpm", |
| "wl-dmabuf", |
| "x", |
| "zstd-disk" |
| ] |
| |
| ## All features that are compiled and tested for aarch64 |
| all-aarch64 = [ |
| "audio_aaudio", |
| "all-default", |
| "android_display", |
| "android_display_stub", |
| "gunyah", |
| "libaaudio_stub", |
| ] |
| |
| ## All features that are compiled and tested for riscv64 |
| all-riscv64 = [ |
| "gdb", |
| "default", |
| ] |
| |
| ## All features that are compiled and tested for x86_64 |
| all-x86_64 = [ |
| "audio_aaudio", |
| "all-default", |
| "android_display", |
| "android_display_stub", |
| "libaaudio_stub", |
| "plugin", |
| "scudo" |
| ] |
| |
| ## All features that are compiled and tested for armhf |
| ## Note: This platform is deprecated and will be phased out. |
| all-armhf = [ |
| "android-sparse", |
| "composite-disk", |
| "default", |
| "gdb", |
| "libvda-stub", |
| "net", |
| ] |
| |
| ## All features that are compiled and tested for mingw64 |
| all-mingw64 = [ |
| "android-sparse", |
| "audio", |
| "balloon", |
| "crash_report", |
| "gpu", |
| "haxm", |
| "net", |
| "slirp", |
| "slirp-debug", |
| "stats", |
| "vulkan_display", |
| "pvclock", |
| ] |
| |
| ## All features that are compiled and tested for msvc64 |
| all-msvc64 = [ "all-mingw64" ] |
| |
| ## All features that are compiled and tested for android builds |
| all-android = [ |
| "android-sparse", |
| "audio", |
| "audio_aaudio", |
| "balloon", |
| "composite-disk", |
| "config-file", |
| "fs_runtime_ugid_map", |
| "gdb", |
| "gdbstub", |
| "gdbstub_arch", |
| "geniezone", |
| "gunyah", |
| "libaaudio_stub", |
| "net", |
| "qcow", |
| "usb", |
| ] |
| |
| [dependencies] |
| anyhow = "1" |
| arch = { path = "arch" } |
| argh = "0.1.10" |
| argh_helpers = { path = "argh_helpers" } |
| aarch64_sys_reg = { path = "aarch64_sys_reg" } |
| base = { path = "base" } |
| bit_field = { path = "bit_field" } |
| broker_ipc = { path = "broker_ipc" } |
| cfg-if = "1.0.0" |
| crash_report = { path = "vendor/generic/crash_report", optional = true } |
| cros_async = { path = "cros_async" } |
| cros_tracing = { path = "cros_tracing" } |
| crosvm_cli = { path = "crosvm_cli" } |
| crosvm_plugin = { path = "crosvm_plugin", optional = true } |
| devices = { path = "devices" } |
| disk = { path = "disk" } |
| document-features = { version = "0.2", optional = true } |
| enumn = "0.1.0" |
| ext2 = { path = "ext2" } |
| gdbstub = { version = "0.7.0", optional = true } |
| gdbstub_arch = { version = "0.3.0", optional = true } |
| rutabaga_gfx = { path = "rutabaga_gfx"} |
| hypervisor = { path = "hypervisor" } |
| jail = { path = "jail" } |
| kernel_cmdline = { path = "kernel_cmdline" } |
| kernel_loader = { path = "kernel_loader" } |
| kvm = { path = "kvm", optional = true } |
| kvm_sys = { path = "kvm_sys", optional = true } |
| libc = "0.2.153" |
| libcras = "*" |
| # Compile out trace statements in release builds |
| log = { version = "0", features = ["release_max_level_debug"]} |
| merge = "0.1.0" |
| metrics = { path = "metrics" } |
| metrics_events = { path = "metrics_events" } |
| net_util = { path = "net_util" } |
| protobuf = { version = "3.2", optional = true } |
| protos = { path = "protos", optional = true } |
| remain = "0.2" |
| resources = { path = "resources" } |
| scudo = { version = "0.1", optional = true } |
| serde = { version = "1", features = ["rc"] } |
| serde_json = "1" |
| serde_keyvalue = { path = "serde_keyvalue", features = ["argh_derive"] } |
| snapshot = { workspace = true } |
| smallvec = "1.6.1" |
| static_assertions = "1.1" |
| swap = { path = "swap" } |
| sync = { path = "common/sync" } |
| thiserror = { version = "1.0.20" } |
| vm_control = { path = "vm_control" } |
| acpi_tables = { path = "acpi_tables" } |
| vm_memory = { path = "vm_memory" } |
| vmm_vhost = { path = "third_party/vmm_vhost" } |
| uuid = { version = "1", features = ["v4"] } |
| zerocopy = { version = "0.8.13", features = ["derive"] } |
| |
| [target.'cfg(target_arch = "riscv64")'.dependencies] |
| riscv64 = { path = "riscv64" } |
| |
| [target.'cfg(target_arch = "x86_64")'.dependencies] |
| x86_64 = { path = "x86_64" } |
| |
| [target.'cfg(any(target_arch = "aarch64", target_arch = "arm"))'.dependencies] |
| aarch64 = { path = "aarch64" } |
| |
| [target.'cfg(any(target_os = "android", target_os = "linux"))'.dependencies] |
| minijail = "*" # provided by ebuild |
| p9 = "0.3.1" |
| vhost = { path = "vhost" } |
| android_audio = { path = "android_audio"} |
| |
| [target.'cfg(windows)'.dependencies] |
| anti_tamper = { path = "vendor/generic/anti_tamper" } |
| ctrlc = "3" |
| futures = "0.3" |
| gpu_display = { path = "gpu_display", optional = true } |
| rand = "0.8" |
| sandbox = { path = "sandbox" } |
| cros_tracing = { path = "cros_tracing" } |
| tube_transporter = { path = "tube_transporter" } |
| winapi = "0.3" |
| win_audio = { path = "win_audio" } |
| win_util = { path = "win_util" } |
| |
| [dev-dependencies] |
| rand = "0.8" |
| tempfile = "3" |
| |
| [patch.crates-io] |
| audio_streams = { path = "common/audio_streams" } |
| libcras = { path = "libcras_stub" } # ignored by ebuild |
| minijail = { path = "third_party/minijail/rust/minijail" } # ignored by ebuild |