Skip to content

Commit a94c1c3

Browse files
committed
Update --help output
1 parent 04cdce2 commit a94c1c3

File tree

7 files changed

+68
-5
lines changed

7 files changed

+68
-5
lines changed

src/help/build_help.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@ BUILD_OPTS:
1212
disk image.
1313

1414
CONFIGURATION:
15-
The bootloader and the behavior of `bootimage build` can be configured
16-
through a `[package.metadata.bootimage]` table in the `Cargo.toml`. The
17-
following options are available to configure the build:
15+
The behavior of `bootimage build` can be configured through a
16+
`[package.metadata.bootimage]` table in the `Cargo.toml`. The following
17+
options are available to configure the build:
1818

1919
[package.metadata.bootimage]
2020
default-target = "" This target is used if no `--target` is passed

src/help/cargo_bootimage_help.txt

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
Creates a bootable disk image from a Rust kernel
2+
3+
USAGE:
4+
cargo bootimage [BUILD_OPTS] Create a bootable disk image
5+
6+
(for other forms of usage see `bootimage --help`)
7+
8+
BUILD_OPTS:
9+
Any options are directly passed to `cargo build` (see
10+
`cargo build --help` for possible options). After building, a bootloader
11+
is downloaded and built, and then combined with the kernel into a bootable
12+
disk image.
13+
14+
CONFIGURATION:
15+
The behavior of `cargo bootimage` can be configured through a
16+
`[package.metadata.bootimage]` table in the `Cargo.toml`. The following
17+
options are available to configure the build:
18+
19+
[package.metadata.bootimage]
20+
default-target = "" This target is used if no `--target` is passed

src/help/help.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@ USAGE:
55
bootimage build [BUILD_OPTS] Create a bootable disk image
66
bootimage run [BUILD_OPTS] -- [RUN_OPTS] Build and run a disk image
77
bootimage test [BUILD_OPTS] Runs integration tests
8+
bootimage runner EXECUTABLE Convert and run an executable
9+
10+
cargo bootimage [BUILD_OPTS] Create a bootable disk image
11+
(equivalent to bootimage build)
812

913
For more information about a subcommand run `bootimage [subcommand] --help`.
1014

src/help/mod.rs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,9 @@ use std::process;
22

33
const HELP: &str = include_str!("help.txt");
44
const BUILD_HELP: &str = include_str!("build_help.txt");
5+
const CARGO_BOOTIMAGE_HELP: &str = include_str!("cargo_bootimage_help.txt");
56
const RUN_HELP: &str = include_str!("run_help.txt");
7+
const RUNNER_HELP: &str = include_str!("runner_help.txt");
68
const TEST_HELP: &str = include_str!("test_help.txt");
79

810
pub(crate) fn help() {
@@ -13,10 +15,18 @@ pub(crate) fn build_help() {
1315
print!("{}", BUILD_HELP);
1416
}
1517

18+
pub(crate) fn cargo_bootimage_help() {
19+
print!("{}", CARGO_BOOTIMAGE_HELP);
20+
}
21+
1622
pub(crate) fn run_help() {
1723
print!("{}", RUN_HELP);
1824
}
1925

26+
pub(crate) fn runner_help() {
27+
print!("{}", RUNNER_HELP);
28+
}
29+
2030
pub(crate) fn test_help() {
2131
print!("{}", TEST_HELP);
2232
}

src/help/run_help.txt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@ CONFIGURATION:
1616
following options are available to configure run behavior:
1717

1818
[package.metadata.bootimage]
19-
# The command invoked on `bootimage run`
19+
# The command invoked on `bootimage run` or `bootimage runner`
2020
# (the "{}" will be replaced with the path to the bootable disk image)
2121
run-command = ["qemu-system-x86_64", "-drive", "format=raw,file={}"]
22+
# Additional arguments passed to the runner on `bootimage run` or `bootimage runner`
23+
# (this is useful when you want to add some arguments to the default QEMU command)
24+
run-args = []

src/help/runner_help.txt

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
Creates a bootable disk image from a Rust kernel and launches it in QEMU
2+
3+
USAGE:
4+
bootimage runner EXECUTABLE Convert and run the given EXECUTABLE
5+
6+
(for other forms of usage see `bootimage --help`)
7+
8+
This subcommand can be used as a target runner in a `.cargo/config` file:
9+
```
10+
[target.'cfg(target_os = "none")']
11+
runner = "bootimage runner"
12+
```
13+
14+
CONFIGURATION:
15+
The behavior of `bootimage runner` can be configured through a
16+
`[package.metadata.bootimage]` table in the `Cargo.toml`. The
17+
following options are available to configure run behavior:
18+
19+
[package.metadata.bootimage]
20+
# The command invoked on `bootimage run` or `bootimage runner`
21+
# (the "{}" will be replaced with the path to the bootable disk image)
22+
run-command = ["qemu-system-x86_64", "-drive", "format=raw,file={}"]
23+
# Additional arguments passed to the runner on `bootimage run` or `bootimage runner`
24+
# (this is useful when you want to add some arguments to the default QEMU command)
25+
run-args = []

src/lib.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,10 +67,11 @@ pub fn run() -> Result<Option<i32>, ErrorMessage> {
6767
Command::NoSubcommand => help::no_subcommand(),
6868
Command::Help => Ok(help::help()).map(none),
6969
Command::BuildHelp => Ok(help::build_help()).map(none),
70+
Command::CargoBootimageHelp => Ok(help::cargo_bootimage_help()).map(none),
7071
Command::RunHelp => Ok(help::run_help()).map(none),
72+
Command::RunnerHelp => Ok(help::runner_help()).map(none),
7173
Command::TestHelp => Ok(help::test_help()).map(none),
7274
Command::Version => Ok(println!("bootimage {}", env!("CARGO_PKG_VERSION"))).map(none),
73-
Command::RunnerHelp | Command::CargoBootimageHelp => unimplemented!(),
7475
}
7576
}
7677

0 commit comments

Comments
 (0)