Skip to content

Fix docs: artifact dependency path needs to be accessed using env::var_os instead of env! #296

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Dec 7, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ To combine your kernel with a bootloader and create a bootable disk image, follo
bindeps = true
```
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.
- Obtain the path to the kernel executable. When using an artifact dependency, you can retrieve this path using `env!("CARGO_BIN_FILE_MY_KERNEL_my-kernel")`
- 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")`
- Use `bootloader::UefiBoot` and/or `bootloader::BiosBoot` to create a bootable disk image with your kernel.
- Do something with the bootable disk images in your `main.rs` function. For example, run them with QEMU.

Expand Down
4 changes: 2 additions & 2 deletions docs/create-disk-image.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,10 @@ members = ["kernel"]

fn main() {
// set by cargo, build scripts should use this directory for output files
let out_dir = env::var_os("OUT_DIR").unwrap();
let out_dir = std::env::var_os("OUT_DIR").unwrap();
// set by cargo's artifact dependency feature, see
// https://doc.rust-lang.org/nightly/cargo/reference/unstable.html#artifact-dependencies
let kernel = env!("CARGO_BIN_FILE_KERNEL_kernel");
let kernel = std::env::var_os("CARGO_BIN_FILE_KERNEL_kernel");

// create an UEFI disk image (optional)
let uefi_path = out_dir.join("uefi.img");
Expand Down