Linux Kernel Architecture

(Jacob Rumans) #1
Mauerer runapp02.tex V2 - 09/04/2008 6:09pm Page 1147

Appendix B: Working with the Source Code


compile.‘‘ Depending on the choice made, the configuration symbol is assigned the valuey,m,orn.In
addition totristate, the kernel provides other selection types, which are discussed later in this section.

Configuration option dependencies are specified bydepends on. Other configuration symbols are passed
to the statement as parameters, and they can be linked using the logical operators used in C (&&= ‘‘and‘‘,
||= ‘‘or‘‘, and!= ‘‘logical negation‘‘). The menu item is not displayed unless the specified precondition
is satisfied.

The--help--^2 entry indicates that the text after it is help text that users can display if they are not sure
of the meaning of the configuration entry. The end of the help text is indicated by a change in indentation
so that the kernel knows it is again dealing with normal configuration statements.

Two configuration options are shown in the example. The first defines theUSBconfiguration symbol
on which all other configuration entries depend. However, this choice is not displayed unless a host
controller for USB can be presented. This is dependent on theUSB_ARCH_HAS_HCDconfiguration option
that may be either true or false. There are different ways of assigning a true value to the option — the
followingtwoareshownintheexample:

❑ Direct support is available for a host controller chipset (OHCI in the example).
❑ ThePCIbusissupported(thePCIsymbol has a true value).

Support for the OHCI chipset is available ifUSB_ARCH_HAS_OHCIis set. This is always the case when the
PCI bus is supported. However, various systems use the chipsetwithoutPCI support. These are explicitly
listed and include, for example, ARM-based machines and some PPC-based models.

The second configuration option (USS720) is dependent on two things. Support must be available not
only for USB, but also for the parallel port. Otherwise, the driver option is not even displayed.

As the example shows, there may be dependencies between comments as well as between configuration
options. TheUSB Port driversentry is not displayed unless USB support is selected.

Generation of the configuration tree starts atarch/arch/Kconfig, which must first be read by the config-
uration files. All other Kconfig files are linked in recursively from there by means ofsource.

B.2.2 Language Elements of Kconfig


The previous example does not make full use of all options of the Kconfig language. This section provides
a systematic overview of all language features based on the documentationin the kernel sources.^3

Menus


Menus are specified using the following command:

menu "string"
<attributes>

<configuration options>

endmenu

(^2) The minus signs can be omitted;helpis sufficient as a separator.
(^3) This documentation can be found inDocumentation/kbuild/kconfig-language.txt.

Free download pdf