blob: 61d25ec4200bf10fc8b20a6cf273cb4d74e987c1 (
plain)
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
|
#####################
# #
# FoolOS Makefile #
# #
#####################
#TODO: use implicit rules !!
#lets use the size of a 1.44 floppy for a start for our boot img
IMAGE_SIZE=1474560
#font data starts at 0x8000
FONT_DATA_START=25600
#data starts at 0x8000
DATA_START=32768
#final image
all: FoolOS.img
#assembling of final image
FoolOS.img: Fool.img FoolData.img fill.bin
cat $^ | head -c $(IMAGE_SIZE) > $@
Fool.img: mbr.bin kernel.bin fill.bin
cat $^ | head -c $(FONT_DATA_START) > $@
FoolData.img: binfont.bin
cat $^ > $@
binfont.bin: binfont.src
python makefont.py
#some data just to fill up to the target image_size
fill.bin: boot/fill.asm
nasm -f bin $^ -o $@
#this is the MASTER BOOT RECORD, where our bootloader lives
mbr.bin: boot/mbr.asm
nasm -f bin $^ -o $@
kernel_entry.o: boot/kernel_entry.asm
nasm -f elf $^ -o $@
kernel.o: kernel/kernel.c kernel/console.h
gcc -ffreestanding -m32 -o $@ -c $< -fno-asynchronous-unwind-tables -O0
x86.o: kernel/x86.c
gcc -ffreestanding -m32 -o $@ -c $< -fno-asynchronous-unwind-tables -O0
floppy.o: kernel/floppy.c
gcc -ffreestanding -m32 -o $@ -c $< -fno-asynchronous-unwind-tables -O0
vmem.o: kernel/vmem.c
gcc -ffreestanding -m32 -o $@ -c $< -fno-asynchronous-unwind-tables -O0
mem.o: kernel/mem.c
gcc -ffreestanding -m32 -o $@ -c $< -fno-asynchronous-unwind-tables -O0
e1000.o: kernel/e1000.c
gcc -ffreestanding -m32 -o $@ -c $< -fno-asynchronous-unwind-tables -O0
pci.o: kernel/pci.c
gcc -ffreestanding -m32 -o $@ -c $< -fno-asynchronous-unwind-tables -O0
console.o: kernel/console.c kernel/console.h
gcc -ffreestanding -m32 -o $@ -c $< -fno-asynchronous-unwind-tables -O0
interrupts.o: kernel/interrupts.c kernel/interrupts.h
gcc -ffreestanding -m32 -o $@ -c $< -fno-asynchronous-unwind-tables -O0
keyboard.o: kernel/keyboard.c
gcc -ffreestanding -m32 -o $@ -c $< -fno-asynchronous-unwind-tables -O0
vesa.o: kernel/vesa.c
gcc -ffreestanding -std=gnu99 -m32 -o $@ -c $< -fno-asynchronous-unwind-tables -O0
timer.o: kernel/timer.c
gcc -ffreestanding -m32 -o $@ -c $< -fno-asynchronous-unwind-tables -O0
shell.o: kernel/shell.c
gcc -ffreestanding -m32 -o $@ -c $< -fno-asynchronous-unwind-tables -O0
log.o: lib/logger/log.c
gcc -ffreestanding -m32 -o $@ -c $< -fno-asynchronous-unwind-tables -O0
printf.o: lib/printf/printf.c
gcc -ffreestanding -m32 -o $@ -c $< -fno-asynchronous-unwind-tables -O0
kernel.bin: kernel_entry.o kernel.o console.o interrupts.o keyboard.o timer.o floppy.o x86.o shell.o mem.o vmem.o pci.o e1000.o vesa.o log.o printf.o
ld -o $@ -Ttext 0x1000 --oformat binary -melf_i386 $^ -O0
#16bit bootloader!
FoolBoot.img: mbr16.bin boot.bin fill.bin
cat $^ | head -c $(IMAGE_SIZE) > $@
boot.bin: boot16_entry.o boot16.o
ld -o $@ -Ttext 0x1000 --oformat binary -melf_i386 $^ -O0
mbr16.bin: boot/mbr16.asm
nasm -f bin $^ -o $@
boot16_entry.o: boot/boot16_entry.asm
nasm -f elf $^ -o $@
boot16.o: bootloader/boot16.c
gcc -ffreestanding -m32 -o $@ -c $< -fno-asynchronous-unwind-tables -O0
# dump from vbox
dump: FoolOS.img
vboxmanage debugvm FoolOs dumpguestcore --filename dump.elf
xxd dump.elf > dump.xxd
run: FoolOS.img
~/temp/bochs-2.6.6/bochs -q
clean:
-rm *.bin *.o *.img dump.elf dump.xxd bochs.log
.PHONY: all clean
|