diff --git a/kernel-src/sys/scheduler.c b/kernel-src/sys/scheduler.c index c72b40db..daf71b36 100644 --- a/kernel-src/sys/scheduler.c +++ b/kernel-src/sys/scheduler.c @@ -11,6 +11,7 @@ #include #include #include +#include #define QUANTUM_US 100000 #define SCHEDULER_STACK_SIZE PAGE_SIZE @@ -291,7 +292,7 @@ void sched_inactiveproc(proc_t *proc) { // proc refcount 0, we can free the structure // TODO remove from the pid list - printf("destroying proc!\n"); + //printf("destroying proc!\n"); sched_destroyproc(proc); } @@ -643,7 +644,7 @@ void sched_runinit() { proc->root = vfsroot; VOP_HOLD(vfsroot); - char *argv[] = {"/init", "-l", NULL}; + char *argv[] = {"/init", cmdline_get("initarg"), NULL}; char *envp[] = {NULL}; void *stack = elf_preparestack(STACK_TOP, &auxv64, argv, envp); diff --git a/limine.cfg b/limine.cfg index 13db5e89..ca1a80a3 100644 --- a/limine.cfg +++ b/limine.cfg @@ -7,24 +7,14 @@ TIMEOUT=5 :Astral PROTOCOL=limine KERNEL_PATH=boot:///astral -KERNEL_CMDLINE=root=nvme0n1 rootfs=ext2 +MODULE_PATH=boot:///initrd +KERNEL_CMDLINE=initrd rootfs=tmpfs initarg=withx COMMENT="The Astral operating system" -:Astral (initrd) +:Astral (console) PROTOCOL=limine KERNEL_PATH=boot:///astral MODULE_PATH=boot:///initrd KERNEL_CMDLINE=initrd rootfs=tmpfs COMMENT="The Astral operating system" -:Astral (debugging) -PROTOCOL=limine -KERNEL_PATH=boot:///astral -KERNEL_CMDLINE=root=nvme0n1 rootfs=ext2 e9 syscall_log -COMMENT="The Astral operating system" - -:Astral (debugging, initrd) -KERNEL_PATH=boot:///astral -MODULE_PATH=boot:///initrd -KERNEL_CMDLINE=initrd rootfs=tmpfs e9 syscall_log -COMMENT="The Astral operating system" diff --git a/tools/init/main.c b/tools/init/main.c index 3e9d8f64..074f29b0 100644 --- a/tools/init/main.c +++ b/tools/init/main.c @@ -4,8 +4,9 @@ #include #include #include +#include -int main() { +int main(int argc, char *argv[]) { printf("init: Welcome to Astral!\n"); // set up initial environmental variables @@ -66,6 +67,11 @@ int main() { close(rfd); close(wfd); + // run the startwm script + // if that exits, we will fall back to the console shell + if (argc > 1 && strcmp(argv[1], "withx") == 0) + system("/usr/bin/startwm"); + // start user shell printf("init: running /usr/bin/bash\n"); pid = fork();