• v0.0.1 1d0e79bbb5

    Vimthusiast released this 2026-08-31 18:56:53 +02:00 | 5 commits to main since this release

    Signed by Vimthusiast
    GPG key ID: 8537ADCB4E07A1E5

    Features

    • booting via the underyling SBI implementation OpenSBI, running as M-mode firmware
      -> the Supervisor Binary Interface (SBI) is a standardized RISC-V firmware binary interface for supervisor mode software such as kernels
    • logging layer
      • custom std.log backend using serial I/O provided by the M-mode firmware
    • sketched out version of a scalable driver subsystem, inspired by Linux:
      • BusType: identifies a single bus; every bus has independent discovery mechanisms
      • Driver: a registered driver, belonging to a bus-type
      • Device: identifies a hardware device unit discovered on a bus-type
    • scan and initialize device tree (initial hardware info provided
    • first driver for the NS16550A UART, enabling serial I/O independent of the underlying M-mode firmware (OpenSBI)
    • first userspace code execution:
      • embedded the hello world program
      • uses two syscalls: write for printing and exit when finished
      • uses my libsys library that exposes a clean interface
      • uses the libsys-start library as an entry point before main(), acting as my equivalent of the crt0 (initial C runtime found in pretty much every C toolchain)

    Demo Video

    You can check out a demo of this running with a few explanations at https://youtu.be/5B-B0HPyghI

    Running It

    Requirements: QEMU base desktop installation with qemu-system-riscv64 in addition, to emulate the RISC-V 64-bit ISA.

    Note

    This expects the kernel.elf file to be in the current working directory

    qemu-system-riscv64 \
      -kernel zig-out/kernel.elf \
      -m 2G \
      -M virt \
      -nographic
    
    Downloads