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
|
|
|
|
|
|
|
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 configuration related to
|
|
|
|
the micro- and the nanokernel. Some configuration options contained here are: :option:`Kernel
|
|
|
|
Type` and :option:`Enhanced Security`.
|
|
|
|
|
|
|
|
* The Kconfig file at the :file:`driver` directory organizes the inclusion of 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-09-21 23:25:11 +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-09-21 23:25:11 +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-09-21 23:25:11 +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
|
|
|
|
======================
|
|
|
|
|
|
|
|
The default configuration files define the default configuration
|
2015-09-21 23:25:11 +08:00
|
|
|
for a specific kernel on a specific platform. For example:
|
|
|
|
:file:`arch/arm/configs`, :file:`arch/x86/configs` and :file:`arch/arc/configs`.
|
2015-06-26 00:45:16 +08:00
|
|
|
|
2015-09-21 23:25:11 +08:00
|
|
|
The file name convention for a :abbr:`defconfig (default configuration)` file mandates that the
|
|
|
|
type of kernel and the platform are included within the file name. Further, all the defconfig files
|
|
|
|
must end with the suffix defconfig. For example, the :file:`micro_galileo_defconfig` file contains
|
|
|
|
the configuration information for the microkernel architecture for the galileo platform
|
|
|
|
configuration and the :file:`nano_basic_atom_defconfig` file contains the configuration
|
|
|
|
information for the nanokernel architecture for the basic atom platform.
|
2015-06-26 00:45:16 +08:00
|
|
|
|
2015-09-21 23:25:11 +08:00
|
|
|
The defconfig files are used to dynamically determine the configuration that corresponds to the
|
|
|
|
platform tested by the sanity checks.
|
2015-06-26 00:45:16 +08:00
|
|
|
|
2015-09-21 23:25:11 +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
|
|
|
|
|
|
|
.. code-block:: bash
|
|
|
|
|
2015-08-22 05:07:54 +08:00
|
|
|
$ make defconfig micro_galileo_defconfig
|
2015-06-26 00:45:16 +08:00
|
|
|
|
2015-09-21 23:25:11 +08:00
|
|
|
The command takes the default configuration for the microkernel architecture and the galileo
|
|
|
|
platform configuration to compile the kernel.
|
2015-06-26 00:45:16 +08:00
|
|
|
|
|
|
|
.. _configuration_snippets:
|
|
|
|
|
|
|
|
Merging Configuration Snippets
|
|
|
|
==============================
|
|
|
|
|
2015-09-21 23:25:11 +08:00
|
|
|
Configuration file snippets can be merged with the current project configuration during the build.
|
2015-06-26 00:45:16 +08:00
|
|
|
|
2015-09-21 23:25:11 +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-09-21 23:25:11 +08:00
|
|
|
The **initconfig** target pulls the default configuration file and merges it with the configuration
|
|
|
|
snippet. For example, the sample application **hello world** overrides the base configuration with
|
|
|
|
the configuration snippet :file:`prj.conf`.
|
2015-06-26 00:45:16 +08:00
|
|
|
|
|
|
|
.. caution::
|
2015-09-21 23:25:11 +08:00
|
|
|
Invalid configurations, or configurations that do not comply with the dependencies stated in the
|
|
|
|
Kconfig files, are ignored by the merge process. When adding configuration options through a
|
|
|
|
configuration snippet, ensure that the the complete sequence complies with the dependency rules
|
|
|
|
defined in the Kconfig files.
|