Command Line

The kernel receives a command line from the bootloader, where we can control some aspects of the kernel boot behavior and enabled features.

Command Line Format

The format is of

property1=value1 property2=value2,property3=value3, proerty4=value4

between properties, comma , can be used and/or space .

Each property is key-value pair, a property can duplicated, in that case, the last value will be used.

Properties

This is implemented in cmdline implemented as

#![allow(unused)]
fn main() {
cmdline_struct! {
    pub struct Cmd<'a> {
        #[default = true]
        pub uart: bool,
        #[default = 115200]
        pub uart_baud: u32,
        #[default = LogLevel::Info]
        pub max_log_level: LogLevel,
        #[default = "/kernel.log"]
        pub log_file: &'a str,
        #[default = true]
        pub allow_hpet: bool,
    }
}
}

Here is the supported properties:

PropertyTypeDescriptionDefault
uartboolEnable UART/serial interfacetrue
uart_baudu32UART baud rate115200
max_log_levelLogLevel (trace/debug/info/warn/error)Maximum log levelLogLevel::Info
log_file&strLog file path"/kernel.log"
allow_hpetboolAllow HPET (if present), otherwise always use PITtrue
log_amlLogAml (off/normal/structured)Log the AML content as ASL code on boot from ACPI tablesLogAml::Off

If we write these in a command line, it will look like:

uart=true uart_baud=115200 max_log_level=info log_file=/kernel.log allow_hpet=true