-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathrun.sh
executable file
·73 lines (57 loc) · 1.42 KB
/
run.sh
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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
#!/bin/bash
set -euxo pipefail
CUR=`dirname $(realpath $0)`
if [[ ${1---x86} == "--arm" ]]; then
QEMU_BIN=qemu-system-aarch64
IMG=~/rust-for-linux/arch/arm64/boot/Image.gz
CPIO=$CUR/arm.cpio
./arm-mkfs.sh
# to debug aarch64 kernel, please use gdb-multiarch
# and add -s -S arguments to qemu
$QEMU_BIN \
-M virt,mte=on \
-cpu max \
-smp 1 \
-kernel $IMG \
-initrd $CPIO \
-append "quiet" \
-nographic -no-reboot
elif [[ ${1---x86} == "--pku" ]];then
QEMU_BIN=qemu-system-x86_64
IMG=~/rust-for-linux/arch/x86/boot/bzImage
CPIO=$CUR/initrd.cpio
./mkfs.sh
$QEMU_BIN \
-cpu qemu64,+pku,+xsave \
-m 1G \
-kernel $IMG \
-initrd $CPIO \
-append "console=ttyS0 quiet" \
-nographic -monitor /dev/null -no-reboot
elif [[ ${1--x86} == "--ori" ]]; then
QEMU_BIN=qemu-system-x86_64
IMG=~/rust-for-linux-ori/arch/x86/boot/bzImage
CPIO=$CUR/initrd.cpio
./mkfs-ori.sh
# kvm module requires root privilege
sudo $QEMU_BIN \
-cpu kvm64,vmx=on,-rdtscp \
-m 1G \
-kernel $IMG \
-initrd $CPIO \
-append "console=ttyS0 quiet" \
-nographic -monitor /dev/null -no-reboot -enable-kvm
else
QEMU_BIN=qemu-system-x86_64
IMG=~/rust-for-linux/arch/x86/boot/bzImage
CPIO=$CUR/initrd.cpio
./mkfs.sh
# kvm module requires root privilege
sudo $QEMU_BIN \
-cpu host \
-m 1G \
-kernel $IMG \
-initrd $CPIO \
-append "console=ttyS0 quiet" \
-nographic -monitor /dev/null -no-reboot -enable-kvm
fi