]> Projects (at) Tadryanom (dot) Me - AdrOS.git/commit
fix: kconsole fallback not activating when initrd is missing
authorTulio A M Mendes <[email protected]>
Fri, 13 Feb 2026 06:18:24 +0000 (03:18 -0300)
committerTulio A M Mendes <[email protected]>
Fri, 13 Feb 2026 06:18:24 +0000 (03:18 -0300)
commite1ed128bca2d1021872934d4e6bc363ea27b3a7b
treef7424697e1011d1171afa9fa2a7e8c96cc5d366b
parent71fe7ad382d1c12efa3d85c4a9e544c0e88d1160
fix: kconsole fallback not activating when initrd is missing

Root cause: init_start() always called arch_platform_start_userspace()
even when fs_root was NULL. The userspace init thread was created
asynchronously and returned 0 (success) to kernel_main(), so the
'init_ret < 0' check never triggered kconsole_enter(). The init
thread would later discover fs_root==NULL, print '[ELF] fs_root
missing' and hang — but kconsole was never entered.

Fix: init_start() now checks fs_root before attempting to start
userspace. If no root filesystem exists (e.g. missing initrd module
in GRUB), it returns -1 immediately, triggering the kconsole
emergency console fallback in kernel_main().

Also added clear panic message before kconsole entry (similar to
Linux's 'Kernel panic - not syncing: VFS: Unable to mount root fs').

Tested: boot without initrd module now shows:
  [INIT] No root filesystem — cannot start userspace.
  [PANIC] Userspace init failed — dropping to emergency console.
  *** AdrOS Kernel Console (kconsole) ***
  kconsole>

Normal boot: 19/19 smoke pass, cppcheck clean
src/kernel/init.c
src/kernel/main.c