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