diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..86303d7 --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +kasm.o +kc.o +kernel \ No newline at end of file diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..dcfb003 --- /dev/null +++ b/Makefile @@ -0,0 +1,10 @@ +kernel: kasm.o kc.o + ld -m elf_i386 -T link.ld -o kernel kasm.o kc.o +kasm.o: kernel.asm + nasm -f elf32 kernel.asm -o kasm.o +kc.o: kernel.c + gcc -m32 -c kernel.c -o kc.o +test: + qemu-system-i386 -kernel kernel +clean: kasm.o kc.o kernel + rm kasm.o kc.o kernel \ No newline at end of file diff --git a/README.md b/README.md index 7e2fa3e..1835cb4 100644 --- a/README.md +++ b/README.md @@ -10,6 +10,15 @@ This is a minimalist kernel which prints "`my first kernel`" on the screen and t [Kernel 101 – Let’s write a Kernel](http://arjunsreedharan.org/post/82710718100/kernel-101-lets-write-a-kernel) +#### Use Makefile #### +A premade Makefile is included + +Use `make` to compile, assemble, and link the kernel easily and automatically. +Use `make test` to test the kernel in QEMU. +Use `make clean` to automatically remove outfiles and binaries. + +Or, see below to compile, assemble, and link the kernel yourself. + #### Build commands #### ``` nasm -f elf32 kernel.asm -o kasm.o @@ -50,4 +59,4 @@ Voila! ![kernel screenshot](http://static.tumblr.com/gltvynn/yOdn443dr/mkernel.png "Screenshot") #### The next step #### -See [mkeykernel repo](//github.com/arjun024/mkeykernel) +See [mkeykernel repo](github.com/arjun024/mkeykernel) \ No newline at end of file