Skip to content

linux/init/main.c

Imported from _research/manual-study-linux/file-notes/linux__init__main.c.md.

File Notes: init/main.c

Status: reviewed.

Purpose: kernel boot and init sequence entrypoint.

Review target: identify init ordering, handoff boundaries, global subsystem registration, and Rust/AI design lessons.

Evidence

  • start_kernel() is the generic kernel boot spine at line 972.
  • Core ordering is visible through calls such as mm_core_init_early() line 995, vfs_caches_init_early() line 1031, mm_core_init() line 1034, ftrace_init() line 1037, early_trace_init() line 1040, sched_init() line 1047, rcu_init() line 1067, trace_init() line 1071, srcu_init() line 1083, console_init() line 1112, and vfs_caches_init() line 1157.
  • rest_init() is called around line 1175 to move from boot setup into the scheduler/task world.
  • do_basic_setup() at line 1438 and driver_init() at line 1442 start the broader initcall/driver phase.
  • kernel_init() appears around line 1539 and kernel_init_freeable() around line 1629.

Design Notes

Linux boot is phased, not a normal application main(). Subsystems become legal to call only after their init point. A Rust kernel should represent this with phase-specific capabilities, and an AI runtime should start agents only after identity, policy, storage, telemetry, and cancellation are initialized.