init/main.c
Source file repositories/reference/linux-study-clean/init/main.c
File Facts
- System
- Linux kernel
- Corpus path
init/main.c- Extension
.c- Size
- 42540 bytes
- Lines
- 1690
- Domain
- Core OS
- Bucket
- Boot And Init
- Inferred role
- Core OS: exported/initcall integration point
- Status
- integration implementation candidate
Why This File Exists
Core operating-system implementation surface: boot, tasks, memory, VFS, syscall-facing interfaces, synchronization, credentials, and isolation.
- Core operating-system implementation surface: boot, tasks, memory, VFS, syscall-facing interfaces, synchronization, credentials, and isolation.
- Exports symbols or registers init work; inspect boot/module ordering and who consumes the exported contract.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- Allocates kernel memory; connect allocation flags and lifetime to context constraints.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/types.hlinux/export.hlinux/extable.hlinux/module.hlinux/proc_fs.hlinux/binfmts.hlinux/kernel.hlinux/syscalls.hlinux/stackprotector.hlinux/string.hlinux/ctype.hlinux/delay.hlinux/ioport.hlinux/init.hlinux/initrd.hlinux/memblock.hlinux/acpi.hlinux/bootconfig.hlinux/console.hlinux/nmi.hlinux/percpu.hlinux/kmod.hlinux/kprobes.hlinux/kmsan.hlinux/ksysfs.hlinux/vmalloc.hlinux/kernel_stat.hlinux/start_kernel.hlinux/security.hlinux/smp.hlinux/profile.hlinux/kfence.h
Detected Declarations
struct blacklist_entryfunction set_reset_devicesfunction obsolete_checksetupfunction debug_kernelfunction quiet_kernelfunction loglevelfunction crashesfunction get_boot_config_from_initrdfunction get_boot_config_from_initrdfunction xbc_make_cmdlinefunction bootconfig_paramsfunction warn_bootconfigfunction setup_boot_configfunction exit_boot_configfunction setup_boot_configfunction warn_bootconfigfunction cmdline_has_extra_optionsfunction repair_env_stringfunction set_init_argfunction parametersfunction init_setupfunction rdinit_setupfunction setup_nr_cpu_idsfunction rest_initfunction do_early_paramfunction parse_early_optionsfunction parse_early_paramfunction arch_post_acpi_subsys_initfunction initcall_debug_enablefunction random_kstack_initfunction early_randomize_kstack_offsetfunction print_unknown_bootoptionsfunction early_numa_node_initfunction print_kernel_cmdlinefunction start_kernelfunction page_to_pfnfunction do_ctorsfunction initcall_blacklistfunction initcall_blacklistedfunction list_for_each_entryfunction initcall_blacklistfunction initcall_blacklistedfunction trace_initcall_start_cbfunction trace_initcall_finish_cbfunction trace_initcall_level_cbfunction initcall_debug_enablefunction do_trace_initcall_startfunction do_trace_initcall_finish
Annotated Snippet
#include <linux/start_kernel.h>
#include <linux/security.h>
#include <linux/smp.h>
#include <linux/profile.h>
#include <linux/kfence.h>
#include <linux/rcupdate.h>
#include <linux/srcu.h>
#include <linux/moduleparam.h>
#include <linux/kallsyms.h>
#include <linux/buildid.h>
#include <linux/writeback.h>
#include <linux/cpu.h>
#include <linux/cpuset.h>
#include <linux/memcontrol.h>
#include <linux/cgroup.h>
#include <linux/tick.h>
#include <linux/sched/isolation.h>
#include <linux/interrupt.h>
#include <linux/taskstats_kern.h>
#include <linux/delayacct.h>
#include <linux/unistd.h>
#include <linux/utsname.h>
#include <linux/rmap.h>
#include <linux/mempolicy.h>
#include <linux/key.h>
#include <linux/debug_locks.h>
#include <linux/debugobjects.h>
#include <linux/lockdep.h>
#include <linux/kmemleak.h>
#include <linux/padata.h>
#include <linux/pid_namespace.h>
#include <linux/device/driver.h>
#include <linux/kthread.h>
#include <linux/sched.h>
#include <linux/sched/init.h>
#include <linux/signal.h>
#include <linux/idr.h>
#include <linux/kgdb.h>
#include <linux/ftrace.h>
#include <linux/async.h>
#include <linux/shmem_fs.h>
#include <linux/slab.h>
#include <linux/perf_event.h>
#include <linux/ptrace.h>
#include <linux/pti.h>
#include <linux/blkdev.h>
#include <linux/sched/clock.h>
#include <linux/sched/task.h>
#include <linux/sched/task_stack.h>
#include <linux/context_tracking.h>
#include <linux/random.h>
#include <linux/moduleloader.h>
#include <linux/list.h>
#include <linux/integrity.h>
#include <linux/proc_ns.h>
#include <linux/io.h>
#include <linux/cache.h>
#include <linux/rodata_test.h>
#include <linux/jump_label.h>
#include <linux/kcsan.h>
#include <linux/init_syscalls.h>
#include <linux/stackdepot.h>
#include <linux/randomize_kstack.h>
#include <linux/pidfs.h>
#include <linux/ptdump.h>
#include <linux/time_namespace.h>
#include <linux/unaligned.h>
#include <linux/vdso_datastore.h>
#include <net/net_namespace.h>
#include <asm/io.h>
#include <asm/setup.h>
#include <asm/sections.h>
#include <asm/cacheflush.h>
#define CREATE_TRACE_POINTS
#include <trace/events/initcall.h>
#include <kunit/test.h>
static int kernel_init(void *);
/*
* Debug helper: via this flag we know that we are in 'early bootup code'
* where only the boot processor is running with IRQ disabled. This means
* two things - IRQ must not be enabled before the flag is cleared and some
* operations which are not allowed with IRQ disabled are allowed while the
* flag is set.
*/
bool early_boot_irqs_disabled __read_mostly;
Annotation
- Immediate include surface: `linux/types.h`, `linux/export.h`, `linux/extable.h`, `linux/module.h`, `linux/proc_fs.h`, `linux/binfmts.h`, `linux/kernel.h`, `linux/syscalls.h`.
- Detected declarations: `struct blacklist_entry`, `function set_reset_devices`, `function obsolete_checksetup`, `function debug_kernel`, `function quiet_kernel`, `function loglevel`, `function crashes`, `function get_boot_config_from_initrd`, `function get_boot_config_from_initrd`, `function xbc_make_cmdline`.
- Atlas domain: Core OS / Boot And Init.
- Implementation status: integration implementation candidate.
- Synchronization appears in or near this file; preserve lock ordering, sleepability, and interrupt-context constraints.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.