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: usizeCPU/Hart ID of the boot processor Used for multicore initialization and per-CPU data structures
cpu_count: usizeNumber of CPUs detected at runtime (from FDT) Used to drive SMP initialization and per-CPU resource sizing
usable_memory: MemoryAreaUsable 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: DeviceSourceSource of device information for hardware discovery Determines how the kernel will enumerate and initialize devices
Implementations§
Source§impl BootInfo
impl BootInfo
Sourcepub fn new(
cpu_id: usize,
cpu_count: usize,
usable_memory: MemoryArea,
initramfs: Option<MemoryArea>,
cmdline: Option<&'static str>,
device_source: DeviceSource,
) -> Self
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/hartusable_memory- Memory area available for kernel allocationinitramfs- Optional initramfs memory areacmdline- Optional kernel command line parametersdevice_source- Source of device information for hardware discovery
§Returns
A new BootInfo instance containing the specified boot parameters
Sourcepub fn get_cmdline(&self) -> &str
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
Sourcepub fn get_initramfs(&self) -> Option<MemoryArea>
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