forked from tuhdo/sample-os
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
executable file
·38 lines (31 loc) · 859 Bytes
/
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
BUILD_DIR=build
BOOTLOADER=$(BUILD_DIR)/boot/bootloader
KERNEL=$(BUILD_DIR)/kern/kernel
DISK_IMG=disk.img
QEMU_DEBUG=-d int,mmu,pcall,guest_errors,cpu_reset
QEMU_STDIO= -monitor stdio
all: build_dir disk
build_dir:
[ -d build/ ] || mkdir build
[ -d build/kern ] || mkdir build/kern
[ -d build/boot ] || mkdir build/boot
.PHONY:
$(BOOTLOADER):
make -C bootloader
.PHONY:
$(KERNEL):
make -C kernel
.PHONY:
disk: $(BOOTLOADER) $(KERNEL)
make -C bootloader
make -C kernel
dd if=/dev/zero of=$(DISK_IMG) bs=512 count=2880
dd if=$(BOOTLOADER) of=$(DISK_IMG) bs=512 count=1 seek=0
dd if=$(KERNEL) of=$(DISK_IMG) bs=512 count=30 seek=1
qemu-gdb:
qemu-system-i386 $(QEMU_DEBUG) $(QEMU_STDIO) -machine q35 -fda $(DISK_IMG) -gdb tcp::26000 -D qemu.log -S
.PHONY:
clean:
killall qemu-system-i386 || true
killall gdb || true
rm -rf build $(DISK_IMG)