Linux operating system kernel driver initialization sequence adjustment-general Linux technology-Linux programming and kernel information, the following is a detailed description. We need to use the API provided by another driver (I2C) When making a driver today. We encountered a dependency problem during kernel initialization.
My driver runs before I2C initialization, And the API provided by I2C is still unavailable. I checked a lot of information. Some people on the Internet said that the Starting sequence of all drivers using the module_init macro is uncertain (I have not found any authoritative information ).
All the _ init functions are in the Section. initcall. init also saves a function pointer. during initialization, the kernel will call these _ init function pointers through these function pointers. After the initialization is complete, release the entire init section (including. init. text ,. initcall. init ).
Note that the call sequence of these functions during kernel Initialization is only related to the order of the function pointers here, and 1) the functions themselves are described in. init. the order in the text section is irrelevant. In the 2.4 kernel, the order of these function pointers is also related to the order of links and is uncertain. In the 2.6 kernel, The initcall. init segments are further divided into seven sub-segments: