2018-02-23 16:20:31 +00:00
|
|
|
ASM=nasm
|
|
|
|
AFLAGS=-f bin
|
|
|
|
BIN=bin
|
|
|
|
CFLAGS=-ffreestanding -fno-pie -m32
|
|
|
|
CC=gcc
|
|
|
|
LD=ld
|
|
|
|
LDFLAGS=-melf_i386 -Ttext 0x1000 --oformat binary
|
|
|
|
|
|
|
|
basicos:
|
|
|
|
mkdir -p $(BIN)
|
|
|
|
$(ASM) boot_sect.asm $(AFLAGS) -o boot_sect.bin
|
2018-02-23 16:56:05 +00:00
|
|
|
$(ASM) kernel_entry.asm -f elf -o kernel_entry.o
|
2018-02-23 16:20:31 +00:00
|
|
|
$(CC) $(CFLAGS) -c kernel.c -o kernel.o
|
2018-02-23 16:56:05 +00:00
|
|
|
$(LD) $(LDFLAGS) -o kernel.bin kernel_entry.o kernel.o
|
2018-02-23 16:20:31 +00:00
|
|
|
cat boot_sect.bin kernel.bin > $(BIN)/os-image
|
|
|
|
|
|
|
|
|
|
|
|
.PHONY: clean
|
|
|
|
|
|
|
|
clean:
|
2018-02-23 16:56:05 +00:00
|
|
|
rm -f *.bin *.o
|