Skip to content

Commit

Permalink
Merge pull request #422 from AdamCDunlap/build-without-mstpm
Browse files Browse the repository at this point in the history
build: Allow building without mstpm
  • Loading branch information
joergroedel committed Aug 16, 2024
2 parents 35c47b3 + f6da12e commit aa4936a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 9 deletions.
14 changes: 6 additions & 8 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
FEATURES ?= "default"
SVSM_ARGS = --features ${FEATURES}
FEATURES ?= mstpm
SVSM_ARGS += --features ${FEATURES}

SVSM_ARGS_TEST = --no-default-features
ifdef FEATURES_TEST
SVSM_ARGS_TEST += --features ${FEATURES_TEST}
endif
FEATURES_TEST ?= mstpm
SVSM_ARGS_TEST += --no-default-features --features ${FEATURES_TEST}

ifdef RELEASE
TARGET_PATH=release
Expand Down Expand Up @@ -112,15 +110,15 @@ bin/meta.bin: utils/gen_meta utils/print-meta bin
./utils/gen_meta $@

bin/stage2.bin: bin
cargo build --manifest-path kernel/Cargo.toml ${CARGO_ARGS} --no-default-features --bin stage2
cargo build --manifest-path kernel/Cargo.toml ${CARGO_ARGS} --bin stage2
objcopy -O binary ${STAGE2_ELF} $@

bin/svsm-kernel.elf: bin
cargo build ${CARGO_ARGS} ${SVSM_ARGS} --bin svsm
objcopy -O elf64-x86-64 --strip-unneeded ${SVSM_KERNEL_ELF} $@

bin/test-kernel.elf: bin
LINK_TEST=1 cargo +nightly test ${CARGO_ARGS} -p svsm --config 'target.x86_64-unknown-none.runner=["sh", "-c", "cp $$0 ../${TEST_KERNEL_ELF}"]'
LINK_TEST=1 cargo +nightly test ${CARGO_ARGS} ${SVSM_ARGS_TEST} -p svsm --config 'target.x86_64-unknown-none.runner=["sh", "-c", "cp $$0 ../${TEST_KERNEL_ELF}"]'
objcopy -O elf64-x86-64 --strip-unneeded ${TEST_KERNEL_ELF} bin/test-kernel.elf

${FS_BIN}: bin
Expand Down
2 changes: 1 addition & 1 deletion kernel/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ libmstpm = { workspace = true, optional = true }
test.workspace = true

[features]
default = ["mstpm"]
default = []
enable-gdb = ["dep:gdbstub", "dep:gdbstub_arch"]
mstpm = ["dep:libmstpm"]

Expand Down

0 comments on commit aa4936a

Please sign in to comment.