A write-up of making a simple OS kernel. (A bit more advanced than bare bones, but simpler than meaty skeleton)
It was inspired as Meaty Skeleton tutorial already had too much implemented for demonstration, and I wanted something that can be studied more easily.
So hopefully, it is easier to follow compared to Meaty Skeleton.
This is an operating system kernel that is written based on Meaty Skeleton tutorial, but shaved down so that it implements barely enough features so that you can expand its functionality.
In fact, it does not feature libc functions like printf.
Instead it offers functions like protoprintf
where you need to supply both the pointer to the string array, and the length, and it does not allow any other data types.
I would say it is somewhere between Bare Bones and Meaty Skeleton level of complexity.
Before building this project, I highly recommend you read through the Bare Bones and possibly the Meaty Skeleton, as this project is somewhat in between.
However, you can follow along without having read, as the build system is made to be very simple.
To build this project, you need a cross-compiler. (If you've done this before, skip to source environment.)
You could follow GCC Cross-Compiler, which is highly recommended for first-timers, or use my "experimental" and demonstrative build-cc-toolchain.sh.
# This downloads the most recent version of GCC and binutils, and compiles it.
./build-cc-toolchain.sh
This will build a GCC cross-compiler at this project directory at opt/cross.
Then you can activate this cross-compiler by
source environment
where environment defines PREFIX, TARGET, and PATH so that you can use the cross-compiler more easily.
To actually build the kernel, navigate to the os-src directory, and run make.
cd os-src
make
Then you should see myos.kernel.
To boot it using qemu, run the following command
qemu-system-i386 -kernel myos.kernel
Depending on your QEMU setting, it may run the kernel immediately, or it spawns a VNC instance, where you will have to use VNC client to view.
The goal of this repo is not to "build" on this. The point is that this serves as a learning path of OS development.
If you are thinking of creating an operating system kernel, I would suggest you actually read through many resources and structure it more cleanly before starting.
