init/main.c
936 asmlinkage __visible void __init __no_sanitize_address start_kernel(void)
asmlinkage : 어셈블리어로 작성된 코드에 호출될수 있음
__visible : gdb 등 외부 프로그램에서 접근 할수 있음
__init : .init.text section에 할당
__no_sanitize_address : The no_sanitize_address attribute on functions is used to inform the compiler that it should not instrument memory accesses in the function when compiling with the -fsanitize=address option. The no_address_safety_analysis is a deprecated alias of the no_sanitize_address attribute, new code should use no_sanitize_address.
937 {
938 char *command_line;
939 char *after_dashes;
940
941 set_task_stack_end_magic(&init_task);
942 smp_setup_processor_id();
943 debug_objects_early_init();
944 init_vmlinux_build_id();
945
946 cgroup_init_early();
947
948 local_irq_disable();
949 early_boot_irqs_disabled = true;
950
951 /*
952 * Interrupts are still disabled. Do necessary setups, then
953 * enable them.
954 */
955 boot_cpu_init();
956 page_address_init();
957 pr_notice("%s", linux_banner);
958 early_security_init();
959 setup_arch(&command_line);
960 setup_boot_config();
961 setup_command_line(command_line);
962 setup_nr_cpu_ids();
963 setup_per_cpu_areas();
964 smp_prepare_boot_cpu(); /* arch-specific boot-cpu hooks */
965 boot_cpu_hotplug_init();
966
967 build_all_zonelists(NULL);
968 page_alloc_init();
969
970 pr_notice("Kernel command line: %s\n", saved_command_line);
971 /* parameters may set static keys */
972 jump_label_init();
973 parse_early_param();
974 after_dashes = parse_args("Booting kernel",
975 static_command_line, __start___param,
976 __stop___param - __start___param,
977 -1, -1, NULL, &unknown_bootoption);
978 print_unknown_bootoptions();
979 if (!IS_ERR_OR_NULL(after_dashes))
980 parse_args("Setting init args", after_dashes, NULL, 0, -1, -1,
981 NULL, set_init_arg);
982 if (extra_init_args)
983 parse_args("Setting extra init args", extra_init_args,
984 NULL, 0, -1, -1, NULL, set_init_arg);
985
986 /* Architectural and non-timekeeping rng init, before allocator init */
987 random_init_early(command_line);
988
989 /*
990 * These use large bootmem allocations and must precede
991 * kmem_cache_init()
992 */
993 setup_log_buf(0);
994 vfs_caches_init_early();
995 sort_main_extable();
996 trap_init();
997 mm_init();
998
999 ftrace_init();
1000
1001 /* trace_printk can be enabled here */
1002 early_trace_init();
1003
1004 /*
1005 * Set up the scheduler prior starting any interrupts (such as the
1006 * timer interrupt). Full topology setup happens at smp_init()
1007 * time - but meanwhile we still have a functioning scheduler.
1008 */
1009 sched_init();
1010
1011 if (WARN(!irqs_disabled(),
1012 "Interrupts were enabled *very* early, fixing it\n"))
1013 local_irq_disable();
1014 radix_tree_init();
1015 maple_tree_init();
1016
1017 /*
1018 * Set up housekeeping before setting up workqueues to allow the unbound
1019 * workqueue to take non-housekeeping into account.
1020 */
1021 housekeeping_init();
1022
1023 /*
1024 * Allow workqueue creation and work item queueing/cancelling
1025 * early. Work item execution depends on kthreads and starts after
1026 * workqueue_init().
1027 */
1028 workqueue_init_early();
1029
1030 rcu_init();
1031
1032 /* Trace events are available after this */
1033 trace_init();
1034
1035 if (initcall_debug)
1036 initcall_debug_enable();
1037
1038 context_tracking_init();
1039 /* init some links before init_ISA_irqs() */
1040 early_irq_init();
1041 init_IRQ();
1042 tick_init();
1043 rcu_init_nohz();
1044 init_timers();
1045 srcu_init();
1046 hrtimers_init();
1047 softirq_init();
1048 timekeeping_init();
1049 time_init();
1050
1051 /* This must be after timekeeping is initialized */
1052 random_init();
1053
1054 /* These make use of the fully initialized rng */
1055 kfence_init();
1056 boot_init_stack_canary();
1057
1058 perf_event_init();
1059 profile_init();
1060 call_function_init();
1061 WARN(!irqs_disabled(), "Interrupts were enabled early\n");
1062
1063 early_boot_irqs_disabled = false;
1064 local_irq_enable();
1065
1066 kmem_cache_init_late();
1067
1068 /*
1069 * HACK ALERT! This is early. We're enabling the console before
1070 * we've done PCI setups etc, and console_init() must be aware of
1071 * this. But we do want output early, in case something goes wrong.
1072 */
1073 console_init();
1074 if (panic_later)
1075 panic("Too many boot %s vars at `%s'", panic_later,
1076 panic_param);
1077
1078 lockdep_init();
1079
1080 /*
1081 * Need to run this when irqs are enabled, because it wants
1082 * to self-test [hard/soft]-irqs on/off lock inversion bugs
1083 * too:
1084 */
1085 locking_selftest();
1086
1087 /*
1088 * This needs to be called before any devices perform DMA
1089 * operations that might use the SWIOTLB bounce buffers. It will
1090 * mark the bounce buffers as decrypted so that their usage will
1091 * not cause "plain-text" data to be decrypted when accessed.
1092 */
1093 mem_encrypt_init();
1094
1095 #ifdef CONFIG_BLK_DEV_INITRD
1096 if (initrd_start && !initrd_below_start_ok &&
1097 page_to_pfn(virt_to_page((void *)initrd_start)) < min_low_pfn) {
1098 pr_crit("initrd overwritten (0x%08lx < 0x%08lx) - disabling it.\n",
1099 page_to_pfn(virt_to_page((void *)initrd_start)),
1100 min_low_pfn);
1101 initrd_start = 0;
1102 }
1103 #endif
1104 setup_per_cpu_pageset();
1105 numa_policy_init();
1106 acpi_early_init();
1107 if (late_time_init)
1108 late_time_init();
1109 sched_clock_init();
1110 calibrate_delay();
1111 pid_idr_init();
1112 anon_vma_init();
1113 #ifdef CONFIG_X86
1114 if (efi_enabled(EFI_RUNTIME_SERVICES))
1115 efi_enter_virtual_mode();
1116 #endif
1117 thread_stack_cache_init();
1118 cred_init();
1119 fork_init();
1120 proc_caches_init();
1121 uts_ns_init();
1122 key_init();
1123 security_init();
1124 dbg_late_init();
1125 net_ns_init();
1126 vfs_caches_init();
1127 pagecache_init();
1128 signals_init();
1129 seq_file_init();
1130 proc_root_init();
1131 nsfs_init();
1132 cpuset_init();
1133 cgroup_init();
1134 taskstats_init_early();
1135 delayacct_init();
1136
1137 poking_init();
1138 check_bugs();
1139
1140 acpi_subsystem_init();
1141 arch_post_acpi_subsys_init();
1142 kcsan_init();
1143
1144 /* Do the rest non-__init'ed, we're now alive */
1145 arch_call_rest_init();
1146
1147 prevent_tail_call_optimization();
1148 }
'linux' 카테고리의 다른 글
6.1/Head.S (0) | 2023.11.16 |
---|---|
6.1/kaslr_requires_kpti(void) (0) | 2023.11.10 |
6.1/smp_setup_processor_id() (0) | 2023.02.23 |
6.1/set_task_stack_end_magic() (0) | 2023.02.09 |
Linux kernel 5.0 ARM64 Compile (0) | 2019.03.12 |