Skip to content

Commit 6543906

Browse files
committed
Update Readme
1 parent 2180261 commit 6543906

File tree

1 file changed

+24
-14
lines changed

1 file changed

+24
-14
lines changed

README.md

Lines changed: 24 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,37 @@
1-
# rustboot
1+
# bootloader
22

3-
[![Join the chat at https://gitter.im/rust-osdev/bootloader](https://badges.gitter.im/rust-osdev/bootloader.svg)](https://gitter.im/rust-osdev/bootloader?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
3+
[![Build Status](https://travis-ci.org/rust-osdev/bootloader.svg?branch=master)](https://travis-ci.org/rust-osdev/bootloader) [![Join the chat at https://gitter.im/rust-osdev/bootloader](https://badges.gitter.im/rust-osdev/bootloader.svg)](https://gitter.im/rust-osdev/bootloader?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
44

5-
An experimental pure-Rust x86 bootloader for the [planned second edition](https://github.com/phil-opp/blog_os/issues/360) of the [Writing an OS in Rust](https://os.phil-opp.com) series.
5+
An experimental x86 bootloader written in Rust and inline assembly.
66

7-
**This is still work in progress**.
7+
Written for the [second edition](https://github.com/phil-opp/blog_os/issues/360) of the [Writing an OS in Rust](https://os.phil-opp.com) series.
88

9-
The idea is to build the kernel as a `no_std` longmode executable and then build the bootloader with the kernel [ELF](https://en.wikipedia.org/wiki/Executable_and_Linkable_Format) file in `kernel.bin`. The output is a flat binary disk image (including a basic [MBR](https://en.wikipedia.org/wiki/Master_boot_record)) that can be run in [QEMU](https://www.qemu.org/) or burned to an USB flash drive (CDs require a different kind of bootloader, which is not supported at the moment). The plan is to create a custom tool (or cargo subcommand) that performs these steps automatically.
9+
## Design
10+
11+
TODO
1012

1113
## Build and Run
12-
You need a nightly [Rust](https://www.rust-lang.org) compiler, [xargo](https://github.com/japaric/xargo), [objcopy](https://sourceware.org/binutils/docs/binutils/objcopy.html) (or a similar tool), and [QEMU](https://www.qemu.org/) (for running it).
14+
You need a nightly [Rust](https://www.rust-lang.org) compiler and [cargo xbuild](https://github.com/rust-osdev/cargo-xbuild).
15+
16+
Then you can run the `builder` executable with your kernel as argument:
17+
18+
```
19+
cd builder
20+
cargo run -- --kernel path/to/your/kernel/elf/file
21+
```
1322

14-
### Mac OS
23+
This will output a file named `bootimage.bin` in the `../target/x86_64-bootloader/release` folder.
1524

16-
If you are building on Mac OS and get a error saying `ld.bfd not found` you first need to [cross compile binutils](https://os.phil-opp.com/cross-compile-binutils) and then adjust
17-
the linker name in the `x86_64-bootloader.json` file. The reason for this is the default rust LLVM linker doesn't support some features this project needs.
25+
You can run this file using [QEMU](https://www.qemu.org/):
1826

19-
After doing that continue with the instructions for Linux.
27+
```
28+
qemu-system-x86_64 -drive format=raw,file=target/x86_64-bootloader/release/bootimage.bin
29+
```
2030

21-
### Linux
31+
Or burn it to an USB drive:
2232

2333
```
24-
> RUST_TARGET_PATH=$(pwd) xargo build --target x86_64-bootloader --release
25-
> objcopy -O binary -S target/x86_64-bootloader/release/bootloader bootimage.bin
26-
> qemu-system-x86_64 -hda bootimage.bin -d int -s
34+
dd if=target/x86_64-blog_os/debug/bootimage-blog_os.bin of=/dev/sdX && sync
2735
```
36+
37+
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.

0 commit comments

Comments
 (0)