Skip to content

Commit

Permalink
github/workflows: Update CI according to stage1 changes
Browse files Browse the repository at this point in the history
stage1/*.S no longer exists. Update CI to build the object files for
svsm.bin & stage1-trampoline.bin instead.

Add a new clippy job for stage1 as well.

Signed-off-by: Peter Fang <[email protected]>
  • Loading branch information
peterfang committed Nov 19, 2024
1 parent d3bc843 commit 38d508e
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 13 deletions.
12 changes: 9 additions & 3 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ jobs:
# ld to work, so build all the objects without performing the
# final linking step.
- name: Build
run: make FEATURES="default,enable-gdb" bin/svsm-kernel.elf stage1/stage1.o stage1/reset.o
run: make FEATURES="default,enable-gdb" STAGE1_RUSTC_ARGS="--emit=obj -C linker=/usr/bin/true" stage1_elf_full stage1_elf_trampoline

- name: Run tests
run: make test
Expand All @@ -56,13 +56,19 @@ jobs:
uses: actions-rs/cargo@v1
with:
command: clippy
args: --workspace --exclude igvmbuilder --exclude igvmmeasure --exclude svsm-fuzz --all-features -- -D warnings
args: --workspace --exclude igvmbuilder --exclude igvmmeasure --exclude svsm-fuzz --exclude stage1 --all-features -- -D warnings

- name: Clippy on std x86_64-unknown-linux-gnu
uses: actions-rs/cargo@v1
with:
command: clippy
args: --workspace --all-features --exclude svsm --exclude svsm-fuzz --target=x86_64-unknown-linux-gnu -- -D warnings
args: --workspace --all-features --exclude svsm --exclude svsm-fuzz --exclude stage1 --target=x86_64-unknown-linux-gnu -- -D warnings

- name: Clippy on stage1
uses: actions-rs/cargo@v1
with:
command: clippy
args: --package stage1 --all-features --target=x86_64-unknown-linux-gnu -- -D warnings -C panic=abort

- name: Clippy on svsm-fuzz
uses: actions-rs/cargo@v1
Expand Down
28 changes: 18 additions & 10 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ else ifeq ($(V), 2)
CARGO_ARGS += -vv
endif

STAGE1_RUSTC_ARGS += -C panic=abort

STAGE1_ELF = "target/x86_64-unknown-none/${TARGET_PATH}/stage1"
STAGE2_ELF = "target/x86_64-unknown-none/${TARGET_PATH}/stage2"
SVSM_KERNEL_ELF = "target/x86_64-unknown-none/${TARGET_PATH}/svsm"
Expand Down Expand Up @@ -139,26 +141,32 @@ ifneq ($(FS_FILE), none)
endif
touch ${FS_BIN}

bin/svsm.bin: bin/stage2.bin bin/svsm-fs.bin bin/svsm-kernel.elf bin/meta.bin
stage1_elf_full: bin/stage2.bin bin/svsm-fs.bin bin/svsm-kernel.elf bin/meta.bin
ln -sf svsm-kernel.elf bin/kernel.elf
cargo rustc --manifest-path stage1/Cargo.toml ${CARGO_ARGS} --features load-stage2 --bin stage1 -- -C panic=abort
cargo rustc --manifest-path stage1/Cargo.toml ${CARGO_ARGS} --features load-stage2 --bin stage1 -- ${STAGE1_RUSTC_ARGS}
rm -f bin/kernel.elf
objcopy -O binary $(STAGE1_ELF) $@

bin/stage1-trampoline.bin: bin/meta.bin
cargo rustc --manifest-path stage1/Cargo.toml ${CARGO_ARGS} --bin stage1 -- -C panic=abort
objcopy -O binary $(STAGE1_ELF) $@
stage1_elf_trampoline: bin/meta.bin
cargo rustc --manifest-path stage1/Cargo.toml ${CARGO_ARGS} --bin stage1 -- ${STAGE1_RUSTC_ARGS}

bin/svsm-test.bin: bin/stage2.bin bin/svsm-fs.bin bin/test-kernel.elf bin/meta.bin
stage1_elf_test: bin/stage2.bin bin/svsm-fs.bin bin/test-kernel.elf bin/meta.bin
ln -sf test-kernel.elf bin/kernel.elf
cargo rustc --manifest-path stage1/Cargo.toml ${CARGO_ARGS} --features load-stage2 --bin stage1 -- -C panic=abort
cargo rustc --manifest-path stage1/Cargo.toml ${CARGO_ARGS} --features load-stage2 --bin stage1 -- ${STAGE1_RUSTC_ARGS}
rm -f bin/kernel.elf

bin/svsm.bin: stage1_elf_full
objcopy -O binary $(STAGE1_ELF) $@

bin/stage1-trampoline.bin: stage1_elf_trampoline
objcopy -O binary $(STAGE1_ELF) $@

bin/svsm-test.bin: stage1_elf_test
objcopy -O binary $(STAGE1_ELF) $@

clippy:
cargo clippy --workspace --all-features --exclude svsm-fuzz --exclude igvmbuilder --exclude igvmmeasure --exclude stage1 -- -D warnings
cargo clippy --workspace --all-features --exclude svsm-fuzz --exclude svsm --exclude stage1 --target=x86_64-unknown-linux-gnu -- -D warnings
cargo clippy -p stage1 --all-features --target=x86_64-unknown-linux-gnu -- -C panic=abort -D warnings
cargo clippy -p stage1 --all-features --target=x86_64-unknown-linux-gnu -- -D warnings ${STAGE1_RUSTC_ARGS}
RUSTFLAGS="--cfg fuzzing" cargo clippy --package svsm-fuzz --all-features --target=x86_64-unknown-linux-gnu -- -D warnings
cargo clippy --workspace --all-features --tests --target=x86_64-unknown-linux-gnu -- -D warnings

Expand All @@ -171,4 +179,4 @@ clean:
distclean: clean
$(MAKE) -C libmstpm $@

.PHONY: test clean clippy bin/stage2.bin bin/svsm-kernel.elf bin/test-kernel.elf bin/svsm.bin bin/stage1-trampoline.bin bin/svsm-test.bin distclean
.PHONY: test clean clippy bin/stage2.bin bin/svsm-kernel.elf bin/test-kernel.elf stage1_elf_full stage1_elf_trampoline stage1_elf_test bin/svsm.bin bin/stage1-trampoline.bin bin/svsm-test.bin distclean

0 comments on commit 38d508e

Please sign in to comment.