X-Git-Url: https://scm.lunaixsky.com/lunaix-os.git/blobdiff_plain/bffa3430fbbaaad29bec0b5bee9c1f0bfc7fd068..b1644f824d7f4989a94b8a752aadee26cae25069:/lunaix-os/kernel/kinit.c diff --git a/lunaix-os/kernel/kinit.c b/lunaix-os/kernel/kinit.c index a084183..58a69e9 100644 --- a/lunaix-os/kernel/kinit.c +++ b/lunaix-os/kernel/kinit.c @@ -2,13 +2,14 @@ #include #include #include -#include #include + #include #include #include #include #include + #include #include #include @@ -18,14 +19,9 @@ #include #include -#include #include -#include -#include - -#include -#include +#include LOG_MODULE("kinit") @@ -59,7 +55,7 @@ kmem_init(struct boot_handoff* bhctx) unsigned int i = ptep_vfn(ptep); do { - if (l0tep_implie_vmnts(ptep)) { + if (lntep_implie_vmnts(ptep, L0T_SIZE)) { ptep++; continue; } @@ -115,11 +111,19 @@ __remap_and_load_dtb(struct boot_handoff* bhctx) return; } +static void +log_bootup_time() +{ + datetime_t dt; + + clock_walltime(&dt); + INFO("kernel boot at: %d/%d/%d %d:%d:%d", + dt.year, dt.month, dt.day, dt.hour, dt.minute, dt.second); +} + void kernel_bootstrap(struct boot_handoff* bhctx) { - vmm_init(); - pmm_init(bhctx); // now we can start reserving physical space @@ -129,7 +133,8 @@ kernel_bootstrap(struct boot_handoff* bhctx) /* Setup kernel memory layout and services */ kmem_init(bhctx); - __remap_and_load_dtb(bhctx); + INFO(); + INFO("Lunaix " CONFIG_LUNAIX_VER " (c) Lunaixsky 2022-2025"); boot_parse_cmdline(bhctx); @@ -138,19 +143,20 @@ kernel_bootstrap(struct boot_handoff* bhctx) device_scan_drivers(); + initfn_invoke_sysconf(); + + __remap_and_load_dtb(bhctx); device_sysconf_load(); - invoke_init_function(on_earlyboot); + // TODO register devtree hooks + // TODO re-scan devtree to bind devices. clock_init(); timer_init(); + log_bootup_time(); - /* - TODO autoload these init function that do not have dependency between - them - */ + initfn_invoke_earlyboot(); - /* Let's get fs online as soon as possible, as things rely on them */ vfs_init(); fsm_init(); input_init(); @@ -164,7 +170,7 @@ kernel_bootstrap(struct boot_handoff* bhctx) must_success(vfs_mount_root("ramfs", NULL)); must_success(vfs_mount("/dev", "devfs", NULL, 0)); - invoke_init_function(on_boot); + initfn_invoke_boot(); /* Finish up bootstrapping sequence, we are ready to spawn the root process * and start geting into uspace