diff options
| -rw-r--r-- | Makefile | 68 |
1 files changed, 46 insertions, 22 deletions
@@ -1,10 +1,13 @@ ##################### # # - # FoolOS Makefile # + # FoolOS Build Sys. # # # ##################### + +.PHONY: all clean run + #improve implicit rules #lets use the size of a 1.44 floppy for a start for our boot img IMAGE_SIZE=1474560 @@ -15,36 +18,62 @@ FONT_DATA_START=25600 #data starts at 0x8000 #DATA_START=32768 +CFLAGS=-ffreestanding -std=gnu99 -m32 -fno-asynchronous-unwind-tables -O0 + +############ source and object files ############ + +#kernel sources (asm and c) + SOURCES=$(wildcard ./kernel/*.c) SOURCES+=$(wildcard ./lib/*/*.c) ASMSOURCES=$(wildcard ./asm/*.asm) +#kernel object files OBJECTS=$(patsubst %.c, %.o, $(SOURCES)) ASMOBJECTS=$(patsubst %.asm, %.o, $(ASMSOURCES)) +KERNEL_ENTRY=./boot/kernel_entry.o + +#master boot record asm MBR=./boot/mbr.bin -KERNEL_ENTRY=./boot/kernel_entry.o + +#some fillup data (zeros) + FILLUP=./data/fill.bin -CFLAGS=-ffreestanding -std=gnu99 -m32 -fno-asynchronous-unwind-tables -O0 -#default target -#final image +############ final image (default target) ############ + all: FoolOS.img -# some implicit rule patterns for aseembling (elf and binary) + +############ nasm assembling rules ############ + %.o: %.asm nasm -f elf $^ -o $@ %.bin: %.asm nasm -f bin $^ -o $@ -# explicit rule to create fool-font data binary + +############ linking kernel binary ############ + +# the kernel_entry.o needs to be FIRST!! +kernel.bin: $(KERNEL_ENTRY) $(ASMOBJECTS) $(OBJECTS) + ld -o $@ -Ttext 0x1000 --oformat binary -melf_i386 $^ -O0 + + +############ fool-font ############ + binfont.bin: data/binfont.src python tools/binarize.py $< $@ -#assembling of final image + +############ assembling of final image ############ + +# master boot record, kernel binary and fool-font + FoolOS.img: Fool.img FoolData.img $(FILLUP) cat $^ | head -c $(IMAGE_SIZE) > $@ @@ -54,24 +83,19 @@ Fool.img: $(MBR) kernel.bin $(FILLUP) FoolData.img: binfont.bin cat $^ > $@ -# kernel_entry.o needs to be FIRST!! -kernel.bin: $(KERNEL_ENTRY) $(ASMOBJECTS) $(OBJECTS) - ld -o $@ -Ttext 0x1000 --oformat binary -melf_i386 $^ -O0 -##### cleanup ##### +############ vm stuff ############ + +# run in our local bochs (we need cirrus support for our vesa mode) + +run: FoolOS.img + ~/opt/bochs-2.6.6/bochs -q + + +############ cleanup ############ clean: -rm *.bin *.img bochs.log $(KERNEL_ENTRY) $(ASMOBJECTS) $(OBJECTS) $(FILLUP) $(MBR) -###### virtual machine stuff ###### - -# dump from vbox -#dump: FoolOS.img -# vboxmanage debugvm FoolOs dumpguestcore --filename dump.elf -# xxd dump.elf > dump.xxd -# run in our local bochs -run: FoolOS.img - ~/opt/bochs-2.6.6/bochs -q -.PHONY: all clean |
