diff --git a/.gitignore b/.gitignore index 67d9b34..2003856 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,3 @@ nimcache/ +isodir/ +myos.iso diff --git a/boot.o b/boot.o new file mode 100644 index 0000000..4896ace Binary files /dev/null and b/boot.o differ diff --git a/builddisc.sh b/builddisc.sh new file mode 100755 index 0000000..c99f4c8 --- /dev/null +++ b/builddisc.sh @@ -0,0 +1,6 @@ +#!/bin/sh +rm -r isodir +mkdir -p isodir/boot/grub +cp kernel isodir/boot/kernel +cp grub.cfg isodir/boot/grub/grub.cfg +grub-mkrescue -o myos.iso isodir diff --git a/checkmultiboot.sh b/checkmultiboot.sh new file mode 100755 index 0000000..cf0a37e --- /dev/null +++ b/checkmultiboot.sh @@ -0,0 +1,6 @@ +#!/bin/sh +if grub-file --is-x86-multiboot kernel; then + echo multiboot confirmed +else + echo the file is not multiboot +fi diff --git a/grub.cfg b/grub.cfg new file mode 100644 index 0000000..1e1a972 --- /dev/null +++ b/grub.cfg @@ -0,0 +1,3 @@ +menuentry "myos" { + multiboot /boot/kernel +} diff --git a/makefile b/makefile new file mode 100644 index 0000000..46aad51 --- /dev/null +++ b/makefile @@ -0,0 +1,10 @@ +all: kernel + +kernel: bootloader + nim cc --cc:clang --clang.linkerexe=ld.lld --gc:none --deadCodeElim:on --cpu:i386 --os:standalone --passC:"-ffreestanding -nostdlib --target=i686-pc-none-elf -march=i686" --passL:"-m elf_i386 boot.o" kernel.nim + +bootloader: + nasm -felf32 boot.s -o boot.o + +clean: + rm -r kernel nimcache/ boot.o diff --git a/panicoverride.nim b/panicoverride.nim new file mode 100644 index 0000000..08cced0 --- /dev/null +++ b/panicoverride.nim @@ -0,0 +1,2 @@ +proc rawoutput(s: string) = discard +proc panic(s: string) = discard