Rust OSDev Operating System Development in Rust

This Month in Rust OSDev: January 2024

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

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 or using our comment form at the bottom of this page.

Announcements, News, and Blog Posts

Here we collect news, blog posts, etc. related to OS development in Rust.

Infrastructure and Tooling

In this section, we collect recent updates to rustc, cargo, and other tooling that are relevant to Rust OS development.

rust-osdev Projects

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

x86_64

Maintained by @phil-opp, @josephlr, and @Freax13

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.

We merged the following PR this month:

We also merged the following changes into the next branch, which will be released as v0.15 soon:

bootloader

Maintained by @phil-opp

The bootloader crate implements a custom Rust-based bootloader for easy loading of 64-bit ELF executables. This month, we merged the following nightly fixes:

acpi

Maintained by @IsaacWoods

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. We merged the following changes this month:

Thanks to @Spartan2909 for their contribution!

uefi-rs

Maintained by @GabrielMajeri, @nicholasbishop, and @phip1611

The uefi-rs crate provides safe and performant wrappers for UEFI, the successor to the BIOS. We merged the following PRs this month:

Thanks to @gurry for their contribution!

Other Projects

In this section, we describe updates to Rust OS 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.

phip1611/phipsboot

(Section written by @phip1611)

I'd like to announce my project PhipsBoot. 🎉 PhipsBoot is a relocatable x86_64 bootloader for legacy x86_64 boot written in Rust and assembly. It is intended to be loaded by GRUB via Multiboot2, where it uncovers its main benefit: It is relocatable in physical memory without having relocation information in the ELF! It outsources a lot of complexity to GRUB which also better fits into the ecosystem and makes it easier usable. The README contains more background about why I have chosen to use GRUB instead of writing my own stage 1 bootloader.

This project combines a lot of toolchain and binary knowledge and experience I collected and gained in recent years about legacy x86_64 boot. The main contribution IMHO is how the binary is assembled and that the thing boots with all the properties described in the README, but not the high-level functionality itself.

I am especially proud of the well-commented structure of the assembly files. For example the whole page-table mappings are done IMHO very nicely even tho it is assembly language. Also, I think it turned out quite cool how I configured the linker script. I hope this can be a learning resource for others!

TL;DR: It is a learning ground and a reference for how to solve the relocation problem with Multiboot2 and GRUB, as GRUB is not able to load DYN ELFs.

You have multiple options for testing it out:

  • $ cloud-hypervisor --debug-console file=log.txt --kernel ./build/phipsboot.elf64 (using Xen PVH)
  • $ qemu-system-x86_64 -kernel ./build/phipsboot.elf32 -debugcon stdio (using Multiboot 1)

phil-opp/blog_os

(Section written by @phil-opp)

We merged the following changes to the Writing an OS in Rust blog this month:

Thanks to @acyanbird, @proudmuslim-dev, and @lachsdachs for their contributions!

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