This is my implementation of this step-by-step guide to write an OS in Rust. Mostly it's a self-education project, which involves a bit (a lot) of copy-paste with my useful (mirror) changes. Therefore you probably are about to move along.
NOTE: All the scripts have been written an tested for Linux (more specifically Kubuntu 17.10, should be OK with any Debian-based OS).
All the scripts support a --release
flag.
This flag builds a project in release mode but preserves debugging symbols.
curl
(rustup.sh
requires acurl
command (this is about to change) which is not installed on Ubuntu by default so you have to install it first.)make
gcc
(truth be told, It requiescc
, which is typically insatlled bygcc
package but you might already have it, i.e withtcc
,clang
, etc...)pkg-config
libssl-dev
(or find a package containing aopenssl.pc
file)
The easiest way is to follow instructions on official site. It offers you to run an install bash script:
$ curl https://sh.rustup.rs -sSf | sh
$ export PATH="${HOME}/.cargo/bin:${PATH}"
This command will install a rustup
tool.
We need a nightly channel:
$ rustup update nightly
and rust-src
component:
$ rustup component add rust-src
(This step will be omitted in future).
$ cargo install xargo
bootimage
is a
bootloader for my os.
Actually, it's a tool which makes a hard-drive image with OS image attached
back to this bootloader.
When the machine starts (all the rest is very much simplified,
just too lazy to explain, future me, I'm so sorry...)
it runs this bootloader which initializes hardware, finds a _start
symbol and jumps to it.
$ cargo install bootimage
Technically nothing forces me to use qemu
, virtualbox
should be OK,
but all the scripts use qemu-x86_64
so
sudo apt install qemu-x86 -y
$ ./build [--release]
$ ./run [--release]
$ ./debug [--release]