summaryrefslogtreecommitdiff
path: root/Makefile
blob: 872c4e38c48c10c6c74e9b664b739946cb368d30 (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

    #####################
    #			#
    # FoolOS Makefile	#
    #			#
    #####################


IMAGE_SIZE=1474560

all: FoolOS.img

FoolOS.img: mbr.bin kernel.bin fill.bin
	cat $^ | head -c $(IMAGE_SIZE) > $@

fill.bin: boot/fill.asm
	nasm -f bin $^ -o $@

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

console.o: kernel/console.c kernel/console.h
	gcc -ffreestanding -m32 -o $@ -c $< -fno-asynchronous-unwind-tables -O0

kernel.bin: kernel_entry.o kernel.o console.o
	ld -o $@ -Ttext 0x1000 --oformat binary -melf_i386 $^ -O0

dump:
	vboxmanage debugvm FoolOs dumpguestcore --filename dump.elf
	xxd dump.elf > dump.xxd

clean:
	-rm *.bin *.o *.img dump.elf dump.xxd

.PHONY: all clean