summaryrefslogtreecommitdiff
path: root/kernel/main.cc
diff options
context:
space:
mode:
authorRichard Qin <richard.qin.x@gmail.com>2026-07-10 23:20:03 +0800
committerRichard Qin <richard.qin.x@gmail.com>2026-07-10 23:20:03 +0800
commit48ef95c24e9ac3d11200b61af617a01b10b507d1 (patch)
tree57f0e26ab98e795b19839b6eece98ca58a4b702d /kernel/main.cc
parentb9ff206e6bd3f4d67851263a6f2acb5f575cf3b0 (diff)
downloadlume-48ef95c24e9ac3d11200b61af617a01b10b507d1.tar.gz
lume-48ef95c24e9ac3d11200b61af617a01b10b507d1.tar.xz
build: introduce declarative non-recursive build graph
Diffstat (limited to 'kernel/main.cc')
-rw-r--r--kernel/main.cc6
1 files changed, 6 insertions, 0 deletions
diff --git a/kernel/main.cc b/kernel/main.cc
index db5843c..c84f3ad 100644
--- a/kernel/main.cc
+++ b/kernel/main.cc
@@ -82,7 +82,9 @@ void tty_init(); // 15.5. TTY subsystem (console TTY + UART RX IRQ)
void populate_rootfs(); // 15.6. Unpack embedded initramfs CPIO into ramfs
// Boot self-test runner
+#ifdef CONFIG_SELFTEST
void selftest_run_all();
+#endif
// AP per-CPU init
void vmm_init_ap(); // Switch to BSP-built kernel page table
@@ -100,6 +102,7 @@ static void init_thread_func(void *) {
printk(KERN_INFO "[init] PID 1 started\n");
/* Run post-SMP tests — APs are online by now */
+#ifdef CONFIG_SELFTEST
extern void selftest_smp();
kprintf("\n========================================\n");
kprintf(" Post-SMP Test Suite\n");
@@ -108,6 +111,7 @@ static void init_thread_func(void *) {
kprintf("========================================\n");
kprintf(" Post-SMP tests PASSED\n");
kprintf("========================================\n\n");
+#endif
/*
* Set up init's own VFS context (like Linux kernel_init).
@@ -326,7 +330,9 @@ extern "C" [[noreturn]] void kernel_main(uint64 cpu_id, uint64 fdt_paddr) {
// 17. Boot self-tests — verify subsystem correctness.
// Tests that create kthreads must wait() for them (freeing PIDs).
+#ifdef CONFIG_SELFTEST
selftest_run_all();
+#endif
// 18. Spawn PID 1 (init) — the first persistent task.
// Like Linux's rest_init() → user_mode_thread(kernel_init).