2015-09-21 23:25:11 +08:00
|
|
|
.. _kconfig:
|
2015-06-26 00:45:16 +08:00
|
|
|
|
|
|
|
The Kconfig File Structure
|
|
|
|
**************************
|
|
|
|
|
|
|
|
Introduction
|
|
|
|
============
|
2015-09-21 23:25:11 +08:00
|
|
|
|
2015-10-05 07:39:55 +08:00
|
|
|
The Kconfig files describe: the configuration symbols supported in the build
|
|
|
|
system, the logical organization and structure to group the symbols in menus
|
|
|
|
and sub-menus, and the relationships between the different configuration
|
|
|
|
symbols that govern the valid configuration combinations.
|
|
|
|
|
|
|
|
The Kconfig files are distributed across the build directory tree. The files
|
|
|
|
are organized based on their common characteristics and on what new symbols
|
|
|
|
they add to the configuration menus. For example:
|
|
|
|
|
|
|
|
* The Kconfig file at the root directory contains the general configuration
|
|
|
|
options like :option:`ARCH` and :option:`KERNEL VERSION`. These symbols are
|
|
|
|
defined for and apply to the entire build system.
|
|
|
|
|
|
|
|
* The Kconfig file at the :file:`kernel` directory contains the general
|
2015-10-20 23:04:32 +08:00
|
|
|
configuration related to the micro- and the nanokernel.
|
2015-10-05 07:39:55 +08:00
|
|
|
|
2015-10-20 23:04:32 +08:00
|
|
|
* The Kconfig file at the :file:`drivers` directory organizes the inclusion of
|
2015-10-05 07:39:55 +08:00
|
|
|
the various Kconfig files needed for each supported driver in the system.
|
|
|
|
|
|
|
|
* The Kconfig file at the :file:`misc` directory contains the configuration
|
|
|
|
symbols that affect different aspects of the build system. For example,
|
|
|
|
the :option:`Custom Compiler Options` and the :option:`Minimal Libc` are
|
|
|
|
general build options that apply to the build system.
|
|
|
|
:option:`Debugging Options` and :option:`System
|
|
|
|
Monitoring Options` are also examples of build options that apply to the
|
|
|
|
entire system.
|
|
|
|
|
|
|
|
* The Kconfig file at the :file:`net` directory contains the different symbols
|
|
|
|
that define the configuration options for the communications stack code.
|
|
|
|
|
|
|
|
* The Kconfig file at the :file:`crypto` directory contains the different
|
|
|
|
symbols that define the configuration options for the cryptography algorithms
|
|
|
|
supported.
|
2015-08-22 07:16:58 +08:00
|
|
|
|
2015-06-26 00:45:16 +08:00
|
|
|
Dependencies
|
|
|
|
============
|
|
|
|
|
2015-10-05 07:39:55 +08:00
|
|
|
Dependencies allow you to define the valid and invalid configuration
|
|
|
|
combinations in the system. Each dependency is a rule that a particular symbol
|
|
|
|
must follow to be either selected or allowed to have a specific value. For
|
|
|
|
example, the configuration symbol *B* states a dependency on another one, *A*.
|
2015-06-26 00:45:16 +08:00
|
|
|
|
|
|
|
.. code-block:: kconfig
|
|
|
|
|
|
|
|
config B bool
|
|
|
|
|
|
|
|
config A depends on B
|
|
|
|
|
2015-10-05 07:39:55 +08:00
|
|
|
The symbol A does not exist as a configuration option in the system unless B is
|
|
|
|
set to true.
|
2015-06-26 00:45:16 +08:00
|
|
|
|
2015-10-05 07:39:55 +08:00
|
|
|
The complete set of dependency rules defines the valid configuration
|
|
|
|
combinations that the system can use.
|
2015-06-26 00:45:16 +08:00
|
|
|
|
|
|
|
|
|
|
|
Default Configurations
|
|
|
|
======================
|
|
|
|
|
2015-10-05 07:39:55 +08:00
|
|
|
The default configuration files define the default configuration for a specific
|
2015-10-19 00:18:06 +08:00
|
|
|
kernel on a specific platform. For example:
|
2015-10-05 07:39:55 +08:00
|
|
|
|
2015-10-19 00:18:06 +08:00
|
|
|
* :file:`arch/arm/configs`,
|
|
|
|
* :file:`arch/x86/configs` and
|
|
|
|
* :file:`arch/arc/configs`.
|
2015-10-05 07:39:55 +08:00
|
|
|
|
2015-10-20 23:04:32 +08:00
|
|
|
All the default configuration files must end with the suffix _defconfig. For
|
2015-10-19 00:18:06 +08:00
|
|
|
example, the :file:`galileo_defconfig` file contains the configuration
|
|
|
|
information for the galileo platform.
|
2015-10-05 07:39:55 +08:00
|
|
|
|
|
|
|
The :file:`Makefile.inc` file uses defconfig files to provide a clean interface
|
|
|
|
to developers using environment variables to define the kernel type and the
|
|
|
|
platform of new projects. Developers can provide the build system with a
|
|
|
|
target's defconfig. The build system takes the specified defconfig file and
|
|
|
|
sets it as the current :file:`.config` file for the current project. For
|
|
|
|
example:
|
2015-06-26 00:45:16 +08:00
|
|
|
|
2015-10-20 23:04:32 +08:00
|
|
|
.. code-block:: console
|
2015-06-26 00:45:16 +08:00
|
|
|
|
2015-10-19 00:18:06 +08:00
|
|
|
$ make galileo_defconfig
|
2015-06-26 00:45:16 +08:00
|
|
|
|
2015-10-19 00:18:06 +08:00
|
|
|
The command takes the default configuration for the architecture
|
2015-10-05 07:39:55 +08:00
|
|
|
and the galileo platform configuration to compile the kernel.
|
2015-06-26 00:45:16 +08:00
|
|
|
|
|
|
|
.. _configuration_snippets:
|
|
|
|
|
2015-10-05 07:39:55 +08:00
|
|
|
Merging Configuration Fragments
|
|
|
|
===============================
|
2015-06-26 00:45:16 +08:00
|
|
|
|
2015-10-19 00:18:06 +08:00
|
|
|
Configuration file fragment can be merged with the current project
|
2015-10-05 07:39:55 +08:00
|
|
|
configuration during the build.
|
2015-06-26 00:45:16 +08:00
|
|
|
|
2015-10-05 07:39:55 +08:00
|
|
|
Developers can provide a configuration file that defines a small subset of
|
|
|
|
configuration options. The subset must contain the specific configuration
|
|
|
|
options that differ from the default configuration.
|
2015-06-26 00:45:16 +08:00
|
|
|
|
2015-10-05 07:39:55 +08:00
|
|
|
The **initconfig** target pulls the default configuration file and merges it
|
2015-10-20 23:04:32 +08:00
|
|
|
with the local configuration fragments. For example, the sample application **hello
|
|
|
|
world** overrides the base configuration with the configuration fragment in
|
2015-10-05 07:39:55 +08:00
|
|
|
:file:`prj.conf`.
|
2015-06-26 00:45:16 +08:00
|
|
|
|
|
|
|
.. caution::
|
2015-10-05 07:39:55 +08:00
|
|
|
Invalid configurations, or configurations that do not comply with
|
|
|
|
the dependencies stated in the Kconfig files, are ignored by the merge process.
|
2015-10-19 00:18:06 +08:00
|
|
|
When adding configuration options through a configuration fragment, ensure that
|
|
|
|
the complete sequence complies with the dependency rules defined in the
|
2015-10-05 07:39:55 +08:00
|
|
|
Kconfig files.
|