September 14th, 2024

Writing an OS in Rust

The GitHub repository for the _Writing an OS in Rust_ series offers structured source code for each blog post, covering key OS development topics in Rust, with links to the latest content.

Read original articleLink Icon
AppreciationAdmirationGratitude
Writing an OS in Rust

The GitHub repository for the _Writing an OS in Rust_ series provides the source code corresponding to each blog post in a structured format. Each post is represented by a separate branch named `post-XX`, facilitating easy navigation through the tutorial content. The series covers essential topics in operating system development using Rust, including creating a freestanding Rust binary, building a minimal kernel, implementing VGA text mode, and managing memory through paging and heap allocation, as well as multitasking with async/await. Additionally, the repository contains a section for first edition posts, which, while outdated, may still offer valuable insights. The project is licensed under the Apache License, Version 2.0, or the MIT license, with specific terms for the `blog/content` folder. Users can access the latest post's source code and the complete blog series through provided links.

- The repository is organized with branches for each blog post.

- It covers various operating system development topics in Rust.

- There are sections for both current and outdated tutorial posts.

- The project is available under Apache 2.0 or MIT licenses.

- Users can find links to the latest source code and the full blog series.

AI: What people are saying
The comments reflect a strong appreciation for the _Writing an OS in Rust_ series and its impact on learning Rust and OS development.
  • Many users found the series enlightening and beneficial for understanding both Rust and operating systems.
  • Several commenters expressed hope for future editions or projects from the author, Phil.
  • Users shared their own projects inspired by the series, highlighting its influence on the OS development community.
  • There is a consensus on the quality of the content, with specific praise for the clarity of explanations.
  • Some comments discuss the broader implications of Rust in OS development, particularly regarding memory safety.
Link Icon 26 comments
By @chucksmash - 8 months
I completed the second edition years ago and found it illuminating. It's very well done! The explanations pertaining to OS dev are nice but it was also a useful artifact for learning more Rust after having gone through the Rust book. The author had a good grasp of the idiom of the language, so seeing how he expressed certain things in code vis a vis how I would have done was educational. The blog's explanation of how futures are implemented in Rust was especially a highlight[0], and I think it's the best I've seen on that topic anywhere.

I hope Phil will find the inspiration to come back and work on the EFI-based third edition again. AFAICT, (based on commits to the git branches) that has stalled. I was a GitHub sponsor for about a year until my CC expired and was always bummed to see it left out of the "This Month In Rust OSDev" posts.

Anyway, the second edition is still a great way to spend a weekend's dev time and I appreciate all the hard work that clearly went into it. Thanks Phil!

[0]: https://os.phil-opp.com/async-await/#async-await-in-rust

By @vinc - 8 months
I started working on MOROS[1][2] after completing the tutorial 5 years ago, and I cannot recommend it enough for anyone interested in Rust and osdev. Phil put a lot of work into it, and it shows! The project covers a lot, and after that there's the osdev wiki[3] to keep going.

[1]: http://moros.cc

[2]: https://github.com/vinc/moros

[3]: https://wiki.osdev.org

By @jayd3e - 8 months
Funny, I found this today after doing a deep dive on Rust and OS development. I was in awe at the quality of this content. You come out of it not only learning so much about the history and design of operating systems, but you start to pick up elements of Rust as well. Phil did an incredible job on this.
By @nailer - 8 months
I just came back from Rustconf and it seems there’s about five or so major OS releases, particularly focused around real time. Not all are open source though.
By @Levitating - 8 months
I especially recommend the original edition of these posts. For me the current edition does way too much hand holding, taking care of the entire bootloading process with a specialized crate.
By @ramon156 - 8 months
This source got me started with Rust back in 2021, and I'm very grateful that this exists.
By @jamesmunns - 8 months
Phil's writing on OS development is always a wonderful read.
By @guofoo - 8 months
He's giving a talk at next month's GOSIM conference. https://china2024.gosim.org/speakers#philipp-oppermann It would be nice to be able to talk to him in person.
By @Beijinger - 8 months
https://harvey-os.org/ (Retired) The team now works on this: https://github.com/r9os/r9
By @HenryBemis - 8 months
(not a professional coder) "writing an X on Y" brings in my mind the meme of Ryan Reynolds "But why?" [0]. If it is for training purposes, then by all means, go nuts!! The more one codes, the better.

[0]: https://screenrant.com/ryan-reynolds-but-why-gif-harold-kuma...

Sidenote on "MOROS" - cool project/page!

By @azhenley - 8 months
Another good resource is Making a RISC-V OS using Rust

https://osblog.stephenmarz.com/

By @amelius - 8 months
Is this project about writing a kernel or an entire OS including graphical shell, etc.?
By @assanineass - 8 months
Jokingly thought it was another one of those “I rewrote it in Rust” moments. Cool post
By @3rdworldeng - 8 months
Nice job !
By @segasuperstar - 8 months
You lost me at branch per post
By @gxt - 8 months
We shouldn't write an OS in rust. We should create a data platform on which we can run DML/DDL with an SSMS++ automatic frontend.
By @xiaodai - 8 months
Makes sense but what if there are bugs in llvm? U r still exposed. So need a rust version of llvm and then rust can be self hosted
By @xyst - 8 months
The pool of operating system penetration testers will be absolutely devastated if a rust OS becomes mainstream.

Most, if not all, vulnerabilities are related to lack of memory safety.

Well, guess there’s always the application/user space.