Before Booting
In the previous section, I treated start_kernel as the first kernel function. However, you might be interested in what happens before that point.
The code that runs before start_kernel is low-level and includes assembly code, so you might not be interested in the details. I’ll try nonetheless to introduce what happens in the computer after the firmware (called BIOS in the PC world) gives control to Linux.
If you aren’t interested in digging into this low-level code, you can skip to "Section 16.3.” The following section provides some hints about the Intel, Alpha, and Sparc booting code, as these are the only systems I have access to. (If someone would like to donate the hardware, I’ll cover more platforms in the next edition.)
Setting Up the X86 Processors
The personal computer is based on an old design and backward compatibility has always been a high priority. Thus, the PC firmware boots the operating system in an old-fashioned way. Once the boot device has been selected, its first sector is loaded into memory at address 0x7C00 and given control.
The freshly powered-up processor lives in real mode (i.e., it’s like an
8086) and can only address the first 640KB of physical RAM, some
of which is already occupied by data tables managed by the firmware.
Since the kernel is larger than this, the Linux developers had to find
a non-trivial way to load the kernel image into memory. The result was the
zImage
file, which is a compressed kernel image that fits (hopefully) ...
Get Linux Device Drivers now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.