-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrun_qemu.sh
executable file
·79 lines (59 loc) · 1.9 KB
/
run_qemu.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
74
75
76
77
78
79
#!/usr/bin/env bash
# This script starts the Hedron Microhypervisor via Multiboot1 in QEMU
# and gives the binary of the roottask as first multiboot1 boot module
# along. Hedron will take the first boot module, extract it as ELF file
# and start it.
set -e
source .config.sh
#########################################################################
# nice "hack" which make the script work, even if not executed from "./"
DIR=$(dirname "$(realpath "$0")")
cd "$DIR" || exit
#########################################################################
# QEMU is very slow with loading multiboot files with version <6.1 or so
# therefore I strip the binary
# strip "$ROOTTASK"
# main allows us to move all function definitions to the end of the file
main() {
QEMU_ARGS=(
# Disable default devices
# QEMU by default enables a ton of devices which slow down boot.
"-nodefaults"
# Use a standard VGA for graphics
"-vga"
"std"
# Use a modern machine, with acceleration if possible.
"-machine"
"q35,accel=kvm:tcg"
# Allocate some memory
"-m"
"2048M"
# two cores
"-smp"
"2"
"-cpu"
"IvyBridge"
# Multiboot1 kernel
"-kernel"
"${HEDRON}"
# QEMU passes this as Multiboot1 Modules to Hedron. Multiple modules are separated
# by a comma. The text after the path is the "cmdline" string of the boot module.
"-initrd"
"${ROOTTASK} roottask"
# Enable serial
#
# Connect the serial port to the host.
"-serial"
"stdio"
# Enable the debugcon device on port 0xe9.
"-debugcon"
"file:debugcon.txt"
# Setup monitor
"-monitor"
"vc:1024x768"
)
echo "Executing: qemu-system-x86_64 " "${QEMU_ARGS[@]}"
qemu-system-x86_64 "${QEMU_ARGS[@]}"
}
# call main
main