summaryrefslogtreecommitdiff
path: root/sys/kern/init_main.c
diff options
context:
space:
mode:
Diffstat (limited to 'sys/kern/init_main.c')
-rw-r--r--sys/kern/init_main.c32
1 files changed, 26 insertions, 6 deletions
diff --git a/sys/kern/init_main.c b/sys/kern/init_main.c
index 670d68c..6b3e09b 100644
--- a/sys/kern/init_main.c
+++ b/sys/kern/init_main.c
@@ -35,6 +35,8 @@
#include <sys/exec.h>
#include <sys/driver.h>
#include <sys/panic.h>
+#include <sys/systm.h>
+#include <dev/acpi/uacpi.h>
#include <dev/cons/cons.h>
#include <dev/acpi/acpi.h>
#include <machine/cpu.h>
@@ -42,7 +44,14 @@
#include <vm/vm.h>
#include <string.h>
-static struct proc proc0;
+#define _START_PATH "/usr/sbin/init"
+#if defined(_INSTALL_MEDIA)
+#define _START_ARG "/usr/sbin/install"
+#else
+#define _START_ARG NULL
+#endif /* _INSTALL_MEDIA */
+
+struct proc g_proc0;
static void
copyright(void)
@@ -56,9 +65,10 @@ start_init(void)
{
struct proc *td = this_td();
struct execve_args execve_args;
- char *argv[] = { "/usr/bin/osh", NULL };
+ char *argv[] = { _START_PATH, _START_ARG, NULL };
char *envp[] = { NULL };
+ kprintf("starting init...\n");
execve_args.pathname = argv[0];
execve_args.argv = argv;
execve_args.envp = envp;
@@ -95,18 +105,28 @@ main(void)
/* Expose the console to devfs */
cons_expose();
+ uacpi_init();
+
/* Start scheduler and bootstrap APs */
md_intoff();
sched_init();
+ memset(&g_proc0, 0, sizeof(g_proc0));
+
/* Startup pid 1 */
- memset(&proc0, 0, sizeof(proc0.tf));
- spawn(&proc0, start_init, NULL, 0, NULL);
+ spawn(&g_proc0, start_init, NULL, 0, NULL);
+ md_inton();
- /* Load all drivers */
+ /* Load all early drivers */
DRIVERS_INIT();
- /* Bootstrap APs and here we go! */
+ /* Only log to kmsg from here */
+ syslog_silence(true);
+
+ /*
+ * Bootstrap APs, schedule all other drivers
+ * and here we go!
+ */
mp_bootstrap_aps(&g_bsp_ci);
sched_enter();
__builtin_unreachable();