-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmakefile
More file actions
60 lines (50 loc) · 1.39 KB
/
makefile
File metadata and controls
60 lines (50 loc) · 1.39 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
GDBFLAGS += -ex "set auto-load safe-path ."
GDBFLAGS += -ex "set confirm off"
GDBFLAGS += -ex "set listsize 30"
GDBFLAGS += -ex "set print pretty on"
GDBFLAGS += -ex "set print array on"
GDBFLAGS += -ex "set disassembly-flavor intel"
GDBFLAGS += -ex "target extended-remote localhost:9001"
GDBFLAGS += -ex "add-symbol-file boot/stage1/stage1.elf 0x7C00"
GDBFLAGS += -ex "add-symbol-file boot/stage2/stage2.elf 0x8000"
GDBFLAGS += -ex "add-symbol-file kernel/kernel.elf 0x100000"
GDBFLAGS += -ex "break *0x7C00"
GDBFLAGS += -ex "break *0x8000"
GDBFLAGS += -ex "break *0x100000"
GDBFLAGS += -ex "continue"
all: stage1 stage2 kernel disk
stage1:
cd boot/stage1 && make
stage2:
cd boot/stage2 && make
kernel:
cd kernel && make
disk:
dd if=/dev/zero of=disk.img bs=512 count=4096
dd if=boot/stage1/stage1.bin of=disk.img conv=notrunc seek=0
dd if=boot/stage2/stage2.bin of=disk.img conv=notrunc seek=1
dd if=kernel/kernel.bin of=disk.img conv=notrunc seek=129
sys:
qemu-system-x86_64 \
-drive format=raw,file=disk.img \
-m 1G \
-d int \
-no-reboot \
-no-shutdown &
dsys:
qemu-system-x86_64 \
-drive format=raw,file=disk.img \
-m 1G \
-d int \
-no-reboot \
-no-shutdown \
-gdb tcp:0.0.0.0:9001 \
-S &
dbg:
gdb -q $(GDBFLAGS)
clean:
cd boot/stage1 && make clean
cd boot/stage2 && make clean
cd kernel && make clean
rm -f *.img
.PHONY: stage1 stage2 kernel disk sys dsys dbg clean