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

4.3.4. Kernel Configuration

4.3.4. Kernel Configuration

Kconfig (or a file with a similar root followed by an extension, such as Kconfig. ext) exists in almost 300 kernel subdirectories. Kconfig drives the configuration process for the features contained within its subdirectory. The contents of Kconfig are parsed by the configuration subsystem, which presents configuration choices to the user, and contains help text associated with a given configuration parameter.

The configuration utility (such as gconf, presented earlier) reads the Kconfig files starting from the arch subdirectory's Kconfig file. It is invoked from the Kconfig makefile with an entry that looks like this:

gconfig: $(obj)/gconf
        $< arch/$(ARCH)/Kconfig

Depending on which architecture you are building, gconf reads this architecture-specific Kconfig as the top-level configuration definition. Contained within Kconfig are a number of lines that look like this:

source "drivers/pci/Kconfig"

This directive tells the configuration editor utility to read in another Kconfig file from another location within the kernel source tree. Each architecture contains many such Kconfig files; taken together, these determine the complete set of menu options presented to the user when configuring the kernel. Each Kconfig file is free to source additional Kconfig files in different parts of the source tree. The configuration utility gconf, in this case, recursively reads the Kconfig file chain and builds the configuration menu structure.

Listing 4-8 is a partial tree view of the Kconfig files associated with the ARM architecture. In a recent Linux 2.6 source tree from which this example was taken, the kernel configuration was defined by 170 separate Kconfig files. This listing omits most of those, for the sake of space and claritythe idea is to show the overall structure. To list them all in this tree view would take several pages of this text.

Listing 4-8. Partial Listing of Kconfig for ARM Architecture

arch/arm/Kconfig <<<<<< (top level Kconfig)
|->  init/Kconfig
|  ...
|->  arch/arm/mach-iop3xx/Kconfig
|->  arch/arm/mach-ixp4xx/Kconfig
|    ...
|->  net/Kconfig
|    |->  net/ipv4/Kconfig
|    |     |->  net/ipv4/ipvs/Kconfig
|    ...
|->  drivers/char/Kconfig
|    |->  drivers/serial/Kconfig
|    ...
|->  drivers/usb/Kconfig
|    |->  drivers/usb/core/Kconfig
|    |->  drivers/usb/host/Kconfig
| ...
|->  lib/Kconfig

Looking at Listing 4-8, the file arch/arm/Kconfig would contain a line like this:

source "net/Kconfig"

The file net/Kconfig would contain a line like this:

source "net/ipv4/Kconfig"

…and so on.

As mentioned earlier, these Kconfig files taken together determine the configuration menu structure and configuration options presented to the user during kernel configuration. Figure 4-3 is an example of the configuration utility (gconf) for the ARM architecture compiled from the example in Listing 4-8.

Figure 4-3. gconf configuration screen


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


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