diff --git a/kernel/kernel.nim b/kernel/kernel.nim index d2c186e..19e585c 100644 --- a/kernel/kernel.nim +++ b/kernel/kernel.nim @@ -1,7 +1,8 @@ {.link: "boot.o".} -{.passL: "-T kernel/arch/i386/linker.ld".} +{.passL: "-ffreestanding -target i386 -nostdlib -T kernel/arch/i386/linker.ld".} +{.passC: "-ffreestanding -nostdlib --target=i386-pc-none-elf -march=i386".} -import tty, gdt, irq, serial +import tty, gdt, serial type MemoryPointer{.unchecked.} = ptr array[0, char] diff --git a/kernel/nim.cfg b/kernel/nim.cfg new file mode 100644 index 0000000..ea9b270 --- /dev/null +++ b/kernel/nim.cfg @@ -0,0 +1,12 @@ +cc=clang + +path="$lib/core" +path="$lib/pure" +path="$lib/pure/collections" +path="arch/i386" + +deadCodeElim=on +boundChecks=on +gc=regions +cpu=i386 +os=standalone \ No newline at end of file diff --git a/nakefile.nim b/nakefile.nim index 93499c5..478a683 100644 --- a/nakefile.nim +++ b/nakefile.nim @@ -2,7 +2,7 @@ import nake import os const - standardOptions = """--skipCfg --forceBuild --cc:clang --deadCodeElim:on --gc:regions --boundChecks:on --path:"kernel/arch/i386" --cpu:i386 --os:standalone --passC:"-ffreestanding -nostdlib --target=i386-pc-none-elf -march=i386" --passL:"-ffreestanding -target i386 -nostdlib" kernel/kernel.nim""" + standardOptions = """--skipCfg kernel.nim""" outputFile = "myos.bin" task "clean", "Removes build files.": @@ -21,7 +21,8 @@ task "build", "Builds the operating system.": runTask("clean") runTask("bootloader") echo "Compiling and linking." - direShell "nim cc -o:", outputFile, standardOptions + withDir("kernel"): + direShell "nim cc -o:", "../" & outputFile, standardOptions runTask("checkMultiboot") echo "Done." @@ -29,7 +30,8 @@ task "build-release", "Builds the operating system, release mode.": runTask("clean") runTask("bootloader") echo "Compiling and linking (release mode)." - direShell "nim cc --skipCfg -d:release -o:", outputFile, standardOptions + withDir("kernel"): + direShell "nim cc -d:release -o:", "../" & outputFile, standardOptions runTask("checkMultiboot") echo "Done."