A poorly written OS for the x86 arch. (WIP)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
eOS/Makefile

39 lines
831 B

C_SOURCES = $(wildcard kernel/*.c drivers/*.c lib/*.c)
HEADERS = $(wildcard kernel/*.h drivers/*.h lib/*.h)
3 years ago
OBJ = $(C_SOURCES:.c=.o)
3 years ago
all: os-image
run: all
3 years ago
qemu-system-x86_64 os-image
3 years ago
drun: clean run
grub: eOS.iso
qemu-system-x86_64 eOS.iso
eOS.iso : kernel.bin grub/grub.cfg
mkdir -p boot/grub
cp $< boot/eOS.bin
cp grub/grub.cfg boot/grub/grub.cfg
grub-mkrescue -o eOS.iso ./
3 years ago
os-image: bootloader/bootloader.bin kernel.bin
3 years ago
cat $^ > os-image
3 years ago
3 years ago
kernel.bin: kernel/kernel_entry.o $(OBJ)
3 years ago
gcc -o $@ $^ -Wl,--oformat=binary -ffreestanding -nostdlib -shared -Ttext 0x1000 -m32
3 years ago
%.o : %.c ${HEADERS}
3 years ago
gcc -fno-pie -m32 -Os -ffreestanding -c $< -o $@
3 years ago
3 years ago
%.o : %.asm
3 years ago
nasm $< -f elf -o $@
3 years ago
%.bin : %.asm
3 years ago
nasm $< -f bin -o $@
3 years ago
clean:
rm -fr *.bin *.dis *.o os-image *.map boot/ *.iso
3 years ago
rm -fr kernel/*.o boot/*.bin drivers/*.o