-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrun_kvm.sh
More file actions
executable file
·28 lines (23 loc) · 836 Bytes
/
run_kvm.sh
File metadata and controls
executable file
·28 lines (23 loc) · 836 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#!/bin/sh
# Run rux kernel with KVM acceleration (requires Linux host with /dev/kvm).
# Uses -cpu host to expose real CPU features (FSGSBASE, SMAP, etc.)
# so the kernel can detect KVM and enable swapgs + gs:[offset].
set -e
[ -f "$HOME/.cargo/env" ] && . "$HOME/.cargo/env"
QEMU="${QEMU:-qemu-system-x86_64}"
TARGET="x86_64-unknown-none"
KERNEL="target/${TARGET}/debug/rux-kernel"
INITRD="initramfs/initramfs_x86_64.cpio"
[ -f "${INITRD}" ] || bash initramfs/build.sh
rustup run nightly cargo build -p rux-kernel --target ${TARGET}
rust-objcopy --output-target=elf32-i386 ${KERNEL} ${KERNEL}.elf32
exec ${QEMU} \
-enable-kvm -cpu host -smp 2 \
-kernel ${KERNEL}.elf32 \
-initrd ${INITRD} \
-serial mon:stdio \
-display none \
-device isa-debug-exit,iobase=0xf4,iosize=0x04 \
-no-reboot \
-monitor none \
-m 128M