The following definitions are available in init. h:
# Define pure_initcall (FN) _ define_initcall ("0", FN, 1)
# Define core_initcall (FN) _ define_initcall ("1", FN, 1)
# Define core_initcall_sync (FN) _ define_initcall ("1 s", FN, 1 s)
# Define postcore_initcall (FN) _ define_initcall ("2", FN, 2)
# Define postcore_initcall_sync (FN) _ define_initcall ("2 s", FN, 2 S)
# Define arch_initcall (FN) _ define_initcall ("3", FN, 3)
# Define arch_initcall_sync (FN) _ define_initcall ("3 S", FN, 3 S)
# Define subsys_initcall (FN) _ define_initcall ("4", FN, 4)
# Define subsys_initcall_sync (FN) _ define_initcall ("4 s", FN, 4S)
# Define fs_initcall (FN) _ define_initcall ("5", FN, 5)
# Define fs_initcall_sync (FN) _ define_initcall ("5 s", FN, 5S)
# Define rootfs_initcall (FN) _ define_initcall ("rootfs", FN, rootfs)
# Define device_initcall (FN) _ define_initcall ("6", FN, 6)
# Define device_initcall_sync (FN) _ define_initcall ("6 s", FN, 6 S)
# Define late_initcall (FN) _ define_initcall ("7", FN, 7)
# Define late_initcall_sync (FN) _ define_initcall ("7 s", FN, 7 S)
# Define module_init (x) _ initcall (X );
# DEFINE _ initcall (FN) device_initcall (FN)
All the _ init functions are in the. init. Text Section, and a function pointer is saved in. initcall. init,
During initialization, the kernel calls these _ init function pointers through these function pointers,
After the initialization is complete, release the entire init section (including. init. Text,. initcall. init, and so on ).
The Calling sequence of these functions during kernel Initialization is only related to the order of function pointers.
The order of these functions in the. init. text section is irrelevant.
In the 2.6 kernel, The initcall. init segment is divided into seven sub-segments.
Different segments have different calling sequence. Smaller numbers have a higher priority.
That is to say, late_initcall must be later than module_init.