-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathqemu.mk
67 lines (58 loc) · 1.75 KB
/
qemu.mk
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
MEMORY ?= 1g
CPUS ?= 4
QEMU_FLAGS ?=
ifeq (${KVM},true)
QEMU_FLAGS += -enable-kvm
endif
ifeq (${GDB},true)
QEMU_FLAGS += -s -S
endif
QEMU_FLAGS += -machine q35
QEMU_FLAGS += -cpu qemu64,+rdrand,+rdseed,+rdtscp,+rdpid
QEMU_FLAGS += -smp ${CPUS}
QEMU_FLAGS += -m ${MEMORY}
ifeq (${KVM},true)
QEMU_FLAGS += -M smm=off,accel=kvm
else
QEMU_FLAGS += -M smm=off
endif
ifeq (${DEBUG},1)
QEMU_FLAGS += -d guest_errors
else ifeq (${DEBUG},2)
QEMU_FLAGS += -d int,guest_errors
else ifeq (${DEBUG},3)
QEMU_FLAGS += -d int,guest_errors,cpu_reset
endif
QEMU_FLAGS += -no-reboot
# QEMU_FLAGS += -no-shutdown
QEMU_FLAGS += -serial stdio
QEMU_FLAGS += -rtc base=localtime
QEMU_OVMF ?= /usr/share/ovmf/x64/OVMF.fd
ifeq (${UEFI},true)
QEMU_FLAGS += -bios ${QEMU_OVMF}
endif
QEMU_RUN_FLAGS ?=
QEMU_RUN_FLAGS += ${QEMU_FLAGS}
# QEMU_FLAGS += -vga virtio
QEMU_RUN_FLAGS += -vga std
QEMU_RUN_FLAGS += -display gtk,show-cursor=off
QEMU_RUN_FLAGS += -usb
QEMU_RUN_FLAGS += -device virtio-sound
QEMU_RUN_FLAGS += -device usb-tablet
QEMU_TEST_FLAGS ?=
QEMU_TEST_FLAGS += ${QEMU_FLAGS}
QEMU_TEST_FLAGS += -device isa-debug-exit,iobase=0xf4,iosize=0x04
QEMU_TEST_FLAGS += -display none
QEMU_KERNEL := -kernel ${KERNEL} -append qemu
QEMU_DRIVE := -drive format=raw,file
# TODO: multiboot1 direct kernel boot
# qemu normal run
run: ${HYPERION}
@echo -e "\n\033[32m--[[ running Hyperion in QEMU ]]--\033[0m"
${QEMU} ${QEMU_RUN_FLAGS} ${QEMU_DRIVE}=${HYPERION}
# run tests in qemu
test: ${HYPERION_TESTING}
@echo -e "\n\033[32m--[[ running Hyperion-Testing in QEMU ]]--\033[0m"
${QEMU} ${QEMU_TEST_FLAGS} ${QEMU_DRIVE}=${HYPERION_TESTING};\
[ $$? -ne 33 ] && exit 1;\
exit 0