Skip to content

Commit 0c33cec

Browse files
committed
Add bootloader version to boot info
1 parent d169a31 commit 0c33cec

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

src/binary/mod.rs

+4
Original file line numberDiff line numberDiff line change
@@ -277,6 +277,10 @@ where
277277

278278
// create boot info
279279
let boot_info = boot_info.write(BootInfo {
280+
version_major: env!("CARGO_PKG_VERSION_MAJOR").parse().unwrap(),
281+
version_minor: env!("CARGO_PKG_VERSION_MINOR").parse().unwrap(),
282+
version_patch: env!("CARGO_PKG_VERSION_PATCH").parse().unwrap(),
283+
pre_release: !env!("CARGO_PKG_VERSION_PRE").is_empty(),
280284
memory_regions,
281285
framebuffer: mappings.framebuffer.map(|addr| FrameBuffer {
282286
buffer_start: addr.as_u64(),

src/boot_info.rs

+11
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,17 @@ use core::slice;
1515
/// signature, use the [`entry_point`] macro.
1616
#[derive(Debug)]
1717
pub struct BootInfo {
18+
/// Bootloader version (major).
19+
pub version_major: u16,
20+
/// Bootloader version (minor).
21+
pub version_minor: u16,
22+
/// Bootloader version (patch).
23+
pub version_patch: u16,
24+
/// Whether the bootloader version is a pre-release.
25+
///
26+
/// We can't store the full prerelease string of the version number since it could be
27+
/// arbitrarily long.
28+
pub pre_release: bool,
1829
/// A map of the physical memory regions of the underlying machine.
1930
///
2031
/// The bootloader queries this information from the BIOS/UEFI firmware and translates this

0 commit comments

Comments
 (0)