BootInfo

Struct BootInfo 

Source
pub struct BootInfo {
    pub cpu_id: usize,
    pub cpu_count: usize,
    pub usable_memory: MemoryArea,
    pub initramfs: Option<MemoryArea>,
    pub cmdline: Option<&'static str>,
    pub device_source: DeviceSource,
}
Expand description

Boot information structure containing essential system parameters

This structure is created during the early boot process and contains all necessary information for kernel initialization. It abstracts architecture-specific boot protocols into a common interface.

§Architecture Integration

Different architectures populate this structure from their respective boot protocols:

  • RISC-V: Created from FDT (Flattened Device Tree) data
  • ARM/AArch64: Created from FDT or UEFI
  • x86/x86_64: Created from ACPI tables or legacy BIOS structures

§Usage

The BootInfo is passed to start_kernel() as the primary parameter and provides all essential information needed for kernel initialization:

#[no_mangle]
pub extern "C" fn start_kernel(boot_info: &BootInfo) -> ! {
    // Use boot_info for system initialization
    let memory = boot_info.usable_memory;
    let cpu_id = boot_info.cpu_id;
    // ...
}

Fields§

§cpu_id: usize

CPU/Hart ID of the boot processor Used for multicore initialization and per-CPU data structures

§cpu_count: usize

Number of CPUs detected at runtime (from FDT) Used to drive SMP initialization and per-CPU resource sizing

§usable_memory: MemoryArea

Usable memory area available for kernel allocation Excludes reserved regions, firmware areas, and kernel image

§initramfs: Option<MemoryArea>

Optional initramfs memory area if available Contains initial root filesystem for early userspace programs

§cmdline: Option<&'static str>

Optional kernel command line parameters Boot arguments passed by bootloader for kernel configuration

§device_source: DeviceSource

Source of device information for hardware discovery Determines how the kernel will enumerate and initialize devices

Implementations§

Source§

impl BootInfo

Source

pub fn new( cpu_id: usize, cpu_count: usize, usable_memory: MemoryArea, initramfs: Option<MemoryArea>, cmdline: Option<&'static str>, device_source: DeviceSource, ) -> Self

Creates a new BootInfo instance with the specified parameters

§Arguments
  • cpu_id - ID of the boot processor/hart
  • usable_memory - Memory area available for kernel allocation
  • initramfs - Optional initramfs memory area
  • cmdline - Optional kernel command line parameters
  • device_source - Source of device information for hardware discovery
§Returns

A new BootInfo instance containing the specified boot parameters

Source

pub fn get_cmdline(&self) -> &str

Returns the kernel command line arguments

Provides access to boot parameters passed by the bootloader. Returns an empty string if no command line was provided.

§Returns

Command line string slice, or empty string if none available

Source

pub fn get_initramfs(&self) -> Option<MemoryArea>

Returns the initramfs memory area if available

The initramfs contains an initial root filesystem that can be used during early boot before mounting the real root filesystem.

§Returns

Optional memory area containing the initramfs data

Auto Trait Implementations§

§

impl Freeze for BootInfo

§

impl RefUnwindSafe for BootInfo

§

impl Send for BootInfo

§

impl Sync for BootInfo

§

impl Unpin for BootInfo

§

impl UnwindSafe for BootInfo

Blanket Implementations§

§

impl<T> Any for T
where T: 'static + ?Sized,

§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

impl<T> Borrow<T> for T
where T: ?Sized,

§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
§

impl<T> BorrowMut<T> for T
where T: ?Sized,

§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<T> From<T> for T

§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T, U> Into<U> for T
where U: From<T>,

§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of [From]<T> for U chooses to do.

§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.