-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
65 lines (44 loc) · 1.9 KB
/
Makefile
File metadata and controls
65 lines (44 loc) · 1.9 KB
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
kernel_path = zig-out/bin/kernel.bin
qemu_args = -drive format=raw,file=os-image.bin -m 1G
bios = /Users/nwf/Desktop/oss/cpp/seabios/out/bios.bin
kernel_elf = zig-out/bin/zkernel
run: build
qemu-system-i386 $(qemu_args) -serial stdio
run_debug: build
qemu-system-i386 $(qemu_args) -serial stdio -chardev stdio,id=seabios,debug=2000 -device isa-debugcon,iobase=0x402,chardev=seabios
build_kernel:
zig build
build: build_kernel $(kernel_path)
cd bootloader && zig build -Dkernel_size=$(shell stat -f%"z" $(kernel_path))
cat bootloader/zig-out/bin/bootloader.bin $(kernel_path) > os-image.bin
clean:
rm -rf zig-out/ zig-cache/
rm os-image.bin
rm -rf bootloader/zig-out/ bootloader/zig-cache/
monitor: build
qemu-system-i386 $(qemu_args) -d int,guest_errors -no-reboot -no-shutdown -monitor stdio
debug: build
qemu-system-i386 $(qemu_args) -serial stdio -s -S
debug_bios: build
qemu-system-i386 $(qemu_args) -chardev stdio,id=seabios -device isa-debugcon,iobase=0x402,chardev=seabios -m 512 -bios $(bios)
dump:
x86_64-elf-objdump -D -mi386 zig-out/bin/zkernel | bat
sector_size:
@echo "kernel sector size:" $$((($(shell stat -f%"z" $(kernel_path)) / 512) + 1))
grub_build: build_kernel
-rm iso/os.iso
cp $(kernel_elf) iso/boot/kernel.elf
grub-mkrescue -o iso/os.iso iso/ 2> /dev/null
grub_run: grub_build
qemu-system-i386 -boot d -cdrom iso/os.iso -m 128M -serial stdio
grub_mon: grub_build
qemu-system-i386 -boot d -cdrom iso/os.iso -d int,guest_errors -no-reboot -no-shutdown -monitor stdio
grub_mond: grub_build
qemu-system-i386 -boot d -cdrom iso/os.iso -d int,guest_errors -no-reboot -no-shutdown -monitor stdio -s -S
grub_dbios:
qemu-system-i386 -boot d -cdrom iso/os.iso -chardev stdio,id=seabios -device isa-debugcon,iobase=0x402,chardev=seabios -m 512 -bios $(bios)
grub_clean:
rm iso/os.iso
rm iso/boot/kernel.elf
grub_debug:
qemu-system-i386 -boot d -cdrom iso/os.iso -serial stdio -s -S