A Rust-based RISC-V operating system kernel
Explore the docs »
NekoOS is a Rust-based RISC-V operating system kernel focused on a small, readable codebase for learning and experimentation. It is no_std, targets bare metal, and runs on QEMU.
Built from the ground up using Rust's safety features, NekoOS provides a playground for OS development enthusiasts and a practical example of systems programming in Rust.
kernel/— kernel crate (arch, mm, trap, task, dev, algorithms)ulib/— minimal user-space support librarydocs/— design notes and developer docsMakefile,env.mk— build, run, and environment checksCargo.toml— workspace definition
To build and run NekoOS, you'll need:
-
Rust Toolchain:
# Install rustup if you haven't already curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh # Install the stable toolchain rustup toolchain install stable # Target and components rustup target add riscv64gc-unknown-none-elf rustup component add rust-src llvm-tools-preview cargo install cargo-binutils
-
QEMU:
- Ubuntu/Debian:
sudo apt install qemu-system - macOS:
brew install qemu
- Ubuntu/Debian:
-
Debugging tools (optional):
- GDB:
sudo apt install gdb-multiarch(Ubuntu/Debian) - LLDB: Available with most Rust installations
- GDB:
-
Verify your environment:
make check-env
-
Build the kernel:
make build
-
Run the kernel in QEMU:
make run LOG=INFO
LOGis compiled into the kernel. Change the value and rebuild to update log output. -
Debug the kernel:
make debug # Start QEMU in debug mode make gdb # Connect with GDB # or make lldb # Connect with LLDB
docs/STRUCTURE.md— kernel layout and boot flow notes
- debug/backtrace
- dev/block
- dev/char
- dev/console
- dev/cpu
- dev/fdt
- dev/timer
- fs
- mm/kernel heap (todo: oom handler)
- mm/page table
- mm/riscv64 (sv39; todo: sv48, sv57, sv64)
- mm/riscv32 (sv32)
- syscall
- schedule (todo: restructure schedule into algorithm)
- schedule/scheduler
- schedule/task/abi
- schedule/task/process
- schedule/task/thread
- schedule/task/idle
- trap (arch independent)
- ulib
Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions to NekoOS are greatly appreciated.
- Fork the Project
- Create your Feature Branch (
git checkout -b feature/amazing-feature) - Commit your Changes (
git commit -m 'Add some amazing feature') - Push to the Branch (
git push origin feature/amazing-feature) - Open a Pull Request
Please make sure to follow our coding standards and test your changes before submitting.
Distributed under the GPL-3.0 License. See LICENSE for more information.