Linux Kernel Architecture

(Jacob Rumans) #1
Mauerer app04.tex V1 - 09/04/2008 6:12pm Page 1225

Appendix D: System Startup


This boot section is responsible for the following steps:


  1. Activating paging mode and setting up a final kernel stack.

  2. Filling the.bsssegment located between__bss_startand__bss_stopwith null bytes.

  3. Initializing the interrupt descriptor table. However, theignore_intdummy routine is
    entered for all interrupts — the actual handlers are installed later.

  4. Detecting the processor type. Thecpuidstatement can be used to recognize recent mod-
    els. It returns information on the processor type and capabilities, but it does not distinguish
    between 80386 and 80486 processors — this is done by means of various assembler tricks
    that are neither important nor interesting.


Platform-specific initialization is now complete and the code branches to thestart_kernelfunction.
Unlike the code described previously, this function is implemented as a normal C function and is there-
fore much easier to handle.

D.2 High-Level Initialization


start_kernelacts as a dispatcher function to perform both platform-independent and platform-
dependent tasks, all of which are implemented in C. It is responsible for invoking the high-level
initialization routines of almost all kernel subsystems. Users can recognize when the kernel enters
this initialization phase because one of the first things the function does is display the Linux banner on
screen. For example, the following message is displayed on one of the author’s systems:

Linux version 2.6.24-default (wolfgang@schroedinger) (gcc version 4.2.1 (SUSE
Linux)) #1 SMP PREEMPT Thu Mar 20 00:17:06 CET 2008

The message is generated early on in the boot operation but is not displayed
on-screen until the console system has been initialized. It is buffered in the
intervening period.

The number of screen outputs increases dramatically during the subsequent steps because the subsystems
being initialized display a wide range of status information on the console. This information is very
useful, particularly for troubleshooting.

The following sections deal extensively withstart_kerneland cast light on the kernel startup process
after completion of the architecture-dependent phase.

D.2.1 Subsystem Initialization


Figure D-1 shows a code flow diagram to briefly illustrate the function’s tasks and goals.

The first step is to output the version message. The message text is held in thelinux_bannerglobal
variable defined ininit/version.c. This is followed by a further architecture-specific initialization
step, which no longer deals with lower-level processor details but is written in C and which, on
most systems, has the primary task of setting the framework for initialization of high-level memory
Free download pdf