From 866fbbb96dca022394bc8e0abbfb52293ad2a3b5 Mon Sep 17 00:00:00 2001 From: Ian Moffett Date: Thu, 17 Apr 2025 03:09:15 -0400 Subject: kernel: Reconsider the idea of init systems Signed-off-by: Ian Moffett --- sys/kern/init_main.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) (limited to 'sys/kern/init_main.c') diff --git a/sys/kern/init_main.c b/sys/kern/init_main.c index f3f88d7..20514b8 100644 --- a/sys/kern/init_main.c +++ b/sys/kern/init_main.c @@ -38,6 +38,7 @@ #include #include #include +#include #include #include @@ -46,6 +47,7 @@ static struct proc proc0; static void start_init(void) { +#if 0 struct proc *td = this_td(); struct execve_args execve_args; char *argv[] = { "/usr/sbin/init", NULL }; @@ -56,6 +58,8 @@ start_init(void) execve_args.envp = envp; if (execve(td, &execve_args) != 0) panic("failed to load init\n"); +#endif + for (;;); } int @@ -81,19 +85,22 @@ main(void) /* Init the virtual file system */ vfs_init(); - DRIVERS_INIT(); - /* Expose the console to devfs */ cons_expose(); /* Start scheduler and bootstrap APs */ + md_intoff(); sched_init(); - mp_bootstrap_aps(&g_bsp_ci); - /* Startup init */ + /* Startup pid 1 */ memset(&proc0, 0, sizeof(proc0.tf)); fork1(&proc0, 0, start_init, NULL); + /* Load all drivers */ + DRIVERS_INIT(); + + /* Bootstrap APs and here we go! */ + mp_bootstrap_aps(&g_bsp_ci); sched_enter(); __builtin_unreachable(); } -- cgit v1.2.3 From b71e2c4eb42dd4f0279b4b4c1986e4d0983a78e5 Mon Sep 17 00:00:00 2001 From: Ian Moffett Date: Thu, 17 Apr 2025 03:50:59 -0400 Subject: kernel: Add copyright Signed-off-by: Ian Moffett --- sys/kern/init_main.c | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'sys/kern/init_main.c') diff --git a/sys/kern/init_main.c b/sys/kern/init_main.c index 20514b8..aa78e8d 100644 --- a/sys/kern/init_main.c +++ b/sys/kern/init_main.c @@ -44,6 +44,13 @@ static struct proc proc0; +static void +copyright(void) +{ + kprintf(OMIT_TIMESTAMP + "Copyright (c) 2023-2025 Ian Marco Moffett and the OSMORA team\n"); +} + static void start_init(void) { @@ -70,6 +77,7 @@ main(void) /* Startup the console */ cons_init(); + copyright(); kprintf("Starting Hyra/%s v%s: %s\n", HYRA_ARCH, HYRA_VERSION, HYRA_BUILDDATE); -- cgit v1.2.3 From 25837e0c189af9e90dbe6c249edf155ef8eccc43 Mon Sep 17 00:00:00 2001 From: Ian Moffett Date: Fri, 18 Apr 2025 21:38:05 -0400 Subject: kernel: Initialize vm subsystem earlier Signed-off-by: Ian Moffett --- sys/kern/init_main.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'sys/kern/init_main.c') diff --git a/sys/kern/init_main.c b/sys/kern/init_main.c index aa78e8d..799d352 100644 --- a/sys/kern/init_main.c +++ b/sys/kern/init_main.c @@ -75,15 +75,15 @@ main(void) /* Setup serial driver */ serial_init(); + /* Init the virtual memory subsystem */ + vm_init(); + /* Startup the console */ cons_init(); copyright(); kprintf("Starting Hyra/%s v%s: %s\n", HYRA_ARCH, HYRA_VERSION, HYRA_BUILDDATE); - /* Init the virtual memory subsystem */ - vm_init(); - /* Start the ACPI subsystem */ acpi_init(); -- cgit v1.2.3