mirror of
https://github.com/Mathewnd/Astral.git
synced 2026-10-27 12:48:22 +00:00
kernel_args: redo implementation
This commit is contained in:
+12
-8
@@ -1,7 +1,7 @@
|
||||
#include <arch/cpu.h>
|
||||
#include <kernel/init.h>
|
||||
#include <logging.h>
|
||||
#include <kernel/cmdline.h>
|
||||
#include <kernel/kernel_args.h>
|
||||
#include <kernel/vfs.h>
|
||||
#include <kernel/devfs.h>
|
||||
#include <kernel/initrd.h>
|
||||
@@ -9,27 +9,31 @@
|
||||
|
||||
static cpu_t bsp_cpu;
|
||||
|
||||
INIT_ROUTINE_DEFINE(bsp_early,
|
||||
INIT_ROUTINE_FLAGS_PHONY,
|
||||
INIT_ROUTINE_DEFINE(bsp_early,
|
||||
INIT_ROUTINE_FLAGS_PHONY,
|
||||
NULL,
|
||||
alloc, term, cpu
|
||||
);
|
||||
|
||||
DEFINE_KERNEL_ARGUMENT(root, char *);
|
||||
DEFINE_KERNEL_ARGUMENT(rootfs, char *);
|
||||
DEFINE_KERNEL_ARGUMENT(initrd, bool);
|
||||
|
||||
void kernel_entry() {
|
||||
cpu_set(&bsp_cpu);
|
||||
logging_sethook(arch_early_log);
|
||||
|
||||
init_run_routine(INIT_GET_ROUTINE(bsp_early));
|
||||
kernel_arguments_parse();
|
||||
|
||||
cmdline_parse();
|
||||
init_run_routine(INIT_GET_ROUTINE(bsp_early));
|
||||
|
||||
init_run_all_routines();
|
||||
|
||||
// kernel is fully up and running by now
|
||||
// mount root filesystem
|
||||
|
||||
char *root = cmdline_get("root");
|
||||
char *rootfs = cmdline_get("rootfs");
|
||||
char *root = GET_KERNEL_ARGUMENT(root, char *);
|
||||
char *rootfs = GET_KERNEL_ARGUMENT(rootfs, char *);
|
||||
|
||||
printf("entry: mounting %s (%s) on /\n", root == NULL ? "none" : root, rootfs);
|
||||
|
||||
@@ -46,7 +50,7 @@ void kernel_entry() {
|
||||
VOP_RELEASE(backing);
|
||||
}
|
||||
|
||||
if (cmdline_get("initrd"))
|
||||
if (GET_KERNEL_ARGUMENT(initrd, bool))
|
||||
initrd_unpack();
|
||||
|
||||
// spawn init
|
||||
|
||||
Reference in New Issue
Block a user