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
34: Rewrite for new bootloader build system r=phil-opp a=phil-opp
This PR rewrites the `bootimage` crate to work with the new bootloader build system proposed in rust-osdev/bootloader#51. It also removes support for some old configuration options and for the `bootloader_precompiled` crate. See the changelog updates for more information.
Note that this new version will only work with bootloader `0.5.0` or later.
Todo:
- [x] Add a `cargo-bootimage` executable
- [x] Create a `bootimage runner` subcommand
- [x] Create a `bootimage tester` subcommand
- [x] Blocked on rust-osdev/bootloader#51
- [x] Rustdoc
- [x] Mention new runner ~/tester~ in the Readme
- [x] Command line help for new commands
- [x] Error message for older bootloader versions (with old build system)
- [x] Update changelog
Co-authored-by: Philipp Oppermann <[email protected]>
Copy file name to clipboardExpand all lines: Changelog.md
+26
Original file line number
Diff line number
Diff line change
@@ -1,3 +1,29 @@
1
+
2
+
## Breaking
3
+
4
+
- Rewrite for new bootloader build system
5
+
- Compatible with bootloader 0.5.0+
6
+
- Remove the following config options: `output`, `bootloader.*`, `minimum_image_size`, and `package_filepath`
7
+
- The bootloader is now fully controlled through cargo dependencies.
8
+
- For using a bootloader crate with name different than `bootloader` use [cargo's rename feature](https://doc.rust-lang.org/cargo/reference/specifying-dependencies.html#renaming-dependencies-in-cargotoml).
9
+
- Remove support for `bootloader_precompiled`
10
+
- The `bootloader` crate compiles fine on all architectures for some time and should be prefered
11
+
- Require the `llvm-tools-preview` rustup component
12
+
- Pass the QEMU exit code in `bootimage run`
13
+
14
+
## Other
15
+
16
+
- Add support for default targets declared in `.cargo/config` files
17
+
- Add a `cargo-bootimage` executable that is equivalent to `bootimage build` and can be used as cargo subcommand (`cargo bootimage`)
18
+
- Add a new `bootimage runner` subcommand that can be used as `target.[…].runner` in `.cargo/config` files
19
+
- Make test timeout configurable and increase default to 5 minutes
Copy file name to clipboardExpand all lines: Readme.md
+56-13
Original file line number
Diff line number
Diff line change
@@ -10,40 +10,83 @@ Creates a bootable disk image from a Rust OS kernel.
10
10
11
11
## Usage
12
12
13
-
First you need to add a dependency on the `bootloader` crate:
13
+
First you need to add a dependency on the [`bootloader`](https://github.com/rust-osdev/bootloader) crate:
14
14
15
15
```toml
16
16
# in your Cargo.toml
17
17
18
18
[dependencies]
19
-
bootloader = "0.2.0-alpha"
19
+
bootloader = "0.5.0"
20
20
```
21
21
22
+
**Note**: At least bootloader version `0.5.0` is required.
23
+
24
+
If you want to use a custom bootloader with a different name, you can use Cargo's [rename functionality](https://doc.rust-lang.org/cargo/reference/specifying-dependencies.html#renaming-dependencies-in-cargotoml).
25
+
26
+
### Building
27
+
22
28
Now you can build the kernel project and create a bootable disk image from it by running:
The command will invoke [`cargo xbuild`](https://github.com/rust-osdev/cargo-xbuild), forwarding all passed options. Then it will build the specified bootloader together with the kernel to create a bootable disk image.
35
+
36
+
If you prefer a cargo subcommand, you can use the equivalent `cargo bootimage` command:
To run your kernel in QEMU, you can use `bootimage run`:
45
+
46
+
```
47
+
bootimage run --target your_custom_target.json [other_args] -- [qemu args]
48
+
```
49
+
50
+
All arguments after `--` are passed to QEMU. If you want to use a custom run command, see the _Configuration_ section below.
51
+
52
+
If you prefer working directly with cargo, you can use `bootimage runner` as a custom runner in your `.cargo/config`:
53
+
54
+
```toml
55
+
[target.'cfg(target_os="none")']
56
+
runner = "bootimage runner"
26
57
```
27
58
28
-
The command will invoke [`cargo xbuild`](https://github.com/rust-osdev/cargo-xbuild), forwarding all passed options. Then it will download and build a bootloader, by default the [rust-osdev/bootloader](https://github.com/rust-osdev/bootloader). Finally, it combines the kernel and the bootloader into a bootable disk image.
59
+
Now you can run your kernel through `cargo xrun --target […]`.
29
60
30
61
## Configuration
31
62
32
-
Configuration is done through a through a `[package.metadata.bootimage]` table in the `Cargo.toml`. The following options are available:
63
+
Configuration is done through a through a `[package.metadata.bootimage]` table in the `Cargo.toml` of your kernel. The following options are available:
33
64
34
65
```toml
35
66
[package.metadata.bootimage]
36
-
default-target = ""# This target is used if no `--target` is passed
37
-
output = "bootimage.bin"# The output file name
38
-
minimum-image-size = 0# The minimum output file size (in MiB)
39
-
# The command invoked on `bootimage run`
67
+
# This target is used if no `--target` is passed
68
+
default-target = ""
69
+
70
+
# The command invoked on `bootimage run` or `bootimage runner`
40
71
# (the "{}" will be replaced with the path to the bootable disk image)
target = "x86_64-bootloader.json"# Target triple for compiling the bootloader
74
+
# Additional arguments passed to the runner on `bootimage run` or `bootimage runner`
75
+
# (this is useful when you want to add some arguments to the default QEMU command)
76
+
run-args = []
77
+
78
+
# The timeout for running an integration test through `bootimage test` in seconds
79
+
test-timeout = 300
46
80
```
47
81
48
82
## License
49
-
Dual-licensed under MIT or the Apache License (Version 2.0).
83
+
84
+
Licensed under either of
85
+
86
+
- Apache License, Version 2.0 ([LICENSE-APACHE](LICENSE-APACHE) or
87
+
http://www.apache.org/licenses/LICENSE-2.0)
88
+
- MIT license ([LICENSE-MIT](LICENSE-MIT) or http://opensource.org/licenses/MIT)
89
+
90
+
at your option.
91
+
92
+
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