-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile.toml
140 lines (123 loc) · 2.74 KB
/
Makefile.toml
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
[config]
default_to_workspace = false
skip_core_tasks = true
[env]
# OVMF_PATH = "/usr/share/ovmf/OVMF.fd"
[tasks.build]
dependencies = [
# {name = "build", path = "lib"},
{ name = "build", path = "sikikernel" },
{ name = "build", path = "sikiloader" },
]
run_task = "disk"
[tasks.check]
dependencies = [
# {name = "check", path = "lib"},
{ name = "check", path = "sikikernel" },
{ name = "check", path = "sikiloader" },
]
run_task = "disk"
[tasks.run]
dependencies = ["build"]
run_task = "qemu"
[tasks.clean]
dependencies = [
{ name = "clean", path = "lib" },
{ name = "clean", path = "sikikernel" },
{ name = "clean", path = "sikiloader" },
]
[tasks.disk]
run_task = { name = [
"disk-rm",
"disk-create",
"disk-mount",
"disk-copy",
"disk-umount",
], fork = true }
[tasks.disk-rm]
ignore_errors = true
script = '''
echo disk-rm
rm disk.img
'''
[tasks.disk-create]
script = '''
echo disk-create
qemu-img create -f raw disk.img 200M
mkfs.fat -n "SIKIKERNEL" -s 2 -f 2 -F 32 -R 32 disk.img
'''
[tasks.disk-mount.linux]
script = '''
echo disk-mount.linux
mkdir -p ./mnt
sudo mount -o loop disk.img ./mnt
'''
[tasks.disk-mount.mac]
script = '''
#!/usr/bin/env bash
echo disk-mount.mac
mkdir -p ./mnt
disk=$(hdiutil attach -nomount disk.img)
mount_msdos $disk ./mnt
'''
[tasks.disk-copy.linux]
script = '''
sudo mkdir -p ./mnt/EFI/BOOT
sudo cp ./target/x86_64-unknown-uefi/debug/sikiloader.efi ./mnt/EFI/BOOT/BOOTX64.EFI
sudo cp ./kernel.elf ./mnt/kernel.elf
'''
[tasks.disk-copy.mac]
script = '''
mkdir -p ./mnt/EFI/BOOT
cp ./target/x86_64-unknown-uefi/debug/sikiloader.efi ./mnt/EFI/BOOT/BOOTX64.EFI
cp ./kernel.elf ./mnt/kernel.elf
'''
[tasks.disk-umount.linux]
ignore_errors = true
script = '''
sudo umount ./mnt
sudo rm -r ./mnt
'''
[tasks.disk-umount.mac]
ignore_errors = true
script = '''
umount ./mnt
rm -r ./mnt
hdiutil detach /dev/disk4
'''
[tasks.qemu]
dependencies = ["disk"]
script = '''
qemu-system-x86_64 \
-m 1G \
-bios ${OVMF_PATH} \
-drive format=raw,media=disk,index=0,file=disk.img \
-device nec-usb-xhci,id=xhci \
-device usb-mouse -device usb-kbd \
-device isa-debug-exit \
-serial stdio \
'''
[tasks.qemu.mac]
dependencies = ["disk"]
script = '''
qemu-system-x86_64 \
-m 1G \
-bios ${OVMF_PATH} \
-drive format=raw,media=disk,index=0,file=disk.img \
-device nec-usb-xhci,id=xhci \
-device usb-mouse -device usb-kbd \
-device isa-debug-exit \
-serial stdio \
'''
# [tasks.qemu.mac]
# dependencies = ["disk"]
# script = '''
# qemu-system-x86_64 \
# -m 1G \
# -bios ${OVMF_PATH}/OVMF.fd \
# -drive format=raw,media=disk,index=0,file=disk.img \
# -device nec-usb-xhci,id=xhci \
# -device usb-mouse -device usb-kbd \
# -device isa-debug-exit \
# -monitor stdio \
# '''