This guide summarizes the steps for migrating from bootloader v0.10.X to bootloader v0.11.
- Replace the
bootloaderdependency of your kernel with a dependency on thebootloader_apicrate and adjust the import path in yourmain.rs:# in Cargo.toml -bootloader = { version = "0.10.13" } +bootloader_api = "0.11"
// in main.rs -use bootloader::{entry_point, BootInfo}; +use bootloader_api::{entry_point, BootInfo};
- If you used optional features, such as
map-physical-memory, you can enable them again through theentry_pointmacro:See theuse bootloader_api::config::{BootloaderConfig, Mapping}; pub static BOOTLOADER_CONFIG: BootloaderConfig = { let mut config = BootloaderConfig::new_default(); config.mappings.physical_memory = Some(Mapping::Dynamic); config }; // add a `config` argument to the `entry_point` macro call entry_point!(kernel_main, config = &BOOTLOADER_CONFIG);
BootloaderConfigstruct for all configuration options.
To build your kernel, run cargo build --target x86_64-unknown-none. Since the x86_64-unknown-none target is a Tier-2 target, there is no need for bootimage, cargo-xbuild, or xargo anymore. Instead, you can run rustup target add x86_64-unknown-none to download precompiled versions of the core and alloc crates. There is no need for custom JSON-based target files anymore.
The bootloader v0.11 release simplifies the disk image creation. The bootloader crate now provides simple functions to create bootable disk images from a kernel. The basic idea is to build your kernel first and then invoke a builder function that calls the disk image creation functions of the bootloader crate.
See our disk image creation template for a detailed explanation of the new build process.