A language-based OS to run Rust on bare metal

Overview

RustOS

A simple, language-based OS.

Current features:

  • Simple VGA for seeing output
  • Some Rust libraries (core, alloc, collections) already in
  • Working (but limited) keyboard input
  • Beginnings of a network driver (RTL8139) and stack (it can send properly formatted UDP packets!)

Building:

  1. Dependencies:
  • qemu (emulator) or grub-mkrescue (run an iso on a VM or hardware)
  • as
  • ld
  • rustc (0.12.0)
  • cargo (latest)
  1. Pull this repo git clone https://github.com/ryanra/RustOS.git
  2. Make sure to pull the submodules as well: git submodule update --init
  3. Run:
  • On qemu: make run
  • Or, make an iso make iso and run it on a VM or real hardware!

Design goals:

  1. Implement the entire Rust standard library on bare metal. Essentially, you should be able to write your program, link against std, add a bootloader, and run on bare metal. Of course, we'll need a little more to make the operating system extensible (specifically, an interface for adding drivers and libraries)

  2. The OS will be as simple as possible with as little as possible in it. Specifically, Rust type safety allows us to omit:

  • Paging. CPU memory protection is unecessary if you can only execute safe code
  • Syscalls. You can only call functions exported in std (there is the issue of unsafe though, which will need to be considered at some point)
  • (This simplicitly may also end up scoring in terms of performance!)
  1. Micro/Monolithic kernel is really irrelevant because everything is running in kernel mode and safety is enforced by the language, so there's no need for user mode. That said, the goal is to keep this code base small and enforce least-privledge with tight modules that also allow future additions.

  2. Security. That's the big advantage that Rust would bring to an OS (i.e., memory safety) and that current OSes are really lacking.

Short-term goals:

  1. Handle interrupts, specifically get the keyboard working. done!
  2. Threading/Multiprocessing
  • There's the beginnings of a single-core implementation, but it looks like libgreen can be slightly modified to this end
  1. Other architectures:
  • There's some beginnings of architecture-agnostic code, but it needs to be taken further

Longer-term goals:

  1. Basic drivers
  • This should include a modular and secure (least privledge) interface for adding your own drivers as well
  1. A filesystem
  2. Network stack
  3. Port rustc to RustOS
  4. That's probably it!

Current issues:

  1. Linkage probelms fixed!
  2. Threading is buggy and needs more attention. fixed! (no longer buggy, but still more to do!)
  3. The current allocator never actually frees data and is just there to get collections working.

Organization:

  1. Architecture-specific files (mostly) are now in arch/
  2. std had been stripped out of dependencies on an OS/libc and is usable (so, we can use stuff libcore, libcollections, librand)
  • The idea is to move most of the functionality into a runtime library in a fork of rust so we can support libstd

License

Apache License, Version 2.0 or the MIT license, at your option. See LICENSE-APACHE and LICENSE-MIT for details.

You might also like...
A fresh FRAME-based Substrate node, ready for hacking

Substrate Node Template A fresh FRAME-based Substrate node, ready for hacking 🚀 Getting Started Follow the steps below to get started with the Node T

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

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

A hobby operating system, in Rust

intermezzOS: kernel intermezzOS is a hobby operating system. This repository is for its kernel. See the website for more. License This project is dual

A Rust version of the Weenix OS

Reenix This is the start of a unix like operating system written in Rust. It is based on the Weenix Operating system written for Brown's CS167/9. At t

A tiny 32 bit kernel written in Rust
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

Experimental kernel for embedded devices written in Rust

bkernel is an experimental kernel for embedded devices written in Rust. I'm mostly trying out Rust now to see how it applies to kernel development. Pr

Open Source Rust kernel; Runs WASM and WASI as lightweight containers.

😳 etheryal Kernel etheryal kernel is an Open Source capability-based Kernel written in the Rust programming language. The kernel allows implementing

Basic Rust kernel using Limine

Rust Limine Barebones This is a small kernel that boots using Limine. Build First of all, download Rust ! (I guess you already did it if you are here

Owner
null
RCore-Tutorial-v3 - Let's write an OS which can run on RISC-V in Rust from zero!

rCore-Tutorial-v3 rCore-Tutorial version 3.5. See the Documentation in Chinese. Official QQ group number: 735045051 news 2021.11.20: Now we are updati

rCore OS 786 Jan 2, 2023
Let's write an OS which can run on ARM in Rust from scratch

rCore-Tutorial-v3 rCore-Tutorial version 3.5. See the Documentation in Chinese. news 2021.11.20: Now we are updating our labs. Please checkout chX-dev

rCore OS 10 Dec 17, 2022
Let's write an OS which can run on x86_64 in Rust from scratch

rCore-Tutorial-v3 rCore-Tutorial version 3.5. See the Documentation in Chinese. news 2021.11.20: Now we are updating our labs. Please checkout chX-dev

rCore OS 6 Apr 1, 2022
A library that makes it VERY easy to run Holochain as a library, from your own binary, with great defaults

embedded-holochain-runner A library that makes it VERY easy to run Holochain as a library, from your own binary, with great defaults How it will work

Sprillow 14 Jul 23, 2022
Distrod is a meta-distro for WSL 2 which runs Systemd as init process. You can run Ubuntu, Arch, and et.c with systemd in a minute. Distrod also has built-in auto-start feature on Windows startup and port forwarding abiltiy.

Distrod - WSL2 Distros with Systemd! Distrod is a systemd-based meta-distro for WSL2 that allows you to install Ubuntu, Arch Linux, Gentoo and many ot

Takaya Saeki 1.6k Jan 9, 2023
A lightweight microkernel/IPC based operating system built with Rust which is not a clone of any existing operating system

Noble Operating System Noble is a lightweight microkernel and IPC based operating system built with Rust which is not a clone of any existing operatin

Revolution Xenon 3 Jan 10, 2022
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

Lobaro 196 Jan 4, 2023
A Rust-based userland which also adds compile-time assurances to seL4 development.

ferros Overview A Rust library to add extra assurances to seL4 development. ferros provides smart type-safe wrappers around seL4 features with an emph

Auxon Corporation 68 Dec 25, 2022
Aero is a new modern, unix based operating system. It is being developed for educational purposes.

Areo Aero is a new modern, unix based operating system written in Rust and is being developed for educational purposes. Aero follows the monolithic ke

Anhad Singh 623 Dec 24, 2022
suidsnoop is a tool based on eBPF LSM programs that logs whenever a suid binary is executed and implements custom allow/deny lists.

suidsnoop Log suid binaries and enforce per-uid suid policy. suidsnoop is a tool for logging whenever a suid binary is executed on your system and opt

William Findlay 11 Dec 22, 2022