Skip to content
Merged
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
4 changes: 2 additions & 2 deletions docs/create-disk-image.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ The [`bootloader`](https://docs.rs/bootloader/0.11) crate provides simple functi
A good way to implement this is to move your kernel into a `kernel` subdirectory. Then you can create
a new `os` crate at the top level that defines a [workspace](https://doc.rust-lang.org/cargo/reference/workspaces.html). The root package has build-dependencies on the `kernel` [artifact](https://doc.rust-lang.org/nightly/cargo/reference/unstable.html#artifact-dependencies) and on the bootloader crate. This allows you to create the bootable disk image in a [cargo build script](https://doc.rust-lang.org/cargo/reference/build-scripts.html) and launch the created image in QEMU in the `main` function.

Our [basic example](examples/basic/basic-os.md) showcases this setup:
Our [basic example](/examples/basic/basic-os.md) showcases this setup:
- [Cargo.toml](/examples/basic/Cargo.toml)
- create a workspace & add kernel as member
- add kernel as build-dependency
Expand All @@ -16,7 +16,7 @@ Our [basic example](examples/basic/basic-os.md) showcases this setup:
- change the default toolchain to nightly to use experimental features
- [build.rs](/examples/basic/build.rs)
- create bios and uefi disk image
- [src/main.rs](/examples/basic/src/main.rs])
- [src/main.rs](/examples/basic/src/main.rs)
- launch the image using QEMU

Now you should be able to use `cargo build` to create a bootable disk image and `cargo run bios` and `cargo run uefi` to run it in QEMU. Your kernel is automatically recompiled when it changes. For more advanced usage, you can add command-line arguments to your `main.rs` to e.g. pass additional arguments to QEMU or to copy the disk images to some path to make it easier to find them (e.g. for copying them to an thumb drive).
Loading