See also: Kernel Index, CPU, System Services
This directory owns boot-time initialization flow after the architecture entry point.
Boot Flow
start() in main.c executes the following sequence:
-
Copy boot info snapshot from bootloader
-
Zero BSS section (
bss_starttoend) -
Zero
g_SysInfoglobal system info structure -
MEM_Initialize()— Set up PMM and VMM using the memory map -
TTY_Initialize()— Initialize terminal output -
SYS_Initialize()— Set up system info structure -
CPU_Initialize()— Detect CPU features -
HAL_Initialize()— Set up GDT, TSS, IDT, ISR stubs, IRQ handlers, PS/2 controller, PIT timer, VGA text mode, syscall handler (int 0x80) -
CmdLine_Initialize()— Parse kernel command-line arguments -
Crypto_SelfTest()— Verify MD5 and SHA1 correctness -
FS_Initialize()— Initialize devfs, scan disks for partitions -
Init_MountRoot()— Mount root filesystem from boot partition -
VFS_SelfTest()— Verify VFS operations -
Keyboard_Initialize()— Set up keyboard input handler -
KMOD_Initialize()— Initialize kernel module loader -
SYS_Finalize()— Finalize system info with boot parameters -
Process_SelfTest()— Verify process creation and lifecycle -
ELF_LoadProcess("/usr/bin/selftest")— Load first userspace process -
Context switch to userspace (selftest runs, then shell)
Files
-
main.c— Kernel entry point (start()) and initialization orchestration -
mount.c—Init_MountRoot()— mount root filesystem from boot partition -
interact.c—interact()— interactive fallback shell for debugging
Typical Work in This Area
-
Adjust startup sequence dependencies
-
Add boot diagnostics and self-test triggers
-
Refine init process handoff and recovery logic
-
Add initramfs support