Simple Object Kernel (SOK)

SOK is a small x86 kernel project that aims to combine C++, object conception with design patterns and Test Driven Development in a kernel environment. The kernel will never be a product, it is just a way to learn and implement kernel concepts using efficient development methods. All collaboration is welcome even to add a new architecture (ARM, PPC, etc) but you have to know that code must be tested and reviewed before pushed.

Architecture

The kernel consists in a set of library compiled independently, and then linked to a bootstrap. Each library is also linked to a test suite that is executed immediately after compilation. If tests fail, the final binary is not linked. These test suites aim to be unit tests on the classes available in this library and also functional tests on the feature brought by these classes.

The kernel is written in C++. The bootstrap is the serie of steps that leads from the boot loader end to the C++ environment where the main kernel loop runs. The process is made of three main steps:

  1. Take hand from the bootloader and setup a minimal environment for C world (initialize a bit memory, save Multiboot information, set-up a stack) and jump to C world.
  2. Now in C world, setup a debug environment (a way to print traces on the current platform using the standard printf) and initialize the C++ world (call constructors of static objects, etc) and its run time. Jump to C++ world.
  3. We’re in C++ world, the kernel is now able to boot: initialize CPU tables, memory management, etc.

Sources

Source code of the projet is available on my Github page, here. You can clone the repository using:

$ git clone https://github.com/ddejean/sok.git

Build and run

The kernel toolchain builds the kernel and directly runs the binary in a virtual machine (Qemu/KVM) or an emulator (Qemu, Bochs). To use the kernel just choose the target you wanna run on, and use the Makefile:

$ cd sok/
$ make [qemu|bochs]

The kernel will be compiled and launched automatically on the platform you have chosen.