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
Copy file name to clipboardExpand all lines: Readme.md
+48-6Lines changed: 48 additions & 6 deletions
Original file line number
Diff line number
Diff line change
@@ -10,7 +10,7 @@ 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
@@ -21,30 +21,72 @@ bootloader = "0.5.0"
21
21
22
22
**Note**: At least bootloader version `0.5.0` is required.
23
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
+
24
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.
31
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"
57
+
```
58
+
59
+
Now you can run your kernel through `cargo xrun --target […]`.
60
+
32
61
## Configuration
33
62
34
-
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:
35
64
36
65
```toml
37
66
[package.metadata.bootimage]
38
67
# This target is used if no `--target` is passed
39
68
default-target = ""
40
69
41
-
# The command invoked on `bootimage run`
70
+
# The command invoked on `bootimage run` or `bootimage runner`
42
71
# (the "{}" will be replaced with the path to the bootable disk image)
# The timeout for running an integration test in seconds
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
46
79
test-timeout = 300
47
80
```
48
81
49
82
## License
50
-
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