diff --git a/kernel/kernel.nim b/kernel/kernel.nim index dec4687..4d7f16b 100644 --- a/kernel/kernel.nim +++ b/kernel/kernel.nim @@ -4,6 +4,8 @@ import tty, gdt, interrupts, serial +const version {.strdefine.} = "UNKNOWN" + type MemoryPointer{.unchecked.} = ptr array[0, char] @@ -20,12 +22,18 @@ proc memset*(dest: ByteAddress, value: char, count: int){.exportc.} = proc kernelMain() {.exportc: "kernel_main"}= serial.init() + serial.write("Version:") + serial.write(version) + serial.write("\L") serial.write("Booting OS\L") gdt.gdtInstall() serial.write("GDT installed\L") interrupts.idtInstall() serial.write("IDT installed\L") terminalInitialize() + terminalWrite("Version:") + terminalWrite(version) + terminalWrite("\L") terminalWrite("Hello World!\L") terminalWrite("MAX_INT:") terminalWrite(high(int)) diff --git a/nakefile.nim b/nakefile.nim index 478a683..f75fcfc 100644 --- a/nakefile.nim +++ b/nakefile.nim @@ -1,8 +1,9 @@ import nake -import os +import os, osproc, strutils -const - standardOptions = """--skipCfg kernel.nim""" +let + standardOptions = """--skipCfg -d:version:"""" & execProcess("git rev-parse --abbrev-ref HEAD").strip() & + "|" & execProcess("git rev-parse HEAD").strip() & """" kernel.nim""" outputFile = "myos.bin" task "clean", "Removes build files.":