You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
53: Updates for new build system r=phil-opp a=phil-opp
Update the documentation for the new build system and add an `example-kernel` that provides an easy way to try the `bootloader`.
Builds upon #51.
Co-authored-by: Philipp Oppermann <[email protected]>
Copy file name to clipboardexpand all lines: Changelog.md
+6
Original file line number
Diff line number
Diff line change
@@ -1,3 +1,9 @@
1
+
## Breaking
2
+
3
+
- Change the build system: Use a build script that expects a `KERNEL` environment variable instead of using a separate `builder` executable as before. See [#51](https://github.com/rust-osdev/bootloader/pull/51) and [#53](https://github.com/rust-osdev/bootloader/pull/53) for more information.
4
+
- This makes the bootloader incompatible with versions `0.6.*` and earlier of the `bootimage` tool.
5
+
- The bootloader also requires the `llvm-tools-preview` rustup component now.
Copy file name to clipboardexpand all lines: README.md
+46-10
Original file line number
Diff line number
Diff line change
@@ -10,28 +10,50 @@ Written for the [second edition](https://github.com/phil-opp/blog_os/issues/360)
10
10
11
11
TODO
12
12
13
-
## Build and Run
14
-
You need a nightly [Rust](https://www.rust-lang.org) compiler and [cargo xbuild](https://github.com/rust-osdev/cargo-xbuild).
13
+
## Requirements
15
14
16
-
Then you can run the `builder` executable with your kernel as argument:
15
+
You need a nightly [Rust](https://www.rust-lang.org) compiler and [cargo xbuild](https://github.com/rust-osdev/cargo-xbuild). You also need the `llvm-tools-preview` component, which can be installed through `rustup component add llvm-tools-preview`.
16
+
17
+
## Build
18
+
19
+
The simplest way to use the bootloader is in combination with the [bootimage](https://github.com/rust-osdev/bootimage) tool. With the tool installed, you can add a normal cargo dependency on the `bootloader` crate to your kernel and then run `bootimage build` to create a bootable disk image. You can also execute `bootimage run` to run your kernel in [QEMU](https://www.qemu.org/) (needs to be installed).
20
+
21
+
To compile the bootloader manually, you need to invoke `cargo xbuild` with a `KERNEL` environment variable that points to your kernel executable (in the ELF format):
17
22
18
23
```
19
-
cd builder
20
-
cargo run -- --kernel path/to/your/kernel/elf/file
This results in a bootloader executable at `target/x86_64-bootloader.json/release/bootloader`. This executable is still an ELF file, which can't be run directly.
37
+
38
+
## Run
39
+
40
+
To run the compiled bootloader executable, you need to convert it to a binary file. You can use the `llvm-objcopy` tools that ships with the `llvm-tools-preview` rustup component. The easiest way to use this tool is using [`cargo-binutils`](https://github.com/rust-embedded/cargo-binutils), which can be installed through `cargo install cargo-binutils`. Then you can perform the conversion with the following command:
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.
@@ -40,3 +62,17 @@ Where sdX is the device name of your USB stick. **Be careful** to choose the cor
40
62
The bootloader crate can be configured through some cargo features:
41
63
42
64
-`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`.
65
+
-`recursive_page_table`: Maps the level 4 page table recursively and adds the [`recursive_page_table_address`](https://docs.rs/bootloader/0.4.0/bootloader/bootinfo/struct.BootInfo.html#structfield.recursive_page_table_addr) field to the passed `BootInfo`.
66
+
-`map_physical_memory`: Maps the complete physical memory in the virtual address space and passes a [`physical_memory_offset`](https://docs.rs/bootloader/0.4.0/bootloader/bootinfo/struct.BootInfo.html#structfield.physical_memory_offset) field in the `BootInfo`.
67
+
68
+
## License
69
+
70
+
Licensed under either of
71
+
72
+
- Apache License, Version 2.0 ([LICENSE-APACHE](LICENSE-APACHE) or
73
+
http://www.apache.org/licenses/LICENSE-2.0)
74
+
- MIT license ([LICENSE-MIT](LICENSE-MIT) or http://opensource.org/licenses/MIT)
75
+
76
+
at your option.
77
+
78
+
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.
0 commit comments