From 38d508ed5598452b15d665b398bf177cb9aaf66d Mon Sep 17 00:00:00 2001 From: Peter Fang Date: Mon, 18 Nov 2024 21:25:34 -0800 Subject: [PATCH] github/workflows: Update CI according to stage1 changes 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 --- .github/workflows/rust.yml | 12 +++++++++--- Makefile | 28 ++++++++++++++++++---------- 2 files changed, 27 insertions(+), 13 deletions(-) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 668670ada..3562095ef 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -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 @@ -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 diff --git a/Makefile b/Makefile index 3cb44e9f1..6eb9447a0 100644 --- a/Makefile +++ b/Makefile @@ -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" @@ -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 @@ -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