1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 22:27:35 +00:00

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:
Liav A 2022-03-15 22:04:12 +02:00 committed by Linus Groh
parent 0ef1137e88
commit eca8f292a5
4 changed files with 23 additions and 4 deletions

View file

@ -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;

View file

@ -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;

View file

@ -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...");