Skip to content

Latest commit

 

History

History
41 lines (30 loc) · 2.02 KB

v0.10.md

File metadata and controls

41 lines (30 loc) · 2.02 KB

Migration from bootloader v0.10

This guide summarizes the steps for migrating from bootloader v0.10.X to bootloader v0.11.

Kernel

  • Replace the bootloader dependency of your kernel with a dependency on the bootloader_api crate and adjust the import path in your main.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 the entry_point macro:
    use 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);
    See the BootloaderConfig struct 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.

Booting

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.