TSOS/build.sh

13 lines
632 B
Bash
Executable File

#!/bin/bash
# Compile the kernel and its drivers
i386-elf-gcc -ffreestanding -I src/ -c src/kernel/main.c -o obj/kernel.o
i386-elf-gcc -ffreestanding -I src/ -c src/kernel/drivers/vga/screen.c -o obj/screen.o
i386-elf-gcc -ffreestanding -I src/ -c src/kernel/drivers/ports/ports.c -o obj/ports.o
# Compile the assembly entry point and the MBR
nasm -f elf src/entrypoint.s -o obj/entry.o
nasm -f bin src/boot/mbr.s -o build/mbr.bin
# Link everything together
i386-elf-ld -o build/kernel.bin -Ttext 0x1000 entry.o kernel.o ports.o screen.o --oformat binary
# Produce a bootable image
cat build/mbr.bin build/kernel.bin > build/os.img