mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2025-03-20 07:58:55 +00:00
build: add a default feature KVM
It gets bubbled all the way up from hypervsior crate to top-level Cargo.toml. Cloud Hypervisor can't function without KVM at this point, so make it a default feature. Fix all scripts that use --no-default-features. Signed-off-by: Wei Liu <liuwe@microsoft.com>
This commit is contained in:
parent
861337cc6f
commit
5bfac796b3
2
.github/workflows/cross-build.yaml
vendored
2
.github/workflows/cross-build.yaml
vendored
@ -31,4 +31,4 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
use-cross: true
|
use-cross: true
|
||||||
command: build
|
command: build
|
||||||
args: --target=${{ matrix.target }} --no-default-features --features "mmio"
|
args: --target=${{ matrix.target }} --no-default-features --features "mmio,kvm"
|
||||||
|
@ -35,12 +35,13 @@ serde_json = "1.0.56"
|
|||||||
net_util = { path = "net_util" }
|
net_util = { path = "net_util" }
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
default = ["acpi", "pci", "cmos"]
|
default = ["acpi", "pci", "cmos", "kvm"]
|
||||||
acpi = ["vmm/acpi"]
|
acpi = ["vmm/acpi"]
|
||||||
pci = ["vmm/pci_support"]
|
pci = ["vmm/pci_support"]
|
||||||
mmio = ["vmm/mmio_support"]
|
mmio = ["vmm/mmio_support"]
|
||||||
cmos = ["vmm/cmos"]
|
cmos = ["vmm/cmos"]
|
||||||
fwdebug = ["vmm/fwdebug"]
|
fwdebug = ["vmm/fwdebug"]
|
||||||
|
kvm = ["vmm/kvm"]
|
||||||
|
|
||||||
# Integration tests require a special environment to run in
|
# Integration tests require a special environment to run in
|
||||||
integration_tests = []
|
integration_tests = []
|
||||||
|
@ -4,6 +4,8 @@ version = "0.1.0"
|
|||||||
authors = ["Muminul Islam <muislam@microsoft.com>"]
|
authors = ["Muminul Islam <muislam@microsoft.com>"]
|
||||||
edition = "2018"
|
edition = "2018"
|
||||||
|
|
||||||
|
[features]
|
||||||
|
kvm = []
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
anyhow = "1.0"
|
anyhow = "1.0"
|
||||||
|
@ -204,7 +204,7 @@ cmd_build() {
|
|||||||
[ $build = "release" ] && cargo_args+=("--release")
|
[ $build = "release" ] && cargo_args+=("--release")
|
||||||
cargo_args+=(--target "$target")
|
cargo_args+=(--target "$target")
|
||||||
[ $(uname -m) = "aarch64" ] && cargo_args+=("--no-default-features")
|
[ $(uname -m) = "aarch64" ] && cargo_args+=("--no-default-features")
|
||||||
[ $(uname -m) = "aarch64" ] && cargo_args+=(--features "mmio")
|
[ $(uname -m) = "aarch64" ] && cargo_args+=(--features "mmio,kvm")
|
||||||
|
|
||||||
rustflags=""
|
rustflags=""
|
||||||
if [ $(uname -m) = "aarch64" ] && [ $libc = "musl" ] ; then
|
if [ $(uname -m) = "aarch64" ] && [ $libc = "musl" ] ; then
|
||||||
|
@ -15,14 +15,14 @@ time cargo rustc --bin cloud-hypervisor -- -D warnings
|
|||||||
time cargo rustc -p vhost_user_net --bin vhost_user_net -- -D warnings
|
time cargo rustc -p vhost_user_net --bin vhost_user_net -- -D warnings
|
||||||
time cargo test
|
time cargo test
|
||||||
time cargo audit
|
time cargo audit
|
||||||
time cargo clippy --all-targets --no-default-features --features "pci,acpi" -- -D warnings
|
time cargo clippy --all-targets --no-default-features --features "pci,acpi,kvm" -- -D warnings
|
||||||
time cargo rustc --bin cloud-hypervisor --no-default-features --features "pci,acpi" -- -D warnings
|
time cargo rustc --bin cloud-hypervisor --no-default-features --features "pci,acpi,kvm" -- -D warnings
|
||||||
time cargo rustc -p vhost_user_net --bin vhost_user_net --no-default-features --features "pci,acpi" -- -D warnings
|
time cargo rustc -p vhost_user_net --bin vhost_user_net --no-default-features --features "pci,acpi,kvm" -- -D warnings
|
||||||
time cargo clippy --all-targets --no-default-features --features "pci" -- -D warnings
|
time cargo clippy --all-targets --no-default-features --features "pci,kvm" -- -D warnings
|
||||||
time cargo rustc --bin cloud-hypervisor --no-default-features --features "pci" -- -D warnings
|
time cargo rustc --bin cloud-hypervisor --no-default-features --features "pci,kvm" -- -D warnings
|
||||||
time cargo rustc -p vhost_user_net --bin vhost_user_net --no-default-features --features "pci" -- -D warnings
|
time cargo rustc -p vhost_user_net --bin vhost_user_net --no-default-features --features "pci,kvm" -- -D warnings
|
||||||
time cargo clippy --all-targets --no-default-features --features "mmio" -- -D warnings
|
time cargo clippy --all-targets --no-default-features --features "mmio,kvm" -- -D warnings
|
||||||
time cargo rustc --bin cloud-hypervisor --no-default-features --features "mmio" -- -D warnings
|
time cargo rustc --bin cloud-hypervisor --no-default-features --features "mmio,kvm" -- -D warnings
|
||||||
time cargo rustc -p vhost_user_net --bin vhost_user_net --no-default-features --features "mmio" -- -D warnings
|
time cargo rustc -p vhost_user_net --bin vhost_user_net --no-default-features --features "mmio,kvm" -- -D warnings
|
||||||
time cargo fmt -- --check
|
time cargo fmt -- --check
|
||||||
time cargo build --all --release
|
time cargo build --all --release
|
||||||
|
@ -178,7 +178,7 @@ sed -i 's/"with-serde",\ //g' hypervisor/Cargo.toml
|
|||||||
|
|
||||||
cargo_args=("$@")
|
cargo_args=("$@")
|
||||||
cargo_args+=("--no-default-features")
|
cargo_args+=("--no-default-features")
|
||||||
cargo_args+=("--features mmio")
|
cargo_args+=("--features mmio,kvm")
|
||||||
cargo build --release --target $BUILD_TARGET ${cargo_args[@]}
|
cargo build --release --target $BUILD_TARGET ${cargo_args[@]}
|
||||||
strip target/$BUILD_TARGET/release/cloud-hypervisor
|
strip target/$BUILD_TARGET/release/cloud-hypervisor
|
||||||
strip target/$BUILD_TARGET/release/vhost_user_net
|
strip target/$BUILD_TARGET/release/vhost_user_net
|
||||||
@ -204,7 +204,7 @@ RES=$?
|
|||||||
|
|
||||||
if [ $RES -eq 0 ]; then
|
if [ $RES -eq 0 ]; then
|
||||||
# virtio-mmio based testing
|
# virtio-mmio based testing
|
||||||
cargo build --release --target $BUILD_TARGET --no-default-features --features "mmio"
|
cargo build --release --target $BUILD_TARGET --no-default-features --features "mmio,kvm"
|
||||||
strip target/$BUILD_TARGET/release/cloud-hypervisor
|
strip target/$BUILD_TARGET/release/cloud-hypervisor
|
||||||
strip target/$BUILD_TARGET/release/vhost_user_net
|
strip target/$BUILD_TARGET/release/vhost_user_net
|
||||||
strip target/$BUILD_TARGET/release/ch-remote
|
strip target/$BUILD_TARGET/release/ch-remote
|
||||||
@ -212,12 +212,12 @@ if [ $RES -eq 0 ]; then
|
|||||||
sudo setcap cap_net_admin+ep target/$BUILD_TARGET/release/cloud-hypervisor
|
sudo setcap cap_net_admin+ep target/$BUILD_TARGET/release/cloud-hypervisor
|
||||||
|
|
||||||
# Ensure test binary has the same caps as the cloud-hypervisor one
|
# Ensure test binary has the same caps as the cloud-hypervisor one
|
||||||
time cargo test --no-run --no-default-features --features "integration_tests,mmio" -- --nocapture || exit 1
|
time cargo test --no-run --no-default-features --features "integration_tests,mmio,kvm" -- --nocapture || exit 1
|
||||||
ls target/debug/deps/cloud_hypervisor-* | xargs -n 1 sudo setcap cap_net_admin+ep
|
ls target/debug/deps/cloud_hypervisor-* | xargs -n 1 sudo setcap cap_net_admin+ep
|
||||||
|
|
||||||
newgrp kvm << EOF
|
newgrp kvm << EOF
|
||||||
export RUST_BACKTRACE=1
|
export RUST_BACKTRACE=1
|
||||||
time cargo test --no-default-features --features "integration_tests,mmio" "tests::parallel::test_aarch64_pe_boot" -- --nocapture
|
time cargo test --no-default-features --features "integration_tests,mmio,kvm" "tests::parallel::test_aarch64_pe_boot" -- --nocapture
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
RES=$?
|
RES=$?
|
||||||
|
@ -249,7 +249,7 @@ fi
|
|||||||
|
|
||||||
if [ $RES -eq 0 ]; then
|
if [ $RES -eq 0 ]; then
|
||||||
# virtio-mmio based testing
|
# virtio-mmio based testing
|
||||||
cargo build --all --release --target $BUILD_TARGET --no-default-features --features "mmio"
|
cargo build --all --release --target $BUILD_TARGET --no-default-features --features "mmio,kvm"
|
||||||
strip target/$BUILD_TARGET/release/cloud-hypervisor
|
strip target/$BUILD_TARGET/release/cloud-hypervisor
|
||||||
strip target/$BUILD_TARGET/release/vhost_user_net
|
strip target/$BUILD_TARGET/release/vhost_user_net
|
||||||
strip target/$BUILD_TARGET/release/ch-remote
|
strip target/$BUILD_TARGET/release/ch-remote
|
||||||
|
@ -5,7 +5,7 @@ source $HOME/.cargo/env
|
|||||||
BUILD_TARGET=${BUILD_TARGET-x86_64-unknown-linux-gnu}
|
BUILD_TARGET=${BUILD_TARGET-x86_64-unknown-linux-gnu}
|
||||||
cargo_args=("$@")
|
cargo_args=("$@")
|
||||||
[ $(uname -m) = "aarch64" ] && cargo_args+=("--no-default-features")
|
[ $(uname -m) = "aarch64" ] && cargo_args+=("--no-default-features")
|
||||||
[ $(uname -m) = "aarch64" ] && cargo_args+=("--features mmio")
|
[ $(uname -m) = "aarch64" ] && cargo_args+=("--features mmio,kvm")
|
||||||
[ $(uname -m) = "aarch64" ] && sed -i 's/"with-serde",\ //g' hypervisor/Cargo.toml
|
[ $(uname -m) = "aarch64" ] && sed -i 's/"with-serde",\ //g' hypervisor/Cargo.toml
|
||||||
|
|
||||||
cargo test --target $BUILD_TARGET --workspace --no-run ${cargo_args[@]}
|
cargo test --target $BUILD_TARGET --workspace --no-run ${cargo_args[@]}
|
||||||
|
@ -11,6 +11,7 @@ pci_support = ["pci", "vfio-ioctls", "virtio-devices/pci_support"]
|
|||||||
mmio_support = ["virtio-devices/mmio_support"]
|
mmio_support = ["virtio-devices/mmio_support"]
|
||||||
cmos = ["devices/cmos"]
|
cmos = ["devices/cmos"]
|
||||||
fwdebug = ["devices/fwdebug"]
|
fwdebug = ["devices/fwdebug"]
|
||||||
|
kvm = ["hypervisor/kvm"]
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
arc-swap = ">=0.4.4"
|
arc-swap = ">=0.4.4"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user