Boot-Time Initialization Routines
Most initialization routines have two interesting properties:
They need to be executed at boot time, when all the kernel components get initialized.
They are not needed once they are executed.
The next section, "xxx_initcall Macros," describes the mechanism used to run initialization routines at boot time, taking into consideration these properties as well as priorities among modules. The later section "Memory Optimizations" shows how routines and data structures that are no longer needed can be freed at link time or runtime by using smart tagging.
xxx_initcall Macros
The early phase of the kernel boot consists of two main blocks of initializations:
The initialization of various critical and mandatory subsystems that need to be done in a specific order. For instance, the kernel cannot initialize a PCI device driver before the PCI layer has been initialized. See the later section "Example of dependency between initialization routines" for another example.
The initialization of other kernel components that do not need a strict order: routines in the same priority level can be run in any order.
The first part is taken care of by the code that comes before do_initcalls in Figure 5-1 in Chapter 5. The second
part is taken care of by the invocation of do_initcalls shown close to the end of do_basic_setup in the same figure. The initialization routines of this second part are classified based on their role and priority. The kernel executes those initialization ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access