An experimental modular OS written in Rust.

Overview

ArceOS

CI CI Docs

An experimental modular operating system (or unikernel) written in Rust.

ArceOS was inspired a lot by Unikraft.

🚧 Working In Progress.

Features & TODOs

  • Architecture: riscv64, aarch64
  • Platform: QEMU virt riscv64/aarch64
  • Multi-thread
  • Cooperative/preemptive scheduler
  • VirtIO net/blk/gpu drivers
  • TCP/UDP net stack using smoltcp
  • Synchronization/Mutex
  • SMP scheduling with single run queue
  • File system
  • Compatible with Linux apps
  • Interrupt driven device I/O
  • Async I/O

Example apps

Example applications can be found in the apps/ directory. All applications must at least depend on the following modules, while other modules are optional:

  • axruntime: Bootstrapping from the bare-metal environment, and initialization.
  • axhal: Hardware abstraction layer, provides unified APIs for cross-platform.
  • axconfig: Platform constants and kernel parameters, such as physical memory base, kernel load addresses, stack size, etc.
  • axlog: Multi-level formatted logging.

The currently supported applications (Rust), as well as their dependent modules and features, are shown in the following table:

App Extra modules Enabled features Description
helloworld A minimal app that just prints a string
exception paging Exception handling test
memtest axalloc alloc, paging Dynamic memory allocation test
display axalloc, axdisplay alloc, paging, display Graphic/GUI test
yield axalloc, axtask alloc, paging, multitask, sched_fifo Multi-threaded yielding test
parallel axalloc, axtask alloc, paging, multitask, sched_fifo Parallel computing test (to test synchronization & mutex)
sleep axalloc, axtask alloc, paging, multitask, sched_fifo Thread sleeping test
shell axalloc, axdriver, axfs alloc, paging, fs A simple shell that responds to filesystem operations
httpclient axalloc, axdriver, axnet alloc, paging, net A simple client that sends an HTTP request and then prints the response
echoserver axalloc, axdriver, axnet, axtask alloc, paging, net, multitask A multi-threaded TCP server that reverses messages sent by the client
httpserver axalloc, axdriver, axnet, axtask alloc, paging, net, multitask A multi-threaded HTTP server that serves a static web page

Build & Run

Install build dependencies

Install cargo-binutils to use rust-objcopy and rust-objdump tools:

cargo install cargo-binutils

Example apps

# in arceos directory
make A=path/to/app ARCH=<arch> LOG=<log> NET=[y|n] FS=[y|n]

Where <arch> should be one of riscv64, aarch64.

<log> should be one of off, error, warn, info, debug, trace.

path/to/app is the relative path to the example application.

More arguments and targets can be found in Makefile.

For example, to run the httpserver on qemu-system-aarch64 with 4 cores:

make A=apps/net/httpserver ARCH=aarch64 LOG=info NET=y SMP=4 run

Your custom apps

Rust

  1. Create a new rust package with no_std and no_main environment.

  2. Add libax dependency and features to enable to Cargo.toml:

    [dependencies]
    libax = { path = "/path/to/arceos/ulib/libax", features = ["..."] }
  3. Call library functions from libax in your code, like the helloworld example.

  4. Build your application with ArceOS, by running the make command in the application directory:

    # in app directory
    make -C /path/to/arceos A=$(pwd) ARCH=<arch> run
    # more args: LOG=<log> SMP=<smp> NET=[y|n] ...

    All arguments and targets are the same as above.

C

  1. Create axbuild.mk and features.txt in your project:

    app/
    ├── foo.c
    ├── bar.c
    ├── axbuild.mk      # optional, if there is only one `main.c`
    └── features.txt    # optional, if only use default features
  2. Add build targets to axbuild.mk, add features to enable to features.txt (see this example):

    # in axbuild.mk
    app-objs := foo.o bar.o
    # in features.txt
    default
    alloc
    paging
    net
  3. Build your application with ArceOS, by running the make command in the application directory:

    # in app directory
    make -C /path/to/arceos A=$(pwd) ARCH=<arch> run
    # more args: LOG=<log> SMP=<smp> NET=[y|n] ...

Design

You might also like...
Xrs is a POSIX-subset operating system kernel written in Rust.

XRS-OS ( 🚧 WIP) Xrs is a POSIX-subset operating system kernel written in Rust. Current project team members 0x5459 core developer (he/him) 0x5457 cor

Linux kernel modules written in Rust

Linux kernel modules written in Rust A collection of in-progress experimental Linux kernel modules written for the Rust for Linux project To run the o

An attempt at an operating system written in Rust

Rust Operating System An attempt at a simple operating system in Rust and a semester project for the Operating Systems course at CS@UCU. Documentation

An UEFI application that unlocks a SED and starts an OS from it. Written in Rust

opal-uefi-greeter This is an UEFI application written in Rust that unlocks a SED and then launches another UEFI application from the unlocked drive -

Rux - An x86_64 toy operating system kernel written in Rust
Rux - An x86_64 toy operating system kernel written in Rust

Rux - An x86_64 toy operating system kernel written in Rust. Rux is a port of the Hux kernel, my x86 32-bit single-CPU toy kernel written in C, following the OSTEP book structure and terminology.

This project is based on code from freertos.rs and some additions to simplify the usage of FreeRTOS in embedded applications written in Rust

FreeRTOS-rust This project is based on code from freertos.rs and some additions to simplify the usage of FreeRTOS in embedded applications written in

An super minimal kernel written in rust

Grisha This project depends on this blog serie Philipp Oppermann's blog Required Knowlege I don't know what you really need to know to learn efficient

A Rust Operating System, written from the ground up

ThornOS A Rust Operating System, written from the ground up Build Dependencies Bootimage TODO: Document build process in more detail Acknowledgements

An educational git clone written in Rust.

rat rat is a simple version control system written in Rust designed primarily to be easy to understand and modify, with as few external dependencies a

Comments
  • Add VFS support

    Add VFS support

    Try to introduce support for vfs, which is referenced from linux, and currently supports some common functions. I was not sure how this architecture should use the filesystem, so I wrote only a few simple functions and did not use disk devices, because the vfs implementation includes a ramfs that can run in memory.

    If this request is merged, I will add a supported version of vfs for fat32, which will use block devices.

    Please tell me how this system needs to support the file system?

    opened by Godones 1
  • Implement easy-fs from rCore-tutorial

    Implement easy-fs from rCore-tutorial

    Implement easy-fs from rCore-tutorial.

    Changes:

    • Add easy_fs crate
    • Update axfs module to use easy_fs
    • Add fs_easyfs and fs_fatfs feature to libax to allow selection of fs
    • Add easyfs feature to the shell app

    To run shell with easyfs:

    make A=apps/fs/shell ARCH=aarch64 LOG=info FS=y APP_FEATURES=easyfs run
    

    The default choice of fs (fatfs) remains unchanged:

    make A=apps/fs/shell ARCH=aarch64 LOG=info DISK_IMG=... FS=y run
    
    opened by liang2kl 0
  • Add support of multicore scheduling

    Add support of multicore scheduling

    1. Add crate percpu for per-CPU data structure.
    2. Introduce CurrentTask to get the per-CPU current task pointer.
    3. Implement single-queue multicore scheduling, fixed deadlocks in previous code.
    opened by equation314 0
  • add support for display by using virtio-gpu

    add support for display by using virtio-gpu

    Add feature "display" Add the driver for virtio-gpu to show some image on the screen. Run with command: "make APP=display GRAPHIC=on run"

    opened by MrRobertYuan 0
Owner
rCore OS
Combining Various Operating Systems Using OS-Reusable Components
rCore OS
A comparison of operating systems written in Rust

Rust OS comparison A comparison of operating systems written in Rust. There are several open source operating systems written in Rust. Most of them ar

Markus Kohlhase 492 Jan 8, 2023
An OS kernel written in rust. Non POSIX

"Tifflin" Experimental Kernel (and eventually Operating System) This is an experiment in writing an OS Kernel in rust (http://rust-lang.org). Mostly t

John Hodge (Mutabah) 618 Jan 8, 2023
A tiny 32 bit kernel written in Rust

rustboot A tiny 32 bit kernel written in Rust. I was inspired to download Rust and try to do this after seeing zero.rs - a stub that lets Rust program

Charlie Somerville 1.5k Dec 30, 2022
A new operating system kernel with Linux binary compatibility written in Rust.

Kerla Kerla is a monolithic operating system kernel from scratch in Rust which aims to be compatible with the Linux ABI, that is, runs Linux binaries

Seiya Nuta 3.1k Jan 1, 2023
Minimal x86_64 OS kernel written in Rust

rkernel A minimal x86_64 Rust OS kernel. Multiboot2 VGA driver PIC PIT PS/2 Keyboard driver PS/2 Mouse driver TSC RTC Allocator ATA PIO (In progress..

Divy Srivastava 36 Apr 26, 2022
Operating system written in Rust for NumWorks calculator (model n0110)

RustWorks An OS (eventually) for the Numworks calculator (model n0110). Setup First install Rust by following these instuctions then: rustup target ad

null 30 Nov 10, 2022
SteinsOS is an operating system written in Rust

SteinsOS is an operating system featuring non-preemptive kernel targeting on single-core armv8 architecture.

Sheng 84 Dec 15, 2022
🍒 Small, simple, and fast kernel written in Rust. 🌸

?? Small, simple, and fast kernel written in Rust. ??

Cherry Developers 5 May 20, 2022
Revons Os is a new OS written from scratch in Rust to experiment with novel OS structure

Revons Os is a new OS written from scratch in Rust to experiment with novel OS structure, better state management, and how to leverage intralingual design principles to shift OS responsibilities like resource management into the compiler.

Fayssal Chokri 1 Jul 2, 2022
RevonsOs is a new OS written from scratch in Rust to experiment with novel OS structure, better state management

RevonsOs is a new OS written from scratch in Rust to experiment with novel OS structure, better state management, and how to leverage intralingual design principles to shift OS responsibilities like resource management into the compiler.

Revons Community 3 Mar 14, 2022