mirror of
https://github.com/phil-opp/blog_os.git
synced 2025-12-16 14:27:49 +00:00
00b3adfe821c035226fa625e0d7a9f83ad9770c0
385: First bits of the second edition r=phil-opp a=phil-opp This PR adds the first two posts for the second edition, “A Freestanding Rust Binary” and “A Minimal Rust Kernel”. The largest changes in comparison to the first edition are: - Instead of GRUB, we use our own [bootloader](https://github.com/rust-osdev/bootloader) (written in Rust) and our [bootimage](https://github.com/rust-osdev/bootimage) tool. This removes the dependencies on GRUB and `nasm`. Note that both tools are still experimental and might contain bugs. - Support for Windows and Mac: Without GRUB, there's nothing preventing us from building on Windows or Mac OS anymore! We added additional CI jobs at travis and appveyor to ensure that the project always builds on all three platforms. (At the moment, users still need to install LLD, but with the [LLVM 6 update of rustc](https://github.com/rust-lang/rust/pull/47828) we should have a builtin LLD soon.) - No assembly in the main posts. Instead, we're creating a `no_std` _executable_ and relying on our custom bootloader to perform the initial page mapping and the switch to long mode. - No linker script: Our bootloader loads the kernel in a clean address space, so we can just use the default executable layout and don't need a linker script. (This also means that users that want a higher half kernel just need to update the mapping in their linker script. However, I'm not sure if it's a good idea to add this to the blog. Maybe later, when we begin to run user programs.) These changes only land in “beta mode” with this PR, which means that they're not linked from the front page yet. We will do that in a follow up PR.
Blog OS
This repository contains the source code for the Writing an OS in Rust series at os.phil-opp.com.
Bare Bones
- A Minimal x86 Kernel (source code)
- Entering Long Mode (source code)
- Set Up Rust (source code)
- Printing to Screen (source code)
Memory Management
- Allocating Frames (source code)
- Page Tables (source code)
- Remap the Kernel (source code)
- Kernel Heap (source code)
Exceptions
Additional Resources
Building
You need to have nasm, grub-mkrescue, mformat (included in mtools), xorriso, qemu, a nightly Rust compiler, and xargo installed. Then you can run it using make run.
Please file an issue if you run into any problems.
License
The source code is dual-licensed under MIT or the Apache License (Version 2.0). This excludes the blog directory.
Description
Languages
HTML
96.5%
SCSS
1.5%
CSS
1.2%
JavaScript
0.4%
Python
0.2%