Skip to content
This repository was archived by the owner on Aug 12, 2026. It is now read-only.

Repository files navigation

NOTE

{Intro:Multi-architecture(now only riscv64gc on qemu-virt first, do it bad first, then reconstruct later) toykernel, with "framekernel" target inspired by "Asterinas",with an "Alpine-like" userland target(musl + BusyBox).}This project is at an extremely early stage of development — almost nothing has been implemented yet, and everything is immature. The README.md was also written by AI; it looks impressive but actual functionality is far from complete. Please do not take this early, rough project too seriously. I will update this notice myself once a stable release is ready.

GitHub stars CI RISC-V

racho

A Rust kernel for RISC-V 64, built along the rCore Tutorial (Ch.1–4). Currently implements batch/time-sharing task scheduling with SV39 paging.

Goal

Refactor the current test-oriented codebase toward a Framekernel architecture — extract a thin, well-defined unsafe framework layer (page tables, trap handling, context switching) from the monolithic rCore style, while the upper-layer kernel logic is written entirely in safe Rust, aligning with the design philosophy of Asterinas.

Build & Run

nix develop                     # or manually: rust nightly + riscv64gc target + qemu-system-riscv64
make run

Project Structure

racho/
├── kernel/                # Kernel crate (safe Rust policy layer)
│   ├── src/
│   │   ├── main.rs        # Kernel entry (RachoKernel)
│   │   ├── boards.rs      # Board-specific configuration
│   │   ├── config.rs      # Kernel configuration constants
│   │   ├── lang_items.rs  # Rust #[lang] items for no_std
│   │   ├── logging.rs     # Colored logger
│   │   ├── console.rs     # print!/println! via SBI
│   │   ├── sbi.rs         # SBI wrappers (console, set_timer, shutdown)
│   │   ├── timer.rs       # RISC-V timer (set_next_trigger / get_time)
│   │   ├── loader.rs      # Loads embedded user apps from linker symbols
│   │   ├── trap.rs        # Trap handling (interrupt/exception/syscall)
│   │   ├── task.rs        # Task management (TCB / scheduler)
│   │   ├── syscall.rs     # Syscall dispatch
│   │   └── mm/            # Memory management (SV39 paging / frame allocator / heap)
│   └── build.rs           # Linker script & build config
├── framework/             # Thin unsafe layer
│   ├── src/
│   │   ├── boot.rs        # Kernel trait, alltraps, restore, symbol addresses
│   │   ├── entry.asm      # Assembly entry (_start -> boot)
│   │   ├── memory.rs      # Physical memory helpers, heap init, SATP
│   │   ├── sync.rs        # UPSafeCell
│   │   ├── trap.S         # Assembly trap handler
│   │   └── task/          # Task context & __switch (context.rs + switch.S)
│   ├── build.rs           # Generates link_app.S, embeds user apps
│   └── linker-qemu.ld     # Kernel linker script
├── user_lib/              # Userspace crate
│   └── src/bin/           # User apps (power_3/5/7, sleep)
├── bootloader/            # RustSBI binary
├── tools/                 # QEMU runner & GDB client scripts
└── flake.nix              # Nix dev environment with rustup, QEMU, gdb

Roadmap

  • Refactor to Framekernel architecture — extract unsafe framework layer, upper-layer safe Rust
  • Port musl libc — bring up a minimal C runtime for userland
  • Boot BusyBox — support statically-linked BusyBox with musl libc
  • Filesystem support
  • fork + exec process model

Acknowledgements

Built upon the rCore Tutorial v3 by the THU OS team. Framekernel architecture target inspired by Asterinas.

License

GPLv2 © 2026 tinyblinker

About

the "racho-next" will replace this bad one

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Contributors

Languages