-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
executable file
·183 lines (158 loc) · 3.85 KB
/
Makefile
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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
include Makefile.inc
.PHONY: clean nconfig menuconfig initrd buildimg run-arm run-x64-efi run-x64-bios
compiler:
@ cd ./compiler/
@ ./compile.sh x86_64-elf
@ cd ..
nconfig:
@ ./config/Configure ./config/config.in
@ cp config/autoconf.h $(KERNDIR)/src/include/autoconf.h
menuconfig:
@ ./config/Menuconfig ./config/config.in
@ cp config/autoconf.h $(KERNDIR)/src/include/autoconf.h
initrd:
@ cp module/*.kmd base/modules
@ cd base && tar -cvf ../initrd.tar * && cd ..
LOOPDEV=$(shell losetup -f)
buildimg: initrd
parted -s microk.img mklabel gpt
parted -s microk.img mkpart ESP fat32 2048s 100%
parted -s microk.img set 1 esp on
sudo losetup -Pf --show microk.img
sudo mkfs.fat -F 32 $(LOOPDEV)p1
mkdir -p img_mount
sudo mount $(LOOPDEV)p1 img_mount
sudo mkdir -p img_mount/EFI/BOOT
sudo cp -v $(KERNDIR)/microk.elf \
limine/limine-bios.sys \
limine.conf \
module/*.kmd \
initrd.tar \
img_mount/
sudo cp module/manager.kmd img_mount/manager.kmd
sudo cp -v limine/*.EFI img_mount/EFI/BOOT/
sync
sudo umount img_mount
sudo losetup -d $(LOOPDEV)
./limine/limine bios-install microk.img
rm -rf img_mount
GENERIC_OUTPUT_OPTS := -chardev stdio,id=char0,logfile=serial.log,signal=off \
-serial chardev:char0 \
-vga qxl \
-display gtk
GENERIC_CPU_OPTS := -smp sockets=2,cores=2,threads=2 \
-object memory-backend-ram,size=4G,id=m0 \
-object memory-backend-ram,size=4G,id=m1 \
-object memory-backend-ram,size=4G,id=m2 \
-object memory-backend-ram,size=4G,id=m3 \
-numa node,memdev=m0,cpus=0-1,nodeid=0 \
-numa node,memdev=m1,cpus=2-3,nodeid=1 \
-numa node,memdev=m2,cpus=4-5,nodeid=2 \
-numa node,memdev=m3,cpus=6-7,nodeid=3
GENERIC_DEV_OPTS := -device qemu-xhci \
-device usb-kbd \
-device virtio-gpu \
-net nic,model=virtio \
-device virtio-blk-pci,drive=drive0 \
-drive id=drive0,if=none,file="microk.img" \
-device ich9-intel-hda \
-device hda-micro \
-device usb-mouse
X86_OUTPUT_OPTS := $(GENERIC_OUTPUT_OPTS) \
-debugcon file:debug.log
run-aarch64:
qemu-system-aarch64 \
-bios EDK2Firmware/aarch64/QEMU_EFI.fd \
-m 16G \
$(GENERIC_OUTPUT_OPTS) \
-cpu cortex-a57 \
$(GENERIC_CPU_OPTS) \
-machine virt \
$(GENERIC_DEV_OPTS) \
&
sleep 1
telnet localhost 45454
run-aarch64-debug:
qemu-system-aarch64 \
-bios EDK2Firmware/aarch64/QEMU_EFI.fd \
-m 16G \
$(GENERIC_OUTPUT_OPTS) \
-cpu cortex-a57 \
$(GENERIC_CPU_OPTS) \
-machine virt \
$(GENERIC_DEV_OPTS) \
-S \
-s \
&
sleep 1
telnet localhost 45454
run-x64-bios:
qemu-system-x86_64 \
-M hpet=on \
-m 16G \
-accel kvm \
$(X86_OUTPUT_OPTS) \
-cpu host \
$(GENERIC_CPU_OPTS) \
-machine type=q35 \
$(GENERIC_DEV_OPTS) \
&
sleep 1
telnet localhost 45454
run-x64-efi:
qemu-system-x86_64 \
-bios ./EDK2Firmware/ovmf-x64/OVMF_CODE-pure-efi.fd \
-M hpet=on \
-m 16G \
-accel kvm \
$(X86_OUTPUT_OPTS) \
-cpu host \
$(GENERIC_CPU_OPTS) \
-machine type=q35 \
$(GENERIC_DEV_OPTS)
run-x64-efi-monitor:
qemu-system-x86_64 \
-bios ./EDK2Firmware/ovmf-x64/OVMF_CODE-pure-efi.fd \
-M hpet=on \
-m 16G \
-accel kvm \
$(X86_OUTPUT_OPTS) \
-cpu host \
$(GENERIC_CPU_OPTS) \
-machine type=q35 \
$(GENERIC_DEV_OPTS) \
-monitor telnet::45454,server,nowait \
&
sleep 1
telnet localhost 45454
run-x64-debug-bios:
qemu-system-x86_64 \
-M hpet=on \
-m 16G \
-accel tcg \
$(X86_OUTPUT_OPTS) \
$(GENERIC_CPU_OPTS) \
-machine type=q35 \
$(GENERIC_DEV_OPTS) \
-S \
-s \
&
sleep 1
telnet localhost 45454
run-x64-debug-efi:
qemu-system-x86_64 \
-bios ./EDK2Firmware/ovmf-x64/OVMF_CODE-pure-efi.fd \
-M hpet=on \
-m 16G \
-accel tcg \
$(X86_OUTPUT_OPTS) \
$(GENERIC_CPU_OPTS) \
-machine type=q35 \
$(GENERIC_DEV_OPTS) \
-s \
-S \
&
sleep 1
telnet localhost 45454
clean:
./clean.sh