mirror of
https://github.com/asterinas/asterinas.git
synced 2025-06-17 02:26:46 +00:00
Make kvm cli configurable
This commit is contained in:
parent
f674874e91
commit
34860a4fa0
@ -5,7 +5,7 @@ runner = "cargo run --package jinux-build --"
|
||||
[alias]
|
||||
kcheck = "check --target x86_64-custom.json -Zbuild-std=core,alloc,compiler_builtins -Zbuild-std-features=compiler-builtins-mem"
|
||||
kbuild = "build --target x86_64-custom.json -Zbuild-std=core,alloc,compiler_builtins -Zbuild-std-features=compiler-builtins-mem"
|
||||
krun = "run --target x86_64-custom.json -Zbuild-std=core,alloc,compiler_builtins -Zbuild-std-features=compiler-builtins-mem"
|
||||
krun = "run --target x86_64-custom.json -Zbuild-std=core,alloc,compiler_builtins -Zbuild-std-features=compiler-builtins-mem --"
|
||||
ksctest = "run --target x86_64-custom.json -Zbuild-std=core,alloc,compiler_builtins -Zbuild-std-features=compiler-builtins-mem -- --syscall-test"
|
||||
ktest = "test --target x86_64-custom.json -Zbuild-std=core,alloc,compiler_builtins -Zbuild-std-features=compiler-builtins-mem"
|
||||
component-check = "component check --target x86_64-custom.json -Zbuild-std=core,alloc,compiler_builtins -Zbuild-std-features=compiler-builtins-mem"
|
||||
|
13
Makefile
13
Makefile
@ -15,15 +15,24 @@ build:
|
||||
tools:
|
||||
@cd services/libs/comp-sys && cargo install --path cargo-component
|
||||
|
||||
# FIXME: Exit code manipulation is not needed using non-x86 QEMU
|
||||
run: build
|
||||
@cargo krun || exit $$(($$? >> 1)) # FIXME: Exit code manipulation is not needed using non-x86 QEMU
|
||||
ifneq ($(ENABLE_KVM), false)
|
||||
cargo krun --enable-kvm || exit $$(($$? >> 1))
|
||||
else
|
||||
cargo krun || exit $$(($$? >> 1))
|
||||
endif
|
||||
|
||||
syscall_bin:
|
||||
@make --no-print-directory -C regression/syscall_test
|
||||
|
||||
# Test Jinux in a QEMU guest VM and run a series of evaluations.
|
||||
syscall_test: syscall_bin build
|
||||
@cargo ksctest || exit $$(($$? >> 1)) # FIXME: Exit code manipulation is not needed using non-x86 QEMU
|
||||
ifneq ($(ENABLE_KVM), false)
|
||||
@cargo ksctest --enable-kvm || exit $$(($$? >> 1))
|
||||
else
|
||||
@cargo ksctest || exit $$(($$? >> 1))
|
||||
endif
|
||||
|
||||
# The usermode cargo test of Jinux frame and Jinux standard library.
|
||||
test: build
|
||||
|
@ -23,6 +23,10 @@ struct Args {
|
||||
#[arg(short, long, default_value_t = false)]
|
||||
syscall_test: bool,
|
||||
|
||||
/// Enable KVM when running QEMU.
|
||||
#[arg(short, long, default_value_t = false)]
|
||||
enable_kvm: bool,
|
||||
|
||||
/// Emulate Intel IOMMU by QEMU.
|
||||
#[arg(short, long, default_value_t = false)]
|
||||
iommu: bool,
|
||||
@ -36,7 +40,6 @@ const COMMON_ARGS: &[&str] = &[
|
||||
"Icelake-Server,+x2apic",
|
||||
"-m",
|
||||
"2G",
|
||||
"-enable-kvm",
|
||||
"-nographic", // TODO: figure out why grub can't shown up without it
|
||||
"-monitor",
|
||||
"vc",
|
||||
@ -80,6 +83,9 @@ fn main() {
|
||||
let mut qemu_cmd = Command::new("qemu-system-x86_64");
|
||||
|
||||
let mut qemu_args = COMMON_ARGS.clone().to_vec();
|
||||
if args.enable_kvm {
|
||||
qemu_args.push("-enable-kvm");
|
||||
}
|
||||
if args.iommu {
|
||||
qemu_args.extend(IOMMU_DEVICE_ARGS.clone().to_vec().iter());
|
||||
} else {
|
||||
|
Loading…
x
Reference in New Issue
Block a user