diff --git a/Makefile b/Makefile index 0eea523..d7e1e3f 100644 --- a/Makefile +++ b/Makefile @@ -1,3 +1,5 @@ +C_SOURCES = $(wildcard kernel/*.c drivers/*.c) + all: os-image run: all @@ -8,10 +10,10 @@ drun: clean run grub: eOS.iso qemu-system-x86_64 eOS.iso -eOS.iso : kernel.bin src/grub/grub.cfg +eOS.iso : kernel.bin grub/grub.cfg mkdir -p boot/grub cp $< boot/eOS.bin - cp src/grub/grub.cfg boot/grub/grub.cfg + cp grub/grub.cfg boot/grub/grub.cfg grub-mkrescue -o eOS.iso ./ os-image: bootloader.bin kernel.bin @@ -20,13 +22,13 @@ os-image: bootloader.bin kernel.bin kernel.bin: kernel_entry.o kernel.o gcc -o kernel.bin $^ -Wl,--oformat=binary -ffreestanding -nostdlib -shared -Ttext 0x1000 -m32 -kernel.o : src/kernel/kernel.c +kernel.o : kernel/kernel.c gcc -fno-pie -m32 -Os -ffreestanding -c $< -o $@ -kernel_entry.o : src/kernel/kernel_entry.asm +kernel_entry.o : kernel/kernel_entry.asm nasm $< -f elf -o $@ -bootloader.bin : src/bootloader/bootloader.asm +bootloader.bin : bootloader/bootloader.asm nasm $< -f bin -o $@ clean: diff --git a/TODO.md b/TODO.md index 692c607..8520c94 100644 --- a/TODO.md +++ b/TODO.md @@ -1,5 +1,6 @@ # TO DO - Refactor Makefile + - Refactor file structure - Finish the book! - Multiboot support (for grub etc) - VGA Library (Graphics) diff --git a/bootloader/bios.asm b/bootloader/bios.asm new file mode 100644 index 0000000..339a9dc --- /dev/null +++ b/bootloader/bios.asm @@ -0,0 +1,7 @@ +; EQUs +%include "bootloader/equ/bios.asm" + +; SRs +%include "bootloader/bios/convert.asm" +%include "bootloader/bios/print.asm" +%include "bootloader/bios/disk.asm" diff --git a/src/bootloader/bios/convert.asm b/bootloader/bios/convert.asm similarity index 100% rename from src/bootloader/bios/convert.asm rename to bootloader/bios/convert.asm diff --git a/src/bootloader/bios/disk.asm b/bootloader/bios/disk.asm similarity index 100% rename from src/bootloader/bios/disk.asm rename to bootloader/bios/disk.asm diff --git a/src/bootloader/bios/print.asm b/bootloader/bios/print.asm similarity index 100% rename from src/bootloader/bios/print.asm rename to bootloader/bios/print.asm diff --git a/src/bootloader/bootloader.asm b/bootloader/bootloader.asm similarity index 89% rename from src/bootloader/bootloader.asm rename to bootloader/bootloader.asm index 64553e6..a5578fe 100644 --- a/src/bootloader/bootloader.asm +++ b/bootloader/bootloader.asm @@ -20,9 +20,9 @@ jmp $ ; inf loop -%include "src/bootloader/equ/ascii.asm" -%include "src/bootloader/bios.asm" -%include "src/bootloader/pm.asm" +%include "bootloader/equ/ascii.asm" +%include "bootloader/bios.asm" +%include "bootloader/pm.asm" BEGIN_PM: ; Inform of mode switch diff --git a/src/bootloader/equ/ascii.asm b/bootloader/equ/ascii.asm similarity index 100% rename from src/bootloader/equ/ascii.asm rename to bootloader/equ/ascii.asm diff --git a/src/bootloader/equ/bios.asm b/bootloader/equ/bios.asm similarity index 100% rename from src/bootloader/equ/bios.asm rename to bootloader/equ/bios.asm diff --git a/src/bootloader/equ/vga.asm b/bootloader/equ/vga.asm similarity index 100% rename from src/bootloader/equ/vga.asm rename to bootloader/equ/vga.asm diff --git a/src/bootloader/pm.asm b/bootloader/pm.asm similarity index 81% rename from src/bootloader/pm.asm rename to bootloader/pm.asm index 3d4cef6..1965d11 100644 --- a/src/bootloader/pm.asm +++ b/bootloader/pm.asm @@ -1,9 +1,9 @@ ; Utils -%include "src/bootloader/equ/vga.asm" -%include "src/bootloader/pm/vga/print.asm" +%include "bootloader/equ/vga.asm" +%include "bootloader/pm/vga/print.asm" ; GDT & switching to PM -%include "src/bootloader/pm/gdt.asm" ; GDT defined here +%include "bootloader/pm/gdt.asm" ; GDT defined here ; Switching to PM [bits 16] diff --git a/src/bootloader/pm/gdt.asm b/bootloader/pm/gdt.asm similarity index 100% rename from src/bootloader/pm/gdt.asm rename to bootloader/pm/gdt.asm diff --git a/src/bootloader/pm/vga/print.asm b/bootloader/pm/vga/print.asm similarity index 100% rename from src/bootloader/pm/vga/print.asm rename to bootloader/pm/vga/print.asm diff --git a/src/grub/grub.cfg b/grub/grub.cfg similarity index 100% rename from src/grub/grub.cfg rename to grub/grub.cfg diff --git a/src/kernel/kernel.c b/kernel/kernel.c similarity index 100% rename from src/kernel/kernel.c rename to kernel/kernel.c diff --git a/src/kernel/kernel_entry.asm b/kernel/kernel_entry.asm similarity index 100% rename from src/kernel/kernel_entry.asm rename to kernel/kernel_entry.asm diff --git a/src/kernel/lib/vga.c b/kernel/lib/vga.c similarity index 100% rename from src/kernel/lib/vga.c rename to kernel/lib/vga.c diff --git a/src/bootloader/bios.asm b/src/bootloader/bios.asm deleted file mode 100644 index ec08a80..0000000 --- a/src/bootloader/bios.asm +++ /dev/null @@ -1,7 +0,0 @@ -; EQUs -%include "src/bootloader/equ/bios.asm" - -; SRs -%include "src/bootloader/bios/convert.asm" -%include "src/bootloader/bios/print.asm" -%include "src/bootloader/bios/disk.asm"