fidelicura/orb
Well-documented implementation of RISC-V kernel in Zig, built on QEMU emulation.
This project is a very-very commented and detailed explanation on writing your own small kernel for 32-bit RISC-V.
It is built upon QEMU - an emulation software, using virt
.
apt install qemu-system-misc
pacman -S qemu-system-riscv
apt install just
pacman -S just
gdb
debugger:apt install gdb
pacman -S gdb
just build
: builds a whole project as a single binaryjust run
: builds a whole project and runs built binary in a QEMUjust dbg
: builds a whole project and runs build binary in a QEMU with open debugging portjust gdb
: connects to the open QEMU debugging port (see just dbg
) using gdb
There is also
helper.gdb
GDB script for printing relevant information while debugging. You may find it useful.
Order of look-through:
src/linker.lds
src/boot.s
src/kernel.zig
src/uart.zig
Just read comments from file in a provided order.Kernel is built for 4-core RV32IM ISA compatible CPU with ILP32 ABI using GNU toolchain (see GCC). The source code does not implement BIOS, only the kernel itself!