|
Kernelite 0.1.0
Kernelite is a minimalist, educational operating system kernel built from scratch. The project aims to recreate core components of the Linux architecture to explore the fundamentals of operating system design and hardware-software interaction.
|
Kernelite is a minimalist, monolithic educational operating system kernel built from scratch. The project aims to recreate core components of the Linux architecture to explore the fundamentals of operating system design and hardware-software interaction. Much of this codebase would be reused and restructured to serve as a baseline for a future microkernel-based hypervisor (which will heavily focus on highly optimized IPC design), though no guarantees.
kmalloc/kfree) layered on top of it.enable_mmu().compatible string.kprintf, string utilities.main() entry.src/kernel/ layout, plus the linker script (linker/linker.lds).make TEST=1.This project requires a cross-compiler (e.g., aarch64-none-elf-gcc) to ensure the kernel is built correctly for the target architecture regardless of your host machine.
This repository depends on external sources under external/dtc, which is tracked as a git submodule. When cloning this repository, initialize submodules before building:
If you already cloned without submodules, run:
or
This repository includes a VS Code Dev Container configuration under .devcontainer/.
The container is based on mcr.microsoft.com/devcontainers/base:noble and installs:
clang, clang-format, clang-tidy, clangddoxygenlld, llvm, llvm-dev, llvm-runtimegcc-aarch64-linux-gnu, binutils-aarch64-linux-gnuqemu-system-arm, qemu-efi-aarch64, qemu-utilsgdb-multiarchmake, git, device-tree-compiler, bison, flex, bc, pkg-configIt also installs the ARM GNU toolchain into /opt/arm-toolchain and adds it to the PATH, so aarch64-none-elf-gcc is available inside the container.
The Dev Container config also enables useful VS Code extensions for this project, including:
ms-vscode.cpptoolsllvm-vs-code-extensions.vscode-clangdms-vscode.makefile-toolsflorent-revest.addr2linexaver.clang-formatplorefice.devicetree13xforever.language-x86-64-assemblyMKornelsen.vscode-arm64eamodio.gitlensA shared shell history volume is mounted at /commandhistory so command history persists across Dev Container sessions.
The project is designed to be built using: Make
Below are the main make targets supported by this repository:
tools/register_decoder utility, the Doxygen docs, and run clang-tidy.:1234.make run-as-gdb-server.build/docs/html.clang-format on all C source and header files.clang-tidy in analysis mode on C source files.clang-tidy with automatic fixes enabled.tools/register_decoder/.To run Kernelite on aarch64 using QEMU:
Or simply run make run, which builds the kernel and launches it with the same QEMU invocation.
To debug the kernel under GDB:
This starts QEMU paused, with a GDB server listening on :1234. Attach to it with gdb-multiarch, then run make kill-gdb-server once finished to stop the QEMU instance. make doesn't track build flags, only file timestamps, so the clean is required — otherwise a binary already built without DEBUG=1 (stripped, no debug symbols) will be reused as-is.