Open jejb opened 1 year ago
A quick build shows that the use of xargo
can be replaced with cargo
(but it still uses unstable features defined in .cargo/config.toml
):
diff --git a/Makefile b/Makefile
index 5f4a012..af0bbf8 100644
--- a/Makefile
+++ b/Makefile
@@ -46,7 +46,7 @@ svsm.bin.elf: $(OBJS) src/start/svsm.lds
$(GCC) $(LD_FLAGS) -o $@ $(OBJS)
%.a: src/*.rs src/cpu/*.rs src/mem/*.rs src/util/*.rs
- @xargo build --features $(FEATURES)
+ cargo build --features $(FEATURES)
%.o: %.S src/start/svsm.h
$(GCC) $(C_FLAGS) $(LDS_FLAGS) $(A_FLAGS) -c -o $@ $<
@@ -64,12 +64,11 @@ prereq: .prereq
rustup component add rust-src
rustup component add llvm-tools-preview
rustup override set nightly
- cargo install xargo
cargo install bootimage
touch .prereq
clean:
- @xargo clean
+ cargo clean
rm -f svsm.bin svsm.bin.elf $(OBJS)
rm -rf $(TARGET_DIR)
rm -f src/start/svsm.lds
I haven't yet tried booting with it, but it compiled nicely.
This doesn't quite work for me; I get
error: language item required, but not found: eh_personality
|
= note: this can occur when a binary crate with #![no_std]
is compiled for a target where eh_personality
is defined in the standard library
= help: you may be able to compile for a target that doesn't need eh_personality
, specify a target with --target
or in .cargo/config
To fix this, I have to specify a --target x86_64-unknown-none to cargo:
diff --git a/Makefile b/Makefile
index 5f4a012..e624dc2 100644
--- a/Makefile
+++ b/Makefile
@@ -17,7 +17,7 @@ LD_FLAGS += -nostdlib
LD_FLAGS += -Wl,-Tsrc/start/svsm.lds -Wl,--build-id=none
TARGET_DIR := target
-TARGET := $(TARGET_DIR)/svsm-target/debug
+TARGET := $(TARGET_DIR)/x86_64-unknown-none/debug
OBJS := src/start/start.o
OBJS += $(TARGET)/liblinux_svsm.a
@@ -46,7 +46,7 @@ svsm.bin.elf: $(OBJS) src/start/svsm.lds
$(GCC) $(LD_FLAGS) -o $@ $(OBJS)
%.a: src/*.rs src/cpu/*.rs src/mem/*.rs src/util/*.rs
- @xargo build --features $(FEATURES)
+ cargo build --features $(FEATURES) --target x86_64-unknown-none
%.o: %.S src/start/svsm.h
$(GCC) $(C_FLAGS) $(LDS_FLAGS) $(A_FLAGS) -c -o $@ $<
hmmm, cargo should have read its settings from .cargo/config.toml
, which states target = "svsm-target.json"
which is the equivalent of cargo build --target svsm-target.json
. Can you try that?
(but I'm not sure why it's not picking it up by itself for you)
Oh, right, that would be my fault then, I removed .cargo trying to clean my downloaded build environment. Doing a git reset put it back and now the patch works as expected. Sorry about the noise.
Blocked by
abi_x86_interrupt
(used by x86-64
crate) https://github.com/rust-lang/rust/issues/40180alloc_error_handler
https://github.com/rust-lang/rust/issues/51540core::intrinsics::size_of
- There is a stable version core::mem::size_of
I'm completely in favor of switching to standard Rust. Besides the reasons already mentioned, we are missing out on crates that don't offer an #![no_std]
alternative. Let's leave this issue open and keep an eye on the tracked issues mentioned by @arkivm.
abi_x86_interrupt
Tracking issuealloc_error_handler
Tracking issuecore::intrinsics::size_of
The SVSM cannot be packaged by any distribution until it can be built by a standard and released version of rust. How far away from this are we? The main reason I thought we needed nightlies was asm() which went into 1.59, and has been picked up by the distributions. Can we now try moving away from rust nightlies and see if it can be made to work?