[HN Gopher] Writing an OS in Rust
___________________________________________________________________
Writing an OS in Rust
Author : udev4096
Score : 206 points
Date : 2024-09-14 15:19 UTC (7 hours ago)
(HTM) web link (github.com)
(TXT) w3m dump (github.com)
| ramon156 wrote:
| This source got me started with Rust back in 2021, and I'm very
| grateful that this exists.
| 3rdworldeng wrote:
| Nice job !
| jamesmunns wrote:
| Phil's writing on OS development is always a wonderful read.
| nailer wrote:
| 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.
| jamesmunns wrote:
| Tock-OS, Oxid-OS (the safety version of Tock-OS, like
| freertos/safertos), and Hubris (from Oxide Computers) are the
| main three RTOSs, Embassy and RTIC are common frameworks (but
| not classic RTOSs) used for scheduling and resource management
| on bare metal systems. There are some more niche or non-public
| ones as well.
|
| For more classic OSs (not real time), Redox is the main one, as
| well as a lot of research/experimental/teaching ones, including
| the Blog OS from this guide/submission.
| lasiotus wrote:
| Motor OS
| junon wrote:
| Working on one over at github.com/oro-os but haven't proven
| efficacy of the design yet, so haven't announced it. Just if
| you want something to follow.
| segasuperstar wrote:
| You lost me at branch per post
| bigstrat2003 wrote:
| This is just the source code for the blog. It is readable in
| normal fashion at os.phil-opp.com.
| vinc wrote:
| 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
| codethief wrote:
| Re [1]: No TLS? :(
| vinc wrote:
| Good question, there's no TLS support inside MOROS so its
| website must be available over HTTP, especially when I self-
| host it. That's not the case currently so I could also have
| HTTPS but I'm using Dokku and last time I tried the Let's
| Encrypt plugin would redirect HTTP to HTTPS automatically,
| which is annoying.
|
| Edit: I set up CloudFlare in front of the server and there's
| now a working HTTPS version along with the HTTP version
| accessible from inside MOROS. This should also work when I'll
| use again the web server inside the OS. Thanks for prompting
| me to look into it!
| bigstrat2003 wrote:
| There's nothing sensitive, therefore there is no reason to
| use TLS.
| Levitating wrote:
| 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.
| ok_dad wrote:
| I like that there's a way to skip all that boot loading stuff,
| your comment made me want to actually try this. I want to build
| a fun little OS for myself but I hate the part where you have
| to do magical incantations to get to a decent machine state to
| do stuff in. Not that it's a bad thing, everybody likes
| different stuff. Thanks for mentioning this!
| xyst wrote:
| 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.
| sureglymop wrote:
| Regarding your last sentence, if they move on to AI imposed
| security vulnerabilities there is probably a lot of bread and
| butter to be made there.
| azhenley wrote:
| Another good resource is Making a RISC-V OS using Rust
|
| https://osblog.stephenmarz.com/
| jayd3e wrote:
| 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.
| assanineass wrote:
| Jokingly thought it was another one of those "I rewrote it in
| Rust" moments. Cool post
| chucksmash wrote:
| 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
___________________________________________________________________
(page generated 2024-09-14 23:00 UTC)