+++
title = "Updates in April 2019"
date = 2019-05-01
+++

Lot's of things changed in the _Writing an OS in Rust_ series in the past month, both on the blog itself and in the tools behind the scenes. This post gives an overview of the most important updates.

This post is an experiment inspired by [_This Week in Rust_] and similar series. The goal is to provide a resource that allows following the project more closely and staying up-to-date with the changes in the tools/libraries behind the scenes. If enough people find this useful, I will try to turn this in a semi-regular series.

[_This Week in Rust_]: https://this-week-in-rust.org/

## Bootloader

- The build system of the bootloader was rewritten to do a proper linking instead of appending the kernel executable manually like before. The relevant pull requests are [_Rewrite build system_](https://github.com/rust-osdev/bootloader/pull/51) and [_Updates for new build system_](https://github.com/rust-osdev/bootloader/pull/53). These (breaking) changes were released as version `0.5.0` ([changelog](https://github.com/rust-osdev/bootloader/blob/master/Changelog.md#050)).
- To make the bootloader work with future versions of `bootimage`, a [`package.metadata.bootloader.target` key was added](https://github.com/rust-osdev/bootloader/commit/33b8ce6059e90485c56883b23d4834d06ddfd517) to the `Cargo.toml` of the bootloader. This key specifies the name of the target JSON file, so that `bootimage` knows which `--target` argument to pass. This change was released as version `0.5.1` ([changelog](https://github.com/rust-osdev/bootloader/blob/master/Changelog.md#051))
- In the [_Version 0.6.0_](https://github.com/rust-osdev/bootloader/pull/55) pull request, the `#[cfg(not(test))]` attribute was removed from the `entry_point` macro. This makes it possible to use the macro together with `cargo xtest` and a custom test framework. Since the change is breaking, it was released as version `0.6.0` ([changelog](https://github.com/rust-osdev/bootloader/blob/master/Changelog.md#060)).

## Bootimage

- The [_Rewrite bootimage for new bootloader build system_](https://github.com/rust-osdev/bootimage/pull/34) pull request completely revamped the implementation of the crate. This was released as version `0.7.0`. See the [changelog](https://github.com/rust-osdev/bootimage/blob/master/Changelog.md#070) for a list of changes.
    - The rewrite had the unintended side-effect that `bootimage run` no longer ignored executables named `test-*`, so that an additional `--bin` argument was required for specifying which executable to run. To avoid breaking users of `bootimage test`, we yanked version `0.7.0`. After [fixing the issue](https://github.com/rust-osdev/bootimage/commit/8746c15bf326cf8438a4e64ffdda332fbe59e30d), version `0.7.1` was released ([changelog](https://github.com/rust-osdev/bootimage/blob/master/Changelog.md#071)).
- The [_New features for `bootimage runner`_](https://github.com/rust-osdev/bootimage/pull/36) pull request added support for additional arguments and various functionality for supporting `cargo xtest`. The changes were released as version `0.7.2` ([changelog](https://github.com/rust-osdev/bootimage/blob/master/Changelog.md#072)).
- An argument parsing bug that broke the new `cargo bootimage` subcommand on Windows was [fixed](https://github.com/rust-osdev/bootimage/commit/101eb43de403fd9f3cb3f044e2c263356d2c179a). The fix was released as version `0.7.3`.

## Blog OS

- Performed an [_Update to new bootloader 0.5.1 and bootimage 0.7.2_](https://github.com/phil-opp/blog_os/pull/575). Apart from requiring the `llvm-tools-preview` rustup component, this only changes version numbers.
- The [_Rewrite the linking section of "A Freestanding Rust Binary"_](https://github.com/phil-opp/blog_os/pull/577) pull request updated the first post to compile for the bare-metal `thumbv7em-none-eabihf` target instead of adding linker arguments for Linux/Windows/macOS.
- Since the blog came close to the free bandwidth limit of Netlify, we needed to [_Migrate from Netlify to Github Pages_](https://github.com/phil-opp/blog_os/pull/579) to avoid additional fees.
- With the [_Minimal Rust Kernel: Use a runner to make cargo xrun work_](https://github.com/phil-opp/blog_os/pull/582) pull request, we integrated the new `bootimage runner` into the blog.
    - The required updates to the `post-02` and `post-03` branches were performed in the [_Add `.cargo/config` file to post-02 branch_](https://github.com/phil-opp/blog_os/pull/585) and [_Merge the changes from #585 into the post-03 branch_](https://github.com/phil-opp/blog_os/pull/586) pull requests.
- In the [_New testing post_](https://github.com/phil-opp/blog_os/pull/584) pull request, we replaced the previous [_Unit Testing_](https://os.phil-opp.com/unit-testing/) and [_Integration Tests_](https://os.phil-opp.com/integration-tests/) with the new [_Testing_](https://os.phil-opp.com/testing/) post, which uses `cargo xtest` and a custom test framework for running tests.
    - The required updates for the `post-04` branch were performed in the [_Implement code for new testing post in post-xx branches_](https://github.com/phil-opp/blog_os/pull/587) pull request. The updates for the other `post-*` branches were pushed manually to avoid spamming the repository with pull requests. You can find a list of the commits in the pull request description.
- The [_Avoid generic impl trait parameters in BootInfoFrameAllocator_](https://github.com/phil-opp/blog_os/pull/595) pull request made the `BootInfoFrameAllocator` non-generic by reconstructing the frame iterator on every allocation. This way, we avoid using a `impl Trait` type parameter, which makes it [impossible to store the type in a `static`](https://github.com/phil-opp/blog_os/issues/593). See [rust-lang/rust#60367](https://github.com/rust-lang/rust/issues/60367) for the fundamental problem.
