Linux Kernel Architecture

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

SystemStartup


Like any other program, the kernel goes through a load and initialization phase before performing
its normal tasks. Although this phase is not particularly interesting in the case of normal applica-
tions, the kernel — as the central system layer — has to address a number of specific problems. The
boot phase is split into the following three parts:


❑ Kernel loading into RAM and the creation of a minimal runtime environment.

❑ Branching to the (platform-dependent) machine code of the kernel and system-specific ini-
tialization of the elementary system functions written in assembly language.

❑ Branching to the (platform-independent) part of the initialization code written in C, and
complete initialization of all subsystems with a subsequent switch to normal operation.

As usual, a boot loader is responsible for the first phase. Its tasks depend largely on what the par-
ticular architecture is required to do. Because in-depth knowledge of specific processor features
and problems is needed to understand all details of the first phase, the architecture-specific refer-
ence manual is a good source of information. The second phase is also very hardware-dependent.
Consequently, this appendix describes only some key areas of the IA-32 architecture.


In the third, system-independent phase, the kernel is already resident in memory and (on some
architectures) the processor has switched from boot mode to execution mode in which the kernel
then runs. On IA-32 machines, it is necessary to switch the processor from 8086 emulation, which is
immediately active at boot time, toprotected modeto make the system 32-bit capable. Setup work is
also required on other architectures — for instance, it is often necessary to activate paging explicitly,
and central system components must be placed in a defined initial state so that work can begin. All
these tasks must be coded in assembly language and therefore are not the most inviting parts of the
kernel.


Concentrating on the third phase of startup allows for dispensing with many architecture-specific
trifles and has the added advantage that, generally speaking, the remaining sequence of operations
is independent of the particular platform on which the kernel runs.

Free download pdf