#osdev #x86-64 #hobby-os #toy-os

nightly bin+lib moros

MOROS: Obscure Rust Operating System

7 releases (4 breaking)

0.7.1 Apr 10, 2022
0.7.0 Dec 12, 2021
0.6.0 Aug 21, 2021
0.5.1 Jun 27, 2021
0.1.0 Dec 29, 2019

#8 in #osdev

Download history 2/week @ 2022-01-28 6/week @ 2022-02-18 20/week @ 2022-03-11 24/week @ 2022-03-18 29/week @ 2022-04-08 5/week @ 2022-04-15 7/week @ 2022-04-22 44/week @ 2022-04-29 39/week @ 2022-05-06

96 downloads per month

MIT and GPL-3.0 licenses

1MB
11K SLoC

MOROS: Obscure Rust Operating System

screenshot

MOROS is a hobby operating system written in Rust by Vincent Ollivier.

It targets computers with a x86-64 architecture and a BIOS, so mostly from 2005 to 2020, but it also runs well on most emulators (Bochs, QEMU, and VirtualBox).

This project started from the seventh post of the second edition of Writing an OS in Rust by Philipp Oppermann and by reading the OSDev wiki along with many open source kernels.

Travis Crates.io

Features

  • External bootloader (using bootloader)
  • x86 CPU support (using x86_64)
  • Hardware interrupts (using pic8259)
  • PS/2 Keyboard with customizable layout (using pc-keyboard)
  • VGA Text mode with customizable font and color palette
  • Serial output (using uart_16550)
  • Paging
  • Heap allocation (using linked_list_allocator)
  • ACPI shutdown (using acpi and aml)
  • RTC clock
  • PCI devices
  • ATA PIO mode
  • Random number generator (using rand_chacha)
  • RTL8139 network card
  • AMD PCNET network card
  • DHCP/IP/TCP/UDP/DNS/HTTP network protocols (using smoltcp)
  • Basic filesystem
  • Basic shell
  • Basic text editor
  • Basic lisp interpreter
  • Basic file and network commands
  • Basic userspace for nasm binaries
  • Support for Rust binaries
  • Support for multitasking
  • C standard library port

Documentation

Documentation is available here

Setup

Clone the repo:

$ git clone https://github.com/vinc/moros
$ cd moros

Install the required tools with make setup or the following commands:

$ curl https://sh.rustup.rs -sSf | sh
$ rustup install nightly
$ rustup default nightly
$ cargo install bootimage

Usage

Build the image to disk.img:

$ make image output=video keyboard=qwerty nic=rtl8139

Run MOROS in QEMU:

$ make qemu output=video nic=rtl8139

Run natively on a x86 computer by copying the bootloader and the kernel to a hard drive or USB stick (but there is currently no USB driver so the filesystem will not be available in that case):

$ sudo dd if=target/x86_64-moros/release/bootimage-moros.bin of=/dev/sdx && sync

MOROS will open a console in diskless mode after boot if no filesystem is detected. The following command will setup the filesystem on a hard drive, allowing you to exit the diskless mode and log in as a normal user:

> install

Be careful not to overwrite the hard drive of your OS when using dd inside your OS, and install or disk format inside MOROS if you don't use an emulator.

Tests

Run the test suite in QEMU:

$ make test

LICENSE

MOROS is released under MIT.

Dependencies

~9.5MB
~194K SLoC