Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Add bootloader version to boot info
  • Loading branch information
phil-opp committed Jan 9, 2021
1 parent d169a31 commit 0c33cec
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/binary/mod.rs
Expand Up @@ -277,6 +277,10 @@ where

// create boot info
let boot_info = boot_info.write(BootInfo {
version_major: env!("CARGO_PKG_VERSION_MAJOR").parse().unwrap(),
version_minor: env!("CARGO_PKG_VERSION_MINOR").parse().unwrap(),
version_patch: env!("CARGO_PKG_VERSION_PATCH").parse().unwrap(),
pre_release: !env!("CARGO_PKG_VERSION_PRE").is_empty(),
memory_regions,
framebuffer: mappings.framebuffer.map(|addr| FrameBuffer {
buffer_start: addr.as_u64(),
Expand Down
11 changes: 11 additions & 0 deletions src/boot_info.rs
Expand Up @@ -15,6 +15,17 @@ use core::slice;
/// signature, use the [`entry_point`] macro.
#[derive(Debug)]
pub struct BootInfo {
/// Bootloader version (major).
pub version_major: u16,
/// Bootloader version (minor).
pub version_minor: u16,
/// Bootloader version (patch).
pub version_patch: u16,
/// Whether the bootloader version is a pre-release.
///
/// We can't store the full prerelease string of the version number since it could be
/// arbitrarily long.
pub pre_release: bool,
/// A map of the physical memory regions of the underlying machine.
///
/// The bootloader queries this information from the BIOS/UEFI firmware and translates this
Expand Down

0 comments on commit 0c33cec

Please sign in to comment.