Skip to content

Latest commit

History

History
49 lines (33 loc) 路 2.39 KB

File metadata and controls

49 lines (33 loc) 路 2.39 KB

馃尃System Template

馃敡This is a template that can help you quickly build your own OS using rust.

馃HanabiOS is built on it.

馃檹I hope that everyone can use it to understand and learn the underlying principles of computers and the operation of operating systems without barriers!

馃摃Prepare For It

  1. 馃寵Use the following command to install the nightly version of rust,

    馃榾because we may need to use some features that only this version provides.

rustup install nightly
  1. 馃敡Then set the toolchain used in this project to nightly version of rust.

    馃敪In the future we can enable some experimental features by adding feature flags at the beginning of main.rs,

    馃槴such as adding #![feature(asm)] to enable experimental introverted compilation.

rustup override add nightly
  1. 馃敡Configure your target.json,

    馃摐here we only provide target.json to help you build the system for the x86_64 architecture platform.

    馃榾If you have other written target.json,

    welcome to submit it to us!

  2. 馃摝Install xbuild and bootimage,

    馃彮they can help you quickly build an operating system image.

rustup component add rust-src
rustup component add llvm-tools-preview
cargo install cargo-xbuild
cargo install bootimage
  1. 鉁岶rom now on you can directly start writing the code of the operating system!

    The entry point of this operating system is the _start function in main.rs!

馃弮鈥岯uild And Run

cargo bootimage --target target.json
qemu-system-x86_64 -drive format=raw,file=./target/target/debug/bootimage-os_template.bin

馃洃Precautions

  1. 馃槴You will not be able to use anything in std::,

    馃敤you need to construct your own api and call it.

  2. 馃摐The target.json given here can only help you build an operating system for the x86_64 platform,

    鉁峱lease write your own for other platforms!

    馃If you have target.json for other platforms,

    馃ぃplease submit it to us!

    鉂hank you!

馃憤Special Thanks

  1. OSDev (Wiki)
  2. Writing an OS in Rust