Skip to content

Commit 4c8f885

Browse files
committed
address remaining comments
1 parent 18ec39e commit 4c8f885

File tree

3 files changed

+13
-17
lines changed

3 files changed

+13
-17
lines changed

.github/workflows/ci.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,10 +99,10 @@ jobs:
9999
run: cargo build
100100
working-directory: examples/basic
101101
- name: "Run basic example (bios)"
102-
run: cargo run -- bios
102+
run: cargo run bios
103103
working-directory: examples/basic
104104
- name: "Run basic example (uefi)"
105-
run: cargo run -- uefi
105+
run: cargo run uefi
106106
working-directory: examples/basic
107107

108108
fmt:

README.md

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -43,15 +43,7 @@ To combine your kernel with `bootloader` and create a bootable disk image, follo
4343
};
4444
bootloader_api::entry_point!(kernel_main, config = &CONFIG);
4545
```
46-
- Compile your kernel to an ELF executable by running **`cargo build --target x86_64-unknown-none`**. You might need to run `rustup target add x86_64-unknown-none` before to download precompiled versions of the `core` and `alloc` crates. You can add `x86_64-unknown-none` as default target and add it to your toolchain so that `cargo build` takes care of this.
47-
```toml
48-
# .cargo/config.toml
49-
[build]
50-
target = "x86_64-unknown-none"
51-
```
52-
```sh
53-
$ cargo build
54-
```
46+
- Compile your kernel to an ELF executable by running **`cargo build --target x86_64-unknown-none`**. You might need to run `rustup target add x86_64-unknown-none` before to download precompiled versions of the `core` and `alloc` crates.
5547
- Thanks to the `entry_point` macro, the compiled executable contains a special section with metadata and the serialized config, which will enable the `bootloader` crate to load it.
5648

5749
#### Creating a bootable image
@@ -61,12 +53,16 @@ To combine your kernel with `bootloader` and create a bootable disk image, follo
6153
```sh
6254
$ cargo init --bin
6355
```
64-
- Define a [workspace](https://doc.rust-lang.org/cargo/reference/workspaces.html) and add your kernel as a workspace member.
56+
- Define a [workspace](https://doc.rust-lang.org/cargo/reference/workspaces.html).
6557
```toml
6658
# in Cargo.toml
6759
[workspace]
6860
resolver = "3"
69-
members = ["kernel"]
61+
members = []
62+
```
63+
- Add your kernel as a workspace member.
64+
```sh
65+
$ cargo new kernel --bin
7066
```
7167
- Enable the workspace to build your kernel:
7268
- Set up an [artifact dependency](https://doc.rust-lang.org/nightly/cargo/reference/unstable.html#artifact-dependencies) to add your `kernel` crate as a `build-dependency`:
@@ -88,7 +84,7 @@ To combine your kernel with `bootloader` and create a bootable disk image, follo
8884
channel = "nightly"
8985
targets = ["x86_64-unknown-none"]
9086
```
91-
- Alternatively, you can use [`std::process::Command`](https://doc.rust-lang.org/stable/std/process/struct.Command.html) to invoke the build command of your kernel in the `build.rs` script.
87+
- Alternatively, you can use [`std::process::Command`](https://doc.rust-lang.org/stable/std/process/struct.Command.html) to invoke the build command of your kernel in the `build.rs` script.
9288
- Create a [`build.rs`](https://doc.rust-lang.org/cargo/reference/build-scripts.html) build script in the `os` crate. See our [disk image creation template](docs/create-disk-image.md) for a more detailed example.
9389
- Obtain the path to the kernel executable. When using an artifact dependency, you can retrieve this path using `std::env::var_os("CARGO_BIN_FILE_MY_KERNEL_my-kernel")`
9490
- Use `bootloader::UefiBoot` and/or `bootloader::BiosBoot` to create a bootable disk image with your kernel.

examples/basic/basic-os.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ The `basic` create combines the kernel with `bootloader`, creates a bootable dis
3535
- A [cargo build script](https://doc.rust-lang.org/cargo/reference/build-scripts.html) is used to create a bootable disk image ([`build.rs`](build.rs)).
3636
- `basic` launches the images in QEMU.
3737

38-
See also [basic-kernel.md](kernel/basic-kernel.md) in the `kernel` subdirectory.
38+
See also [basic-kernel.md](kernel/basic-kernel.md) in the `kernel` subdirectory.
3939

4040
## Usage
4141

@@ -49,8 +49,8 @@ $ cargo build
4949
```
5050
Run:
5151
```sh
52-
$ cargo run -- bios
52+
$ cargo run bios
5353
```
5454
```sh
55-
$ cargo run -- uefi
55+
$ cargo run uefi
5656
```

0 commit comments

Comments
 (0)