Книга: Embedded Linux Primer: A Practical, Real-World Approach

4.2.4. Kernel Image Components

4.2.4. Kernel Image Components

From Listing 4-3, you can see that the vmlinux image consists of several composite binary images. Right now, it is not important to understand the purpose of each component. What is important is to understand the top-level view of what components make up the kernel. The first line of the link command in Listing 4-3 specifies the output file (-o vmlinux .) The second line specifies the linker script file (-T vmlinux.lds), a detailed recipe for how the kernel binary image should be linked.[28]

The third and subsequent lines from Listing 4-3 specify the object modules that form the resulting binary image. Notice that the first object specified is head.o. This object was assembled from /arch/arm/kernel/head.S, an architecture-specific assembly language source file that performs very low-level kernel initialization. If you were searching for the first line of code to be executed by the kernel, it would make sense to start your search here because it will ultimately be the first code found in the binary image created by this link stage. We examine kernel initialization in detail in Chapter 5.

The next object, init_task.o, sets up initial thread and task structures that the kernel requires. Following this is a large collection of object modules, each having a common name: built-in.o. You will notice, however, that each built-in.o object comes from a specific part of the kernel source tree, as indicated by the path component preceding the built-in.o object name. These are the binary objects that are included in the kernel image. An illustration might make this clearer.

Figure 4-1 illustrates the binary makeup of the vmlinux image. It contains a section for each line of the link stage. It's not to scale because of space considerations, but you can see the relative sizes of each functional component.

Figure 4-1. vmlinux image components 


 It might come as no surprise that the three largest binary components are the file system code, the network code, and all the built-in drivers. If you take the kernel code and the architecture-specific kernel code together, this is the next-largest binary component. Here you find the scheduler, process and thread management, timer management, and other core kernel functionality. Naturally, the kernel contains some architecture-specific functionality, such as low-level context switching, hardware-level interrupt and timer processing, processor exception handling, and more. This is found in .../arch/arm/kernel.

Bear in mind that we are looking at a specific example of a kernel build. In this particular example, we are building a kernel specific to the ARM XScale architecture and, more specifically, the Intel IXP425 network processor on the ADI Engineering reference board. You can see the machine-specific binary components in Figure 4-1 as arch/arm/mach-ixp4xx. Each architecture and machine type (processor/reference board) has different elements in the architecture-specific portions of the kernel, so the makeup of the vmlinux image is slightly different. When you understand one example, you will find it easy to navigate others.

To help you understand the breakdown of functionality in the kernel source tree, Table 4-1 lists each component in Figure 4-1, together with a short description of each binary element that makes up the vmlinux image.

Table 4-1. vmlinux Image Components Description

Component Description
arch/arm/kernel/head.o Kernel architecture-specific startup code.
init_task.o Initial thread and task structs required by kernel.
init/built-in.o Main kernel-initialization code. See Chapter 5.
usr/built-in.o Built-in initramfs image. See Chapter 5.
arch/arm/kernel/built-in.o Architecture-specific kernel code.
arch/arm/mm/built-in.o Architecture-specific memory-management code.
arch/arm/common/built-in.o Architecture-specific generic code. Varies by architecture.
arch/arm/mach-ixp4xx/built-in.o Machine-specific code, usually initialization.
arch/arm/nwfpe/built-in.o Architecture-specific floating point-emulation code.
kernel/built-in.o Common components of the kernel itself.
mm/built-in.o Common components of memory-management code.
ipc/built-in.o Interprocess communications, such as SysV IPC.
security/built-in.o Linux security components.
lib/lib.a Archive of miscellaneous helper functions.
arch/arm/lib/lib.a Architecture-specific common facilities. Varies by architecture.
lib/built-in.o Common kernel helper functions.
drivers/built-in.o All the built-in driversnot loadable modules.
sound/built-in.o Sound drivers.
net/built-in.o Linux networking.
.tmp_kallsyms2.o Symbol table. 

When we speak of the kernel proper, this vmlinux image is being referenced. As mentioned earlier, very few platforms boot this image directly. For one thing, it is almost universally compressed. At a bare minimum, a bootloader must decompress the image. Many platforms require some type of stub bolted onto the image to perform the decompression. Later in Chapter 5, you will learn how this image is packaged for different architectures, machine types, and bootloaders, and the requirements for booting it.

Оглавление книги


Генерация: 1.023. Запросов К БД/Cache: 3 / 0
поделиться
Вверх Вниз