mirror of
https://github.com/phil-opp/blog_os.git
synced 2025-12-16 14:27:49 +00:00
78 lines
2.4 KiB
Markdown
78 lines
2.4 KiB
Markdown
# Blog OS (Paging Implementation)
|
|
|
|
[](https://github.com/phil-opp/blog_os/actions?query=workflow%3A%22Code%22+branch%3Apost-09)
|
|
|
|
This repository contains the source code for the [Paging Implementation][post] post of the [Writing an OS in Rust](https://os.phil-opp.com) series.
|
|
|
|
[post]: https://os.phil-opp.com/paging-implementation/
|
|
|
|
**Check out the [master branch](https://github.com/phil-opp/blog_os) for more information.**
|
|
|
|
## Building
|
|
|
|
This project requires a nightly version of Rust because it uses some unstable features. At least nightly _2020-07-15_ is required for building. You might need to run `rustup update nightly --force` to update to the latest nightly even if some components such as `rustfmt` are missing it.
|
|
|
|
You can build the project by running:
|
|
|
|
```
|
|
cargo build
|
|
```
|
|
|
|
To create a bootable disk image from the compiled kernel, you need to install the [`bootimage`] tool:
|
|
|
|
[`bootimage`]: https://github.com/rust-osdev/bootimage
|
|
|
|
```
|
|
cargo install bootimage
|
|
```
|
|
|
|
After installing, you can create the bootable disk image by running:
|
|
|
|
```
|
|
cargo bootimage
|
|
```
|
|
|
|
This creates a bootable disk image in the `target/x86_64-blog_os/debug` directory.
|
|
|
|
Please file an issue if you have any problems.
|
|
|
|
## Running
|
|
|
|
You can run the disk image in [QEMU] through:
|
|
|
|
[QEMU]: https://www.qemu.org/
|
|
|
|
```
|
|
cargo run
|
|
```
|
|
|
|
[QEMU] and the [`bootimage`] tool need to be installed for this.
|
|
|
|
You can also write the image to an USB stick for booting it on a real machine. On Linux, the command for this is:
|
|
|
|
```
|
|
dd if=target/x86_64-blog_os/debug/bootimage-blog_os.bin of=/dev/sdX && sync
|
|
```
|
|
|
|
Where `sdX` is the device name of your USB stick. **Be careful** to choose the correct device name, because everything on that device is overwritten.
|
|
|
|
## Testing
|
|
|
|
To run the unit and integration tests, execute `cargo xtest`.
|
|
|
|
## License
|
|
|
|
Licensed under either of
|
|
|
|
- Apache License, Version 2.0 ([LICENSE-APACHE](LICENSE-APACHE) or
|
|
http://www.apache.org/licenses/LICENSE-2.0)
|
|
- MIT license ([LICENSE-MIT](LICENSE-MIT) or http://opensource.org/licenses/MIT)
|
|
|
|
at your option.
|
|
|
|
Note that this only applies to this git branch, other branches might be licensed differently.
|
|
|
|
### Contribution
|
|
|
|
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.
|