wenyuzhao
Sophon
Rust

A Raspberry Pi OS Kernel in Rust

Last updated May 19, 2026
36
Stars
3
Forks
7
Issues
0
Stars/day
Attention Score
6
Language breakdown
Rust 99.1%
HTML 0.5%
Shell 0.2%
Makefile 0.2%
NSIS 0.0%
โ–ธ Files click to expand
README

Sophon - A Raspberry Pi Kernel in Rust

An experimental modular-kernel written in Rust.

The name "Sophon" comes from the novel The Three-Body Problem).

Getting Started

Preparation

  • Install rustup.
  • qemu-system-aarch64 (optionally gdb-multiarch or lldb for debugging).
  • For debugging: LLVM tools (lldb, llvm-objcopy and llvm-objdump)
  • VSCode setup: install the rust-analyzer extension.

Run on QEMU

$ cargo dev run

Run on a Raspberry Pi 4B

Prepare UEFI and bootable USB (once)

  • Prepare a USB drive with UEFI firmware.
  • Plug the usb to your Raspberry Pi and connect to a HDMI monitor (or using UART0).
  • Start Raspberry Pi and goto UEFI settings menu.
  • Navigate to Device Manager โ†’ Raspberry Pi Configuration โ†’ Advanced Settings and enable ACPI + Device tree

Install kernel

  • cd boot/uefi
  • make deploy boot=/path/to/your/usb/directory
  • Plug the usb to your Raspberry Pi and connect a serial cable to UART0 ports properly.
  • Use screen to connect to the serial device
- e.g. screen /dev/tty.usbserial 115200.
  • Start Raspberry Pi

Design

The current plan is:

Make the kernel as simple and small as possible. Instead of following the micro-kernel approach that puts each kernel component as a isolated user process, Sophon tries to treat the components as kernel modules. This is expected to have higher performance than micro-kernels due to the absence of context switches and message passing overheads.

TODO

Boot

  • [x] Make the kernel boot on AArch64 QEMU (UEFI)
  • [x] Make the kernel boot on a real Raspberry Pi 4B (UEFI)
  • [x] Setup EL1 virtual memory
  • [x] Load kernel as relocatable ELF
  • [x] Start kernel at Exception Level 1
  • [ ] UEFI Network boot
  • [ ] U-boot support

Kernel

  • [x] Initialize drivers based on a device tree
  • [x] Basic interrupt handler support
  • [x] Kernel heap allocation
  • [x] Timer interrupts
  • [x] Scheduling / Context switch
  • [x] Syscalls support
  • [x] Log syscall (output to UART, for user process debugging)
  • [x] Kernel Modules
  • [x] Module-defined syscalls (Module calls)
  • [x] VFS module and Root-FS
  • [ ] Memory management module; mmap and munmap syscalls
  • [ ] File system modules like fat32
  • [x] Process management module
  • [x] Process and multi-threading
  • [x] Driver interface based on modules
  • [ ] SMP support

User Space

  • [ ] Properly trap and handle Stack-overflow exception
  • [x] Launch init process in privileged mode
  • [x] Launch init process in user mode
  • [x] TTY
  • [ ] Update/release ref-counted pages after process exit
  • [ ] Port gcc/libc/rustc

Architectures

  • [x] AArch64
  • [ ] X86_64
  • [ ] X86
  • [ ] ARMv6-M (RTOS)

Others

  • [x] Unit / integration tests
  • [x] Continuous integration (based on GitHub Actions)

References

๐Ÿ”— More in this category

ยฉ 2026 GitRepoTrend ยท wenyuzhao/Sophon ยท Updated daily from GitHub