mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 19:37:36 +00:00
Kernel: Introduce "boot_mode" and "init" cmdline options
Together, they replace the old text_debug option. * boot_mode should be either "graphical" (the default) or "text". We could potentially support other values here in the future. * init specifies which userspace process the kernel should spawn to bootstrap userspace. By default, this is SystemServer, but you can specify e.g. init=/bin/Shell to run system diagnostics.
This commit is contained in:
parent
f11270e7ce
commit
df128821b2
1 changed files with 12 additions and 23 deletions
|
@ -168,7 +168,9 @@ void init_stage2()
|
||||||
|
|
||||||
PCI::initialize();
|
PCI::initialize();
|
||||||
|
|
||||||
if (kernel_command_line().contains("text_debug")) {
|
bool text_mode = kernel_command_line().lookup("boot_mode").value_or("graphical") == "text";
|
||||||
|
|
||||||
|
if (text_mode) {
|
||||||
dbg() << "Text mode enabled";
|
dbg() << "Text mode enabled";
|
||||||
} else {
|
} else {
|
||||||
bool bxvga_found = false;
|
bool bxvga_found = false;
|
||||||
|
@ -213,7 +215,6 @@ void init_stage2()
|
||||||
DMIDecoder::initialize();
|
DMIDecoder::initialize();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool text_debug = kernel_command_line().contains("text_debug");
|
|
||||||
bool force_pio = kernel_command_line().contains("force_pio");
|
bool force_pio = kernel_command_line().contains("force_pio");
|
||||||
|
|
||||||
auto root = kernel_command_line().lookup("root").value_or("/dev/hda");
|
auto root = kernel_command_line().lookup("root").value_or("/dev/hda");
|
||||||
|
@ -302,28 +303,16 @@ void init_stage2()
|
||||||
|
|
||||||
int error;
|
int error;
|
||||||
|
|
||||||
// SystemServer will start WindowServer, which will be doing graphics.
|
// FIXME: It would be nicer to set the mode from userspace.
|
||||||
// From this point on we don't want to touch the VGA text terminal or
|
tty0->set_graphical(!text_mode);
|
||||||
// accept keyboard input.
|
|
||||||
if (text_debug) {
|
|
||||||
tty0->set_graphical(false);
|
|
||||||
Thread* thread = nullptr;
|
Thread* thread = nullptr;
|
||||||
Process::create_user_process(thread, "/bin/Shell", (uid_t)0, (gid_t)0, (pid_t)0, error, {}, {}, tty0);
|
auto userspace_init = kernel_command_line().lookup("init").value_or("/bin/SystemServer");
|
||||||
if (error != 0) {
|
Process::create_user_process(thread, userspace_init, (uid_t)0, (gid_t)0, (pid_t)0, error, {}, {}, tty0);
|
||||||
klog() << "init_stage2: error spawning Shell: " << error;
|
|
||||||
hang();
|
|
||||||
}
|
|
||||||
thread->set_priority(THREAD_PRIORITY_HIGH);
|
|
||||||
} else {
|
|
||||||
tty0->set_graphical(true);
|
|
||||||
Thread* thread = nullptr;
|
|
||||||
Process::create_user_process(thread, "/bin/SystemServer", (uid_t)0, (gid_t)0, (pid_t)0, error, {}, {}, tty0);
|
|
||||||
if (error != 0) {
|
if (error != 0) {
|
||||||
klog() << "init_stage2: error spawning SystemServer: " << error;
|
klog() << "init_stage2: error spawning SystemServer: " << error;
|
||||||
hang();
|
hang();
|
||||||
}
|
}
|
||||||
thread->set_priority(THREAD_PRIORITY_HIGH);
|
thread->set_priority(THREAD_PRIORITY_HIGH);
|
||||||
}
|
|
||||||
|
|
||||||
NetworkTask::spawn();
|
NetworkTask::spawn();
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue