Kevin Peng | 75b0b76 | 2022-10-25 18:00:27 +0800 | [diff] [blame^] | 1 | .. _Kconfig_system: |
| 2 | |
| 3 | ################## |
| 4 | The Kconfig System |
| 5 | ################## |
| 6 | The Kconfig system is an additional tool for users to change configuration options of TF-M. |
| 7 | |
| 8 | .. figure:: kconfig_header_file_system.png |
| 9 | |
| 10 | It handles dependencies and validations automatically when you change configurations so that the |
| 11 | generated configuration options are always valid. |
| 12 | |
| 13 | It consists of `The Kconfig tool`_ and the `The Kconfig files`_. |
| 14 | |
| 15 | **************** |
| 16 | The Kconfig tool |
| 17 | **************** |
| 18 | The Kconfig tool is a python script based on `Kconfiglib <https://github.com/ulfalizer/Kconfiglib>`__ |
| 19 | to launch the menuconfig interfaces and generate the following config files: |
| 20 | |
| 21 | - CMake config file |
| 22 | |
| 23 | Contains CMake cache variables of building options. |
| 24 | This file should be passed to the build system via command line option ``TFM_EXTRA_CONFIG_PATH``. |
| 25 | |
| 26 | - Header file |
| 27 | |
| 28 | Contains component options in the header file system. |
| 29 | This file should be passed to the build system via the command line option ``PROJECT_CONFIG_HEADER_FILE``. |
| 30 | |
| 31 | - The .config file |
| 32 | |
| 33 | The ``.config`` file which contains all the above configurations in the Kconfig format. |
| 34 | It is only used to allow users to make adjustments basing on the previous settings. |
| 35 | The Kconfig tool will load it if it exists. |
| 36 | |
| 37 | How To Use |
| 38 | ========== |
| 39 | The script takes three arguments at maximum. |
| 40 | |
| 41 | - '-k', '--kconfig-file' |
| 42 | |
| 43 | Required. The root Kconfig file. |
| 44 | |
| 45 | - '-u', '--ui' |
| 46 | |
| 47 | Optional. The menuconfig interface to launch, ``gui`` or ``tui``. |
| 48 | Refer to `Menuconfig interfaces <https://github.com/ulfalizer/Kconfiglib#menuconfig-interfaces>`__ |
| 49 | for interface details. Only the first two are supported. |
| 50 | If no UI is selected, the tool generates config files with default values. |
| 51 | |
| 52 | - '-o', '--output_path' |
| 53 | |
| 54 | Required. The output directory to hold the generated files. |
| 55 | |
| 56 | The script can be used as a standalone tool. |
| 57 | You can pass the config files to build system via command line option ``TFM_EXTRA_CONFIG_PATH`` and |
| 58 | ``PROJECT_CONFIG_HEADER_FILE`` respectively, as mentioned above. |
| 59 | |
| 60 | The TF-M build system has also integrated the tool. |
| 61 | You only need to set ``USE_KCONFIG_TOOL`` to ``ON/TRUE/1`` and CMake will launch the GUI menuconfig |
| 62 | for users to adjust configurations and automatically load the generated config files. |
| 63 | |
| 64 | .. note:: |
| 65 | |
| 66 | - Only GUI menuconfig can be launched by CMake for the time being. |
| 67 | - Due to the current limitation of the tool, you are not allowed to change the values of build |
| 68 | options that of which platforms have customized values. And there is no prompt messages either. |
| 69 | |
| 70 | ***************** |
| 71 | The Kconfig files |
| 72 | ***************** |
| 73 | The Kconfig files are the files written in the |
| 74 | `Kconfig language <https://www.kernel.org/doc/html/latest/kbuild/kconfig-language.html#kconfig-language>`__ |
| 75 | to describe config options. |
| 76 | They also uses some Kconfiglib extensions such as ``osource`` and ``rsource`` so they can only work |
| 77 | with the Kconfiglib. |
| 78 | |
| 79 | Component options are gathered together in a seperate menu ``TF-M component configs`` because these |
| 80 | options are changed less frequently. |
| 81 | |
| 82 | -------------- |
| 83 | |
| 84 | *Copyright (c) 2022, Arm Limited. All rights reserved.* |