Hey there! In this book, we’re going to build a small operating system from scratch, step by step.
You might get intimidated when you hear OS or kernel development, the basic functions of an OS (especially the kernel) are surprisingly simple. Even Linux, which is often cited as a huge open-source software, was only 8,413 lines in version 0.01. Today’s Linux kernel is overwhelmingly large, but it started with a tiny codebase, just like your hobby project.
We’ll implement basic context switching, paging, user mode, a command-line shell, a disk device driver, and file read/write operations in C. Sounds like a lot, however, it’s only 1,000 lines of code!
↫ Seiya Nuta
It’s exactly what it says on the tin.
And the entire templeOS was 100k lines, but that included not just a kernel and user space, it also had a GUI, some drivers, a few games and lots of neat stuff.
I was going to provide SerenityOS as an example of a small OS but apparently they have over a million lines on GitHub now! Granted that is not only a full OS with GUI but also C, C++, and crypto libraries along with a browser, image editors, basic office apps, and more. Not sure how much the OS itself is. Probably a lot more than TempleOS.
I went through the first few modules of this series. It is extremely approachable and well laid out. It also provides surprisingly fast gratification. You are defining and using a printf function by page 5! The resulting OS is not exactly going to become a daily driver but it is complete enough to illustrate the core concepts and takes a lot of the mystery and intimidation out of OS dev.
Going through this tutorial will help make something like the XV6 codebase easier to consume as well.
https://github.com/mit-pdos/xv6-riscv
Does anyone still remember the V2_OS that was used in the dutch energy sector? It seemed neat in 1998 (cli only afaik).