diff --git a/compile.sh b/compile.sh index b009096..ccdc9cd 100755 --- a/compile.sh +++ b/compile.sh @@ -1,6 +1,16 @@ #!/usr/bin/bash +done="[OK]" +fail="[FAIL]" + srcDir=src binDir=bin -nasm -f bin $srcDir/bootloader.asm -i $srcDir -o $binDir/bootloader.bin +echo -n "Compiling bootloader... " +nasm -f bin $srcDir/bootloader.asm -i $srcDir -o $binDir/bootloader.bin && echo $done + +echo -n "Compiling kernel... " +gcc -ffreestanding -c $srcDir/kernel.c -o $binDir/kernel.o && ld -o $binDir/kernel.bin -Ttext 0x1000 $binDir/kernel.o --oformat binary 2>/dev/null && echo $done + +echo -n "Creating kernel image... " +cat $binDir/bootloader.bin $binDir/kernel.bin > $binDir/os-image && echo $done diff --git a/src/kernel.c b/src/kernel.c new file mode 100644 index 0000000..c5bc72d --- /dev/null +++ b/src/kernel.c @@ -0,0 +1,7 @@ +// VGA base address: 0xb8000 +// Charpos = 0xb8000 + 2(row*80 + col) + +void main() { + char* video_mem = (char*)0xb8000; // VGA Video Memory location + *video_mem = 'X'; +}