Kernel: Allow to disable early boot console
This aid debugging on bare metal when we suspect that the boot console does something wrong that interferes with other kernel components.
This commit is contained in:
parent
0ef1137e88
commit
eca8f292a5
Notes:
sideshowbarker
2024-07-18 00:34:07 +09:00
Author: https://github.com/supercomputer7 Commit: https://github.com/SerenityOS/serenity/commit/eca8f292a5 Pull-request: https://github.com/SerenityOS/serenity/pull/13091 Reviewed-by: https://github.com/bgianfo Reviewed-by: https://github.com/linusg
4 changed files with 23 additions and 4 deletions
|
@ -35,6 +35,12 @@ List of options:
|
|||
|
||||
* **`disable_virtio`** - If present on the command line, virtio devices will not be detected, and initialized on boot.
|
||||
|
||||
* **`early_boot_console`** - This parameter expects **`on`** or **`off`** and is by default set to **`on`**.
|
||||
When set to **`off`**, the kernel will not initialize any early console to show kernel dmesg output.
|
||||
When set to **`on`**, the kernel will try to initialize either a text mode console (if VGA text mode was detected)
|
||||
or framebuffer console, based on what the Multiboot bootloader specified on the physical address, width, height
|
||||
and bit color depth.
|
||||
|
||||
* **`enable_ioapic`** - This parameter expects **`on`** or **`off`** and is by default set to **`on`**.
|
||||
When set to **`off`**, the kernel will initialize the two i8259 PICs.
|
||||
When set to **`on`**, the kernel will try to initialize the IOAPIC (or IOAPICs if there's more than one),
|
||||
|
|
|
@ -135,6 +135,16 @@ UNMAP_AFTER_INIT bool CommandLine::is_ioapic_enabled() const
|
|||
PANIC("Unknown enable_ioapic setting: {}", value);
|
||||
}
|
||||
|
||||
UNMAP_AFTER_INIT bool CommandLine::is_early_boot_console_disabled() const
|
||||
{
|
||||
auto value = lookup("early_boot_console"sv).value_or("on"sv);
|
||||
if (value == "on"sv)
|
||||
return false;
|
||||
if (value == "off"sv)
|
||||
return true;
|
||||
PANIC("Unknown early_boot_console setting: {}", value);
|
||||
}
|
||||
|
||||
UNMAP_AFTER_INIT bool CommandLine::is_vmmouse_enabled() const
|
||||
{
|
||||
return lookup("vmmouse"sv).value_or("on"sv) == "on"sv;
|
||||
|
|
|
@ -85,6 +85,7 @@ public:
|
|||
[[nodiscard]] bool disable_uhci_controller() const;
|
||||
[[nodiscard]] bool disable_usb() const;
|
||||
[[nodiscard]] bool disable_virtio() const;
|
||||
[[nodiscard]] bool is_early_boot_console_disabled() const;
|
||||
[[nodiscard]] AHCIResetMode ahci_reset_mode() const;
|
||||
[[nodiscard]] StringView userspace_init() const;
|
||||
[[nodiscard]] NonnullOwnPtrVector<KString> userspace_init_args() const;
|
||||
|
|
|
@ -195,10 +195,12 @@ extern "C" [[noreturn]] UNMAP_AFTER_INIT void init(BootInfo const& boot_info)
|
|||
// NOTE: If the bootloader provided a framebuffer, then set up an initial console.
|
||||
// If the bootloader didn't provide a framebuffer, then set up an initial text console.
|
||||
// We do so we can see the output on the screen as soon as possible.
|
||||
if (!multiboot_framebuffer_addr.is_null()) {
|
||||
g_boot_console = &try_make_ref_counted<Graphics::BootFramebufferConsole>(multiboot_framebuffer_addr, multiboot_framebuffer_width, multiboot_framebuffer_height, multiboot_framebuffer_pitch).value().leak_ref();
|
||||
} else {
|
||||
g_boot_console = &Graphics::TextModeConsole::initialize().leak_ref();
|
||||
if (!kernel_command_line().is_early_boot_console_disabled()) {
|
||||
if (!multiboot_framebuffer_addr.is_null()) {
|
||||
g_boot_console = &try_make_ref_counted<Graphics::BootFramebufferConsole>(multiboot_framebuffer_addr, multiboot_framebuffer_width, multiboot_framebuffer_height, multiboot_framebuffer_pitch).value().leak_ref();
|
||||
} else {
|
||||
g_boot_console = &Graphics::TextModeConsole::initialize().leak_ref();
|
||||
}
|
||||
}
|
||||
dmesgln("Starting SerenityOS...");
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue