Added code + tooling to build os.

This commit is contained in:
neviyn 2017-10-20 20:58:06 +01:00
parent 3da4d3538d
commit d4d57c8053
7 changed files with 29 additions and 0 deletions

2
.gitignore vendored
View File

@ -1 +1,3 @@
nimcache/
isodir/
myos.iso

BIN
boot.o Normal file

Binary file not shown.

6
builddisc.sh Executable file
View File

@ -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

6
checkmultiboot.sh Executable file
View File

@ -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

3
grub.cfg Normal file
View File

@ -0,0 +1,3 @@
menuentry "myos" {
multiboot /boot/kernel
}

10
makefile Normal file
View File

@ -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

2
panicoverride.nim Normal file
View File

@ -0,0 +1,2 @@
proc rawoutput(s: string) = discard
proc panic(s: string) = discard