diff options
author | Liav A <liavalb@gmail.com> | 2021-05-14 00:22:02 +0300 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2021-05-16 19:58:33 +0200 |
commit | ab52108982a40dd1db23962d820e90ce32604e66 (patch) | |
tree | 6e334b1759c31389001ff7f6d0887cbe6cf2ed07 /Kernel/TTY | |
parent | 99eab4667a7afcf7a6106e4b6472840fb2a21151 (diff) | |
download | serenity-ab52108982a40dd1db23962d820e90ce32604e66.zip |
Kernel: Allow the user to specify the virtual console when booting
Diffstat (limited to 'Kernel/TTY')
-rw-r--r-- | Kernel/TTY/ConsoleManagement.cpp | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/Kernel/TTY/ConsoleManagement.cpp b/Kernel/TTY/ConsoleManagement.cpp index c9753578f7..20dd12c234 100644 --- a/Kernel/TTY/ConsoleManagement.cpp +++ b/Kernel/TTY/ConsoleManagement.cpp @@ -5,8 +5,10 @@ */ #include <AK/Singleton.h> +#include <Kernel/CommandLine.h> #include <Kernel/Debug.h> #include <Kernel/Graphics/GraphicsManagement.h> +#include <Kernel/Panic.h> #include <Kernel/TTY/ConsoleManagement.h> namespace Kernel { @@ -39,7 +41,11 @@ UNMAP_AFTER_INIT void ConsoleManagement::initialize() m_consoles.append(VirtualConsole::create(index)); } // Note: By default the active console is the first one. - m_active_console = m_consoles[0]; + auto tty_number = kernel_command_line().switch_to_tty(); + if (tty_number > m_consoles.size()) { + PANIC("Switch to tty value is invalid: {} ", tty_number); + } + m_active_console = m_consoles[tty_number]; ScopedSpinLock lock(m_lock); m_active_console->set_active(true); } |