forked from differrari/RedactedOS
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrun_virt
More file actions
executable file
·46 lines (38 loc) · 1012 Bytes
/
run_virt
File metadata and controls
executable file
·46 lines (38 loc) · 1012 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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#/!bin/sh
echo "Running virt emulator"
ARGS=""
if [ "$1" = "debug" ]; then
ARGS="-monitor unix:/tmp/qemu-monitor-socket,server,nowait -s -S"
fi
MSI_CAPABILITIES=""
XHCI_CAPABILITIES="$(qemu-system-aarch64 -device qemu-xhci,help)"
if echo "$XHCI_CAPABILITIES" | grep -q "msi "; then
MSI_CAPABILITIES="msi=on,msix=off,"
fi
OS_TYPE="$(uname)"
if [[ "$OS_TYPE" == "Darwin" ]]; then
NETARG="vmnet-bridged,id=net0,ifname=en0"
PRIVILEGE="sudo"
elif [[ "$OS_TYPE" == "Linux" ]]; then
NETARG="user,id=net0"
PRIVILEGE=""
else
echo "Unknown OS: $OS_TYPE" >&2
exit 1
fi
$PRIVILEGE qemu-system-aarch64 \
-M virt \
-cpu cortex-a72 \
-m 512M \
-kernel kernel.elf \
-device virtio-gpu-pci \
-display sdl \
-netdev $NETARG \
-device virtio-net-pci,netdev=net0 \
-serial mon:stdio \
-drive file=disk.img,if=none,format=raw,id=hd0 \
-device virtio-blk-pci,drive=hd0 \
-device qemu-xhci,${MSI_CAPABILITIES}id=usb \
-device usb-kbd,bus=usb.0 \
-d guest_errors \
$ARGS