diff options
| author | Carlos Maiolino <[email protected]> | 2025-07-17 19:20:28 +0200 |
|---|---|---|
| committer | Carlos Maiolino <[email protected]> | 2025-07-17 19:20:28 +0200 |
| commit | d8392002629bc97c05ca82961c7ab3439ed7248e (patch) | |
| tree | dfd3f7dafd4e9efe10fe87b383c78430379580b9 /Makefile | |
| parent | 7bcc28cb58e99927e14636fe199c5345f6c63a6f (diff) | |
Start writing the kernel and add a linker script
Move the code unders [BITS 32] label to its own file to be loaded as a
kernel by the boot loader.
Add a linker script to link the bootloader and the kernel in a single
binary file.
Add a build script to make it easier to use the cross compiler
Update the Makefile to build everything and pack it into the os.bin
Signed-off-by: Carlos Maiolino <[email protected]>
Diffstat (limited to 'Makefile')
| -rw-r--r-- | Makefile | 19 |
1 files changed, 18 insertions, 1 deletions
@@ -1,7 +1,24 @@ +FILLES = ./build/kernel.asm.o + BOOTLOADER=./src/boot/bootloader.asm TARGET=./bin/boot.bin -all: +all: ./bin/boot.bin ./bin/kernel.bin + rm -rf ./bin/os.bin + dd if=./bin/boot.bin >> ./bin/os.bin + dd if=./bin/kernel.bin >> ./bin/os.bin + dd if=/dev/zero bs=512 count=100 >> ./bin/os.bin +./bin/kernel.bin: ./build/kernel.asm.o + i686-elf-ld -g -relocatable ./build/kernel.asm.o -o ./build/cemOS.o + i686-elf-gcc -T ./src/linker.ld -o ./bin/kernel.bin -ffreestanding -O0 -nostdlib ./build/cemOS.o + +./bin/boot.bin: ./src/boot/bootloader.asm nasm -f bin $(BOOTLOADER) -o $(TARGET) + +./build/kernel.asm.o: ./src/kernel.asm + nasm -f elf -g ./src/kernel.asm -o ./build/kernel.asm.o + clean: rm -f $(TARGET) + rm -f build/cemOS.o + rm -f build/kernel.asm.o |
