Cargo.toml 17 KB

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