Rust OSDev Operating System Development in Rust

This Month in Rust OSDev (April 2020)

Welcome to the first issue of "This Month in Rust OSDev". In these posts, we will give a regular overview of notable changes in the Rust operating system development community.

These posts are the successor of the "Status Update" posts on the "Writing an OS in Rust" blog. Instead of only focusing on the updates to the blog and the directly related crates, we try to give an overview of the full Rust OSDev ecosystem in this new series. This includes all the projects under the rust-osdev GitHub organization, relevant projects of other organizations, and also personal OS projects.

This series is openly developed on GitHub. Feel free to open pull requests there with content you would like to see in the next issue. If you find some issues on this page, please report them by creating an issue.

News and Blog Posts

We try to collect posts that are relevant to Rust-based OS development each month. Please create pull requests for any posts that you want linked in the next issue.

Project Updates

In this section, we give an overview of notable changes to the projects hosted under the rust-osdev organization.

x86_64

The x86_64 crate provides various abstractions for x86_64 systems, including wrappers for CPU instructions, access to processor-specific registers, and abstraction types for architecture-specific structures such as page tables and descriptor tables.

This month, we released version 0.10.0 of x86_64, which includes some breaking changes:

After v0.10.0, the following changes were merged:

Thanks to @m-ou-se, @tomaka, @haraldh, and @imtsuki for their contributions!

acpi and aml

The acpi repository contains crates for parsing the ACPI tables – data structures that the firmware of modern computers use to relay information about the hardware to the OS. The crate for parsing the static tables (acpi) was stabilised this month – while it needs more work to support the entire spec, it is now in the state where it can be integrated into a Rust kernel to provide useful information, and its overall architecture is unlikely to change in the near future.

The full set of changes is:

Thanks to @tomaka for their contribution and congratulations to the creator and maintainer @IsaacWoods on the 1.0 release!

bootloader

The bootloader crate implements a custom Rust-based bootloader for easy loading of 64-bit ELF executables. It received the following updates this month:

Thanks to @Freax13 and @realKennyStrawn93 for these changes!

Right now, @rybot666 and @phil-opp are working on a rewrite of the bootloader. The goal is to port the 16-bit and 32-bit stages from assembly to Rust, which should make the crate safer, more composable, and easier to understand for outsiders. Our progress is tracked in the Rewrite milestone.

bootimage

The bootimage tool allows the creation of bootable disk images for bootloader-based kernels. It also provides a runner executable for cargo to make cargo xrun and cargo xtest work using QEMU. In April, the crate received the following updates:

Thanks to @Freax13 for their contribution!

uart_16550

The uart_16550 crate provides basic support for serial port I/O for 16550-compatible UARTs. This month, the crate received support for serial input:

Thanks to @imtsuki for their contribution!

cargo-xbuild

The cargo-xbuild project provides cargo command wrappers to cross-compile the sysroot crates core and alloc. This month, we added a new environment variable to help debugging build errors:

uefi

The uefi crate provides abstractions for the UEFI standard that replaces the traditional BIOS on modern systems. This month, the crate received a new cargo feature to ignore logger errors:

New Projects

There are a number of new projects in the rust-osdev organization:

  • homepage: As you might have noticed by now, we have a new organization-level homepage at https://rust-osdev.com/. The homepage repository contains the source code for this website. Right now, it is still a work-in-progress and only contains the very minimum to host this post, but we plan to add more content soon.

    Note that we will create a branch for the upcoming May issue of "This Month in Rust OSDev". Please open pull requests for any content that you would like to see next month.

  • vga: The goal of the vga crate is to allow configuration of the VGA hardware. It already makes it possible to switch from a text-based buffer to a pixel-based framebuffer, which enables drawing of lines, geometric shapes, and even images. The library is created by @RKennedy9064.

  • ps2-mouse: The library provides a basic interface for interacting with a PS/2 mouse. It is also created by @RKennedy9064.

Personal Projects

In this section, we describe updates to personal projects that are not directly related to the rust-osdev organization. Feel free to create a pull request with the updates of your OS project for the next post.

IsaacWoods/pebble

(Section written by @IsaacWoods)

Pebble has been undergoing a bit of a reorganisation, in the interests of supporting a second architecture (ARM64). A hardware abstraction layer (HAL) has been introduced that abstracts away the platform-specifics of managing page tables, creating processes etc. so that the main kernel crate is now completely platform-independent.

I also wrote a little TFTP server for netbooting a Raspberry Pi 4 from a development machine. This makes iterating the kernel a lot easier because there's no need to write it to an SD card after every compile. In the next few weeks, I hope to clean this code up and publish it for use as both a library and CLI application, and maybe write a blog-post on the intricacies of netbooting the Pi.

rust-embedded/rust-raspberrypi-OS-tutorials

(Section written by @andre-richter)

The Operating System development tutorials in Rust on the Raspberry Pi project received the following updates recently:

  • Add tutorial 14: Exceptions Part 2: Peripheral IRQs.
    • We write device drivers for the two interrupt controllers on the Raspberry Pi 3 (Broadcom custom controller) and Pi 4 (ARM Generic Interrupt Controller v2, GICv2).
    • Modularity is ensured by interfacing everything through a trait named IRQManager.
    • Handling for our first peripheral IRQ is implemented: The UART's receive IRQ - one IRQ per received character.
  • Set chainloader relocation address to 32 MiB.
    • Enables booting on Pi3 A+ devices.
  • Run the chainloader natively on non-Linux Unix systems.
    • Adds experimental support for macOS and other Unix systems which have Ruby available.

phil-opp/blog_os

(Section written by @phil-opp)

Apart from a few minor fixes (thanks for all the contributions!), April was a quiet month for the "Writing an OS in Rust" project. I focused my work this month on the x86_64 library, the rewrite of the bootloader, and my job search instead. In this regard, I'm excited to announce that I have decided to do Rust-related freelance work for now, which will allow me to continue dedicating some of my time to open-source work.

Join Us?

Are you interested in Rust-based operating system development? Our rust-osdev organization is always open to new members and new projects. Just let us know if you want to join! A good way for getting in touch is our Zulip chat.

Comments