Просмотр исходного кода

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)
AnotherTest 4 лет назад
Родитель
Сommit
dd60fe4d37
1 измененных файлов с 4 добавлено и 1 удалено
  1. 4 1
      Kernel/init.cpp

+ 4 - 1
Kernel/init.cpp

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