Get the latest tech news

Writing an operating system kernel from scratch


Exploring a minimal implementation of a time-sharing kernel on RISC-V, implemented in Zig, on top of OpenSBI.

The SBI method should theoretically be more portable, as it delegates output management details to the M-level layer (essentially what we do with MMIO), freeing us from concerns about exact memory space addresses. In theory, this should also work on a real machine, provided an SBI layer is present when the kernel starts, and the linker script, I/O “drivers,” and other machine-specific constants are adapted. Many educational OS kernels exist, but this experiment combines RISC-V, OpenSBI, and Zig, offering a fresh perspective compared to traditional C implementations.

Get the Android app

Or read this on Hacker News

Read more on:

Photo of Scratch

Scratch

Related news:

News photo

SkiftOS: A hobby OS built from scratch using C/C++ for ARM, x86, and RISC-V

News photo

The Ivalice Chronicles team had to remake the original Final Fantasy Tactics' source code from scratch

News photo

How to build vector tiles from scratch