From c3b3024b0fe00c0269256c5408abe08eb677f9db Mon Sep 17 00:00:00 2001 From: Nocturn9x Date: Thu, 17 Nov 2022 12:46:10 +0100 Subject: [PATCH] Project cleanup --- .gitignore | 2 ++ build.sh | 18 +++++++++++------- build/.gitkeep | 0 obj/.gitkeep | 0 run.sh | 2 +- 5 files changed, 14 insertions(+), 8 deletions(-) create mode 100644 build/.gitkeep create mode 100644 obj/.gitkeep diff --git a/.gitignore b/.gitignore index 2ba8428..3c8a180 100644 --- a/.gitignore +++ b/.gitignore @@ -68,5 +68,7 @@ _deps # TSOS stuff *.bin +*.img dist/ + diff --git a/build.sh b/build.sh index 2755a01..4cd64b8 100755 --- a/build.sh +++ b/build.sh @@ -1,8 +1,12 @@ #!/bin/bash -i386-elf-gcc -ffreestanding -I src/ -c src/kernel/main.c -o kernel.o -i386-elf-gcc -ffreestanding -I src/ -c src/kernel/drivers/vga/screen.c -o screen.o -i386-elf-gcc -ffreestanding -I src/ -c src/kernel/drivers/ports/ports.c -o ports.o -nasm -f elf src/entrypoint.s -o entry.o -nasm -f bin src/boot/mbr.s -o mbr.bin -i386-elf-ld -o kernel.bin -Ttext 0x1000 entry.o kernel.o ports.o screen.o --oformat binary -cat mbr.bin kernel.bin > os.bin +# 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 diff --git a/build/.gitkeep b/build/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/obj/.gitkeep b/obj/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/run.sh b/run.sh index eb7ca5f..b507bd6 100755 --- a/run.sh +++ b/run.sh @@ -1,2 +1,2 @@ #!/bin/bash -qemu-system-x86_64 -drive format=raw,file=os.bin,index=0,media=disk +qemu-system-x86_64 -drive format=raw,file=build/os.bin,index=0,media=disk