make log a bit verbose for some useful information
[lunaix-os.git] / lunaix-os / kernel / kinit.c
index 16c7976867e7da0252ec6fe3890a3d6245a3c95b..58a69e9e41f36223510eebb55a20135f699d60a9 100644 (file)
@@ -111,6 +111,16 @@ __remap_and_load_dtb(struct boot_handoff* bhctx)
     return;
 }
 
     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)
 {
 void
 kernel_bootstrap(struct boot_handoff* bhctx)
 {
@@ -123,7 +133,8 @@ kernel_bootstrap(struct boot_handoff* bhctx)
     /* Setup kernel memory layout and services */
     kmem_init(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);
 
 
     boot_parse_cmdline(bhctx);
 
@@ -132,19 +143,20 @@ kernel_bootstrap(struct boot_handoff* bhctx)
 
     device_scan_drivers();
 
 
     device_scan_drivers();
 
+    initfn_invoke_sysconf();
+    
+    __remap_and_load_dtb(bhctx);
     device_sysconf_load();
 
     device_sysconf_load();
 
-    invoke_init_function(on_earlyboot);
+    // TODO register devtree hooks
+    // TODO re-scan devtree to bind devices.
 
     clock_init();
     timer_init();
 
     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();
     vfs_init();
     fsm_init();
     input_init();
@@ -158,7 +170,7 @@ kernel_bootstrap(struct boot_handoff* bhctx)
     must_success(vfs_mount_root("ramfs", NULL));
     must_success(vfs_mount("/dev", "devfs", NULL, 0));
     
     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
 
     /* Finish up bootstrapping sequence, we are ready to spawn the root process
      * and start geting into uspace