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

Kernel: Optionally take some arguments to pass to the init program

This makes it possible to start _everything_ under UserspaceEmulator, by
setting `init_args` to `--report-to-debug,/bin/SystemServer` and `init`
to `/bin/UserspaceEmulator`.
With the UE patches before this, we get to spawn WindowServer, and crash
because of FLD_RM32 (nothing tested past that) in graphical mode.
But we get a working shell in text mode :^) (and DHCPClient fails when
setting whatever settings it has received)
This commit is contained in:
AnotherTest 2020-10-24 11:30:06 +03:30 committed by Andreas Kling
parent 4d756c7d2d
commit dd60fe4d37

View file

@ -358,7 +358,10 @@ void init_stage2()
tty0->set_graphical(!text_mode);
RefPtr<Thread> thread;
auto userspace_init = kernel_command_line().lookup("init").value_or("/bin/SystemServer");
Process::create_user_process(thread, userspace_init, (uid_t)0, (gid_t)0, ProcessID(0), error, {}, {}, tty0);
auto init_args = kernel_command_line().lookup("init_args").value_or("").split(',');
if (!init_args.is_empty())
init_args.prepend(userspace_init);
Process::create_user_process(thread, userspace_init, (uid_t)0, (gid_t)0, ProcessID(0), error, move(init_args), {}, tty0);
if (error != 0) {
klog() << "init_stage2: error spawning SystemServer: " << error;
Processor::halt();