Organizing the kernel code.

This commit is contained in:
nortega committed 2018-02-23 18:50:05 +01:00
1 parent 7a2618dd4d
commit 78c1155430
9 files changed
+11 -16

No files matched your search

+11 -16
View File
@@ -1,38 +1,33 @@
ASM=nasm
AFLAGS=-f bin
BIN=bin
CFLAGS=-ffreestanding -fno-pie -m32
CC=gcc
LD=ld
LDFLAGS=-melf_i386 -Ttext 0x1000 --oformat binary
OBJ=kernel/kernel_entry.o kernel/kernel.o
all: os-image
os-image: boot_sect.bin kernel.bin
os-image: boot/boot_sect.bin kernel.bin
mkdir -p $(BIN)
cat $^ > $(BIN)/$@
# build kernel binary file
kernel.bin: kernel_entry.o kernel.o
kernel.bin: $(OBJ)
$(LD) $(LDFLAGS) $^ -o $@
# build kernel object file
kernel.o: kernel.c
%.o: %.c ${HEADERS}
$(CC) $(CFLAGS) -c $< -o $@
# build kernel entry object file
kernel_entry.o: kernel_entry.asm
$(ASM) -f elf $< -o $@
boot_sect.bin: boot_sect.asm
$(ASM) $< $(AFLAGS) -o $@
basicos: boot_sect.bin kernel.bin
mkdir -p $(BIN)
cat boot_sect.bin kernel.bin > $(BIN)/os-image
%.o: %.asm
$(ASM) $< -f elf -o $@
%.bin: %.asm
$(ASM) $< -f bin -I 'boot/' -o $@
.PHONY: clean
clean:
rm -f *.bin *.o
rm -rf boot/*.bin boot/*.o
rm -rf kernel/*.o boot/*.o drivers/*.o
File renamed without changes.
View File
File renamed without changes.
View File
File renamed without changes.
View File
File renamed without changes.
View File
File renamed without changes.
File renamed without changes.
View File
File renamed without changes.
File renamed without changes.