Updates in April 2019
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.
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 and Updates for new build system. These (breaking) changes were released as version
0.5.0(changelog). - To make the bootloader work with future versions of
bootimage, apackage.metadata.bootloader.targetkey was added to theCargo.tomlof the bootloader. This key specifies the name of the target JSON file, so thatbootimageknows which--targetargument to pass. This change was released as version0.5.1(changelog) - In the Version 0.6.0 pull request, the
#[cfg(not(test))]attribute was removed from theentry_pointmacro. This makes it possible to use the macro together withcargo xtestand a custom test framework. Since the change is breaking, it was released as version0.6.0(changelog).
Bootimage
- The Rewrite bootimage for new bootloader build system pull request completely revamped the implementation of the crate. This was released as version
0.7.0. See the changelog for a list of changes.- The rewrite had the unintended side-effect that
bootimage runno longer ignored executables namedtest-*, so that an additional--binargument was required for specifying which executable to run. To avoid breaking users ofbootimage test, we yanked version0.7.0. After fixing the issue, version0.7.1was released (changelog).
- The rewrite had the unintended side-effect that
- The New features for
bootimage runnerpull request added support for additional arguments and various functionality for supportingcargo xtest. The changes were released as version0.7.2(changelog). - An argument parsing bug that broke the new
cargo bootimagesubcommand on Windows was fixed. The fix was released as version0.7.3.
Blog OS
- Performed an Update to new bootloader 0.5.1 and bootimage 0.7.2. Apart from requiring the
llvm-tools-previewrustup component, this only changes version numbers. - The Rewrite the linking section of “A Freestanding Rust Binary” pull request updated the first post to compile for the bare-metal
thumbv7em-none-eabihftarget 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 to avoid additional fees.
- With the Minimal Rust Kernel: Use a runner to make cargo xrun work pull request, we integrated the new
bootimage runnerinto the blog.- The required updates to the
post-02andpost-03branches were performed in the Add.cargo/configfile to post-02 branch and Merge the changes from #585 into the post-03 branch pull requests.
- The required updates to the
- In the New testing post pull request, we replaced the previous Unit Testing and Integration Tests with the new Testing post, which uses
cargo xtestand a custom test framework for running tests.- The required updates for the
post-04branch were performed in the Implement code for new testing post in post-xx branches pull request. The updates for the otherpost-*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 required updates for the
- The Avoid generic impl trait parameters in BootInfoFrameAllocator pull request made the
BootInfoFrameAllocatornon-generic by reconstructing the frame iterator on every allocation. This way, we avoid using aimpl Traittype parameter, which makes it impossible to store the type in astatic. See rust-lang/rust#60367 for the fundamental problem.