|
| 1 | ++++ |
| 2 | +title = "This Month in Rust OSDev (February 2021)" |
| 3 | +date = 2021-03-08 |
| 4 | + |
| 5 | +[extra] |
| 6 | +month = "February 2021" |
| 7 | +authors = [ |
| 8 | + "phil-opp", |
| 9 | + # add yourself here |
| 10 | +] |
| 11 | ++++ |
| 12 | + |
| 13 | +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. |
| 14 | + |
| 15 | +<!-- more --> |
| 16 | + |
| 17 | +This series is openly developed [on GitHub](https://github.com/rust-osdev/homepage/). 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](https://github.com/rust-osdev/homepage/issues/new) or using our [_comment form_](#comment-form) at the bottom of this page. |
| 18 | + |
| 19 | +<!-- |
| 20 | + This is a draft for the upcoming "This Month in Rust OSDev (February 2021)" post. |
| 21 | + Feel free to create pull requests against the `next` branch to add your |
| 22 | + content here. |
| 23 | + Please take a look at the past posts on https://rust-osdev.com/ to see the |
| 24 | + general structure of these posts. |
| 25 | +--> |
| 26 | + |
| 27 | +## Project Updates |
| 28 | + |
| 29 | +In this section, we give an overview of notable changes to the projects hosted under the [`rust-osdev`] organization. |
| 30 | + |
| 31 | +[`rust-osdev`]: https://github.com/rust-osdev/about |
| 32 | + |
| 33 | + |
| 34 | +### [`uefi-rs`](https://github.com/rust-osdev/uefi-rs) |
| 35 | + |
| 36 | +The `uefi` crate provides safe and performant wrappers for [UEFI](https://en.wikipedia.org/wiki/Unified_Extensible_Firmware_Interface), the successor to the BIOS. In February, we merged the following changes: |
| 37 | + |
| 38 | +- [Add helper function for retrieving the boot filesystem](https://github.com/rust-osdev/uefi-rs/pull/201) |
| 39 | +- [Add support for the block I/O protocol](https://github.com/rust-osdev/uefi-rs/pull/200) |
| 40 | +- [Update `x86_64` dependency to version 0.13.2](https://github.com/rust-osdev/uefi-rs/pull/198) (to fix nightly breakage) |
| 41 | +- [Fix some issues with the documentation of the `DevicePath` and `LoadedImage` protocols](https://github.com/rust-osdev/uefi-rs/pull/193) |
| 42 | + |
| 43 | +Thanks to [@gil0mendes](https://github.com/gil0mendes), [@sreehax](https://github.com/sreehax), and [@avirule](https://github.com/avirule) for their contributions! |
| 44 | + |
| 45 | +### [`x86_64`](https://github.com/rust-osdev/x86_64) |
| 46 | + |
| 47 | +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. |
| 48 | + |
| 49 | +In February, the unstable [`const_in_array_repeat_expressions` feature](https://github.com/rust-lang/rust/issues/49147) was [removed](https://github.com/rust-lang/rust/pull/80404) from Rust because it [implicitly changed drop behavior](https://github.com/rust-lang/rust/issues/49147#issuecomment-766372999). This lead to a compile error of the `x86_64` crate because it still had that feature enabled. Interestingly, we no longer needed this feature after [#175](https://github.com/rust-osdev/x86_64/pull/175) (and an [accidental stabilization](https://github.com/rust-lang/rust/pull/79270) in Rust), so the fix was quite simple: |
| 50 | + |
| 51 | +- [Fix build on latest nightly](https://github.com/rust-osdev/x86_64/pull/230) <span class="gray">(published as `v0.13.2`)</span> |
| 52 | + |
| 53 | +Thanks to [@KernelFreeze](https://github.com/KernelFreeze) for this contribution! |
| 54 | + |
| 55 | +### [`bootloader`](https://github.com/rust-osdev/bootloader) |
| 56 | + |
| 57 | +The `bootloader` crate implements a custom Rust-based bootloader for easy loading of 64-bit ELF executables. This month, we merged two small updates to fix build errors and warnings on newer Rust nightlies: |
| 58 | + |
| 59 | +- [Fix build on latest nightly by updating x86_64 to v0.13.2](https://github.com/rust-osdev/bootloader/pull/135) <span class="gray">(published as `v0.9.12`)</span> |
| 60 | +- [Fix "panic message is not a string literal"](https://github.com/rust-osdev/bootloader/pull/138) <span class="gray">(published as `v0.9.14`)</span> |
| 61 | + |
| 62 | +Thanks to [@dspencer12](https://github.com/dspencer12) for their contribution! |
| 63 | + |
| 64 | +There was also some more progress on the `uefi` branch, which contains the upcoming new bootloader version with UEFI support: |
| 65 | + |
| 66 | +- [Improve reporting of config parse errors](https://github.com/rust-osdev/bootloader/commit/d55f1c87c34e8bba61adc6abffa78ba431aac69f) |
| 67 | +- [Add a test for the `map-physical-memory` config key](https://github.com/rust-osdev/bootloader/commit/6a0fd74ecb052ef3f1fa7ce3e556c895c66dfc4e) |
| 68 | +- Add more checks for the given `--kernel-manifest` path: it should [point to a file named `Cargo.toml`](https://github.com/rust-osdev/bootloader/commit/38fd48622c3a6f22d64a65528a56d2471168cb78), [exist](https://github.com/rust-osdev/bootloader/commit/9a8ace78650d75189d567618a90a4f039525f369), and the referenced `Cargo.toml` should [depend on the bootloader crate](https://github.com/rust-osdev/bootloader/commit/873351c575bdefd1c6c78b27de2bc0494698c0d5). |
| 69 | + |
| 70 | +The UEFI rewrite is almost done, but we still need to update the docs, improve the configurability of the framebuffer, and add more testing. |
| 71 | + |
| 72 | +### [`uart_16550`](https://github.com/rust-osdev/uart_16550) |
| 73 | + |
| 74 | +The `uart_16550` crate provides basic support for serial port I/O for 16550-compatible UARTs. Since the crate also depends on `x86_64`, it needed a dependency update to fix the mentioned build error on the latest nightly: |
| 75 | + |
| 76 | +- [Fix build on nightly by updating to x86_64 v0.13.2](https://github.com/rust-osdev/uart_16550/pull/12) <span class="gray">(published as `v0.2.12`)</span> |
| 77 | + |
| 78 | +### [`vga`](https://github.com/rust-osdev/vga) |
| 79 | + |
| 80 | +The work-in-progress `vga` crate allows the configuration of the VGA hardware, e.g. switching from text-based mode to a pixel-based graphics mode. The nightly build error of `x86_64` also affected this crate, so it needed a fix too: |
| 81 | + |
| 82 | +- [fix: should now compile](https://github.com/rust-osdev/vga/pull/20) <span class="gray">(published as `v0.2.6`)</span> |
| 83 | + |
| 84 | +Thanks to [@Pollux3737](https://github.com/Pollux3737) for this contribution! |
| 85 | + |
| 86 | +## Personal Projects |
| 87 | + |
| 88 | +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](https://github.com/rust-osdev/homepage/pulls) with the updates of your OS project for the next post. |
| 89 | + |
| 90 | +### [`phil-opp/blog_os`](https://github.com/phil-opp/blog_os) |
| 91 | + |
| 92 | +<span class="gray">(Section written by [@phil-opp](https://github.com/phil-opp))</span> |
| 93 | + |
| 94 | +The [_Writing an OS in Rust_](https://os.phil-opp.com/) blog received the following updates this month: |
| 95 | + |
| 96 | +- [Translate post-08 to Persian](https://github.com/phil-opp/blog_os/pull/913) |
| 97 | +- [Add ja translation for double faults](https://github.com/phil-opp/blog_os/pull/917) |
| 98 | +- [Update post to use x86_64 v0.13.2](https://github.com/phil-opp/blog_os/pull/920) |
| 99 | +- [Remove note on builtin memory optimizations](https://github.com/phil-opp/blog_os/pull/932) |
| 100 | + - [Remove it from Japanese translation as well](https://github.com/phil-opp/blog_os/pull/935) |
| 101 | +- [Minor fix in post 6](https://github.com/phil-opp/blog_os/pull/928) |
| 102 | +- [Fix typo](https://github.com/phil-opp/blog_os/pull/927) |
| 103 | + |
| 104 | +Thanks to [@MHBahrampour](https://github.com/MHBahrampour), [@garasubo](https://github.com/garasubo), [@dspencer12](https://github.com/dspencer12), [@toku-sa-n](https://github.com/toku-sa-n), and [@16yuki0702](https://github.com/16yuki0702) for their contributions! |
| 105 | + |
| 106 | +I also made some progress on the upcoming third edition. Some potentially interesting commits are: |
| 107 | + |
| 108 | +- [Finish first draft of 'Minimal Kernel' post](https://github.com/phil-opp/blog_os/commit/acb478c0b51b0cdf2124772aca00502f15d6cbb6) |
| 109 | +- [Simplify boot crate](https://github.com/phil-opp/blog_os/commit/aaae70974f180321ab8bc25eca2052f98695b39a) |
| 110 | +- [Add boilerplate for new 'UEFI Booting' post](https://github.com/phil-opp/blog_os/commit/c2fe9960a743bcb32d5a41e5a02e0f84266d950a) |
| 111 | +- [Explain how to create minimal UEFI app](https://github.com/phil-opp/blog_os/commit/033be9ac25a146eb4819d9c6799bd6362d97e036) |
| 112 | +- [Explain how to create FAT filesystem and GPT disk image](https://github.com/phil-opp/blog_os/commit/83be6c7868f269084ebe4758ad82db9d7f187061) |
| 113 | + |
| 114 | +### [`cdrzewiecki/celos`](https://gitlab.com/cdrzewiecki/celos) |
| 115 | + |
| 116 | +<span class="gray">(Section written by [@drzewiec](https://github.com/drzewiec))</span> |
| 117 | + |
| 118 | +I have been working on an OS following along with [@phil-opp](https://github.com/phil-opp)'s tutorial series for a while, but recently decided I would rework my OS based on the first edition of the blog (since I preferred to use GRUB as my bootloader). This is the first progress I have to share on CelOS, and indeed the first time I've published one of these updates in general. |
| 119 | + |
| 120 | +In February, I made a lot of great progress on CelOS. I have the complete physical memory (plus the framebuffer provided by GRUB) mapped to virtual memory, and a pixel-based framebuffer working with text output. Things are not very optimized right now (for one thing I'm stretching the `font8x8` font into 8x12), but this is a great first step that I can build on. Next planned steps are: |
| 121 | + |
| 122 | +* Move the kernel in virtual memory so that it occupies the higher half of the 48-bit address space |
| 123 | +* Create some page fault interrupt handling so that the kernel can at least attempt to handle page faults (rather than triple faulting as it does now) |
| 124 | +* Set up memory allocation for the kernel, to get heap allocation |
| 125 | +* Once heap allocation is in place, utilize some existing crate to handle TrueType fonts so that text will look a bit nicer on screen |
| 126 | + |
| 127 | +I probably won't get all of that done in March, but those are my planned next steps. Thanks to this great community and to [@phil-opp](https://github.com/phil-opp) for being so helpful in the osdev journey! |
| 128 | + |
| 129 | +## Join Us? |
| 130 | + |
| 131 | +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](https://gitter.im/rust-osdev/Lobby). |
0 commit comments