Kernel & compiling script rework

pull/17/head
E. Almqvist 3 years ago
parent 34a4d93970
commit fe69547f2d
  1. 12
      compile.sh
  2. 7
      src/kernel.c

@ -1,6 +1,16 @@
#!/usr/bin/bash #!/usr/bin/bash
done="[OK]"
fail="[FAIL]"
srcDir=src srcDir=src
binDir=bin 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

@ -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';
}
Loading…
Cancel
Save