#x86 #bootloader

bin+lib bootloader

An experimental pure-Rust x86 bootloader

27 releases

✓ Uses Rust 2018 edition

0.4.0-alpha.2 Jan 29, 2019
0.3.12 Jan 8, 2019
0.3.11 Dec 9, 2018
0.3.7 Nov 25, 2018
0.2.0-alpha-001 Mar 29, 2018

#49 in Operating systems

Download history 132/week @ 2018-10-31 183/week @ 2018-11-07 206/week @ 2018-11-14 160/week @ 2018-11-21 255/week @ 2018-11-28 175/week @ 2018-12-05 211/week @ 2018-12-12 228/week @ 2018-12-19 125/week @ 2018-12-26 399/week @ 2019-01-02 242/week @ 2019-01-09 439/week @ 2019-01-16 499/week @ 2019-01-23 524/week @ 2019-01-30 665/week @ 2019-02-06

1,361 downloads per month

MIT/Apache

56KB
1.5K SLoC

Rust 844 SLoC // 0.1% comments Assembly 637 SLoC

bootloader

Build Status Join the chat at https://gitter.im/rust-osdev/bootloader

An experimental x86 bootloader written in Rust and inline assembly.

Written for the second edition of the Writing an OS in Rust series.

Design

TODO

Build and Run

You need a nightly Rust compiler and cargo xbuild.

Then you can run the builder executable with your kernel as argument:

cd builder
cargo run -- --kernel path/to/your/kernel/elf/file

This will output a file named bootimage.bin in the ../target/x86_64-bootloader/release folder.

You can run this file using QEMU:

qemu-system-x86_64 -drive format=raw,file=target/x86_64-bootloader/release/bootimage.bin

Or burn it to an USB drive:

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.

Features

The bootloader crate can be configured through some cargo features:

  • vga_320x200: This feature switches the VGA hardware to mode 0x13, a graphics mode with resolution 320x200 and 256 colors per pixel. The framebuffer is linear and lives at address 0xa0000.

Dependencies

~1MB
~11K SLoC