An experimental modular-kernel written in Rust.
The name "Sophon" comes from the novel The Three-Body Problem.
- Install rustup.
qemu-system-aarch64
(optionallygdb-multiarch
orlldb
for debugging).- For debugging: LLVM tools (
lldb
,llvm-objcopy
andllvm-objdump
) - VSCode setup: install the rust-analyzer extension.
$ cargo dev run
- 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 enableACPI + Device tree
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
.
- e.g.
- Start Raspberry Pi
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.
- Make the kernel boot on AArch64 QEMU (UEFI)
- Make the kernel boot on a real Raspberry Pi 4B (UEFI)
- Setup EL1 virtual memory
- Load kernel as relocatable ELF
- Start kernel at Exception Level 1
- UEFI Network boot
- U-boot support
- Initialize drivers based on a device tree
- Basic interrupt handler support
- Kernel heap allocation
- Timer interrupts
- Scheduling / Context switch
- Syscalls support
-
Log
syscall (output to UART, for user process debugging) - Kernel Modules
- Module-defined syscalls (Module calls)
- VFS module and Root-FS
- Memory management module;
mmap
andmunmap
syscalls - File system modules like fat32
- Process management module
- Process and multi-threading
- Driver interface based on modules
- SMP support
- Properly trap and handle Stack-overflow exception
- Launch init process in privileged mode
- Launch init process in user mode
- TTY
- Update/release ref-counted pages after process exit
- Port gcc/libc/rustc
- AArch64
- X86_64
- X86
- ARMv6-M (RTOS)
- Unit / integration tests
- Continuous integration (based on GitHub Actions)
- Raspberry Pi Bare Bones Rust - OSDev
- Mailbox Property Interface
- Bare Metal Raspberry Pi 3 Tutorials
- Bare Metal Raspberry Pi 3 Tutorials (Rust)
- Raspberry Pi Hardware Documents
- Learning OS dev using Linux kernel & Raspberry Pi
- ARM Quad-A7 Documentation (for timer configuration)
- Circle - A C++ bare metal programming env for RPi
- PanicOS - A simple x86 operating system with graphical user space