Skip to content

Commit

Permalink
pvh: Control PVH capabilities using optional feature
Browse files Browse the repository at this point in the history
Enable the optional "pvh" feature to build a Firecracker binary
that is able to boot Linux guests using the PVH boot protocol.
Build a firecracker binary with the PVH capability by running:

tools/devtool build [--release] -- --features pvh

and the resulting Firecracker binary will use the PVH boot
protocol as the preferred choice for booting a guest, if the
guest kernel supports it.

Signed-off-by: Alejandro Jimenez <alejandro.j.jimenez@oracle.com>
Acked-by: Liam Merwick <liam.merwick@oracle.com>
  • Loading branch information
aljimenezb committed Apr 23, 2020
1 parent 85be111 commit 890af2b
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/firecracker/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,6 @@ polly = { path = "../polly" }
seccomp = { path = "../seccomp" }
utils = { path = "../utils" }
vmm = { path = "../vmm" }

[features]
pvh = ["vmm/pvh"]
3 changes: 3 additions & 0 deletions src/vmm/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,6 @@ cpuid = { path = "../cpuid" }

[dev-dependencies]
vmm-sys-util = ">=0.4.0"

[features]
pvh = []
22 changes: 22 additions & 0 deletions tools/devtool
Original file line number Diff line number Diff line change
Expand Up @@ -475,6 +475,28 @@ cmd_build() {

[ $profile = "release" ] && cargo_args+=("--release")

# Parse any optional features passed to cargo.
# Currently, cargo does not support specifying features in a workspace, so passing
# the "--features opt-feature" option to cargo does not enable the optional feature
# in the crates that are part of the workspace, as one would expect. In order to
# build the individual crates with non-default features, we can use the cargo build
# option "--manifest-path", to direct cargo to use the Cargo.toml file that defines
# the desired feature. The downside is that other independent crates in the workspace
# (i.e. jailer) will not be built.
while [ $# -gt 0 ]; do
case "$1" in
"--features")
shift
[[ "$1" =~ ^--* ]] && \
die "Must specify a feature name: \"--features <opt_feature>\"."
say_warn "WARNING: Building Firecracker with experimental feature." \
"The jailer binary will not be built."
cargo_args+=("--manifest-path" "src/firecracker/Cargo.toml")
;;
esac
shift
done

# Run the cargo build process inside the container.
# We don't need any special privileges for the build phase, so we run the
# container as the current user/group.
Expand Down

0 comments on commit 890af2b

Please sign in to comment.