diff options
author | Ian Moffett <ian@osmora.org> | 2024-03-14 22:03:47 -0400 |
---|---|---|
committer | Ian Moffett <ian@osmora.org> | 2024-03-14 22:03:47 -0400 |
commit | 3c7958f1df0eefa5a567761f5838d5ed772998e6 (patch) | |
tree | 635eb474bf3d7cd84ad5919c55db48f086018c0e /sys/kern | |
parent | 128684dfb24b710cc67bf3de293b31c25746db0c (diff) |
kernel: sched: Rework sched_init()
Signed-off-by: Ian Moffett <ian@osmora.org>
Diffstat (limited to 'sys/kern')
-rw-r--r-- | sys/kern/kern_sched.c | 25 |
1 files changed, 14 insertions, 11 deletions
diff --git a/sys/kern/kern_sched.c b/sys/kern/kern_sched.c index c3d1e09..fca3e17 100644 --- a/sys/kern/kern_sched.c +++ b/sys/kern/kern_sched.c @@ -371,27 +371,30 @@ void sched_init(void) { struct proc *init; - struct auxval auxv = {0}; + struct auxval auxv = {0}, ld_auxv = {0}; struct vas vas = pmap_create_vas(vm_get_ctx()); - const char *init_bin; + const char *init_bin, *ld_bin; - int status; char *ld_path; - char *argv[] = {"/boot/init", NULL}; - char *envp[] = {NULL}; + char *argv[] = {"/usr/sbin/init", NULL}; + char *envp[] = {"", NULL}; TAILQ_INIT(&td_queue); - if ((init_bin = initramfs_open("/boot/init")) == NULL) { - panic("Could not open /boot/init\n"); + if ((init_bin = initramfs_open("/usr/sbin/init")) == NULL) { + panic("Could not open /usr/boot/init\n"); } - - status = loader_load(vas, init_bin, &auxv, 0, &ld_path); - if (status != 0) { + if (loader_load(vas, init_bin, &auxv, 0, &ld_path) != 0) { panic("Could not load init\n"); } + if ((ld_bin = initramfs_open(ld_path)) == NULL) { + panic("Could not open %s\n", ld_path); + } + if (loader_load(vas, ld_bin, &ld_auxv, 0x00, NULL) != 0) { + panic("Could not load %s\n", ld_path); + } - init = sched_create_td((uintptr_t)auxv.at_entry, argv, envp, auxv, vas, true); + init = sched_create_td((uintptr_t)ld_auxv.at_entry, argv, envp, ld_auxv, vas, true); if (init == NULL) { panic("Failed to create thread for init\n"); } |