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.
- This Month in Redox
- x86 Kernel Development & Relocatable Binaries – What I learned about Toolchains and Relocatable Code
- This post is roughly a summary of the obscure knowledge Philipp learned about toolchains and relocatable code in the last couple of years with a focus on relocatable x86_64 multiboot2 kernels for legacy BIOS boot.
- The Embedded Rustacean Issue 11 and Issue 12
- FOSDEM 2024
- Making an RISC-V OS (Part 1): Project Setup
- Looking for people to help out with CharlotteOS (Beginners are welcome!)
- The Linux kernel now contains the first useful component written in Rust
- BPF Opens Door to Linux Extensible Scheduling (Maybe with Rust!)
Infrastructure and Tooling
In this section, we collect recent updates to
cargo, and other tooling that are relevant to Rust OS development.
- Stabilize single-field offset_of
- LLVM 18 x86 data layout update
- cargo: Strip debuginfo when debuginfo is not requested
In this section, we give an overview of notable changes to the projects hosted under 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
nextbranch with latest changes from
- remove deprecated from_bits_unchecked functions
- Update docs to clarify new
Maintained by @phil-opp
bootloader crate implements a custom Rust-based bootloader for easy loading of 64-bit ELF executables. This month, we merged the following nightly fixes:
- Fix data layout for stage 3 target
- [v0.9] Fix data layout for
- Released as v0.9.24
Maintained by @IsaacWoods
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 crate provides safe and performant wrappers for UEFI, the successor to the BIOS. We merged the following PRs this month:
- Fix broken UEFI spec link in uefi-raw README.md
- book: Add a page on building drivers
- book: Add a link to rust's UEFI target docs
- uefi-raw: Add LoadFileProtocol and LoadFile2Protocol
Thanks to @gurry for their contribution!
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.
(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)
(Section written by @phil-opp)
We merged the following changes to the Writing an OS in Rust blog this month:
- Update data layouts in target specifications
- change some format errors for chinese edition minimal kernel
- fix testing and paging introduction chapter errors in zh-CN translation
- [Edition 3] fix a lil typo
- [Edition 3] Fix typos in code for
embedded_graphicscrate in chapter 3
- [Edition 3] Fix embedded_graphics code + typo in chapter 3
- [Edition 3] Fix typo in chapter 2
- [Edition 3] Fix formatting in chapter 2
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 gitter channel.