1e41f4b71Sopenharmony_ci# Building the Kconfig Visual Configuration 2e41f4b71Sopenharmony_ci 3e41f4b71Sopenharmony_ci## Overview 4e41f4b71Sopenharmony_ci 5e41f4b71Sopenharmony_ci### Kconfig Visual Configuration 6e41f4b71Sopenharmony_ciKconfig visual configuration is implemented on [Kconfiglib](https://github.com/ulfalizer/Kconfiglib) and [Kconfig](https://www.kernel.org/doc/html/latest/kbuild/kconfig-language.html). It allows customized configuration of OpenHarmony subsystem components. 7e41f4b71Sopenharmony_ci 8e41f4b71Sopenharmony_ciKconfig visual configuration has the following advantages: 9e41f4b71Sopenharmony_ci 10e41f4b71Sopenharmony_ci- Intuitive display of software component options 11e41f4b71Sopenharmony_ci- High reliability (Linux kernel and Buildroot use Kconfig for visualized configuration) 12e41f4b71Sopenharmony_ci 13e41f4b71Sopenharmony_ci### Basic Concepts 14e41f4b71Sopenharmony_ci 15e41f4b71Sopenharmony_ci- [Kconfig](https://www.kernel.org/doc/html/latest/kbuild/kconfig-language.html#introduction): a visual configuration file format for Linux. 16e41f4b71Sopenharmony_ci 17e41f4b71Sopenharmony_ci- [Kconfiglib](https://github.com/ulfalizer/Kconfiglib): a visual configuration tool based on the Kconfig format for Linux. 18e41f4b71Sopenharmony_ci 19e41f4b71Sopenharmony_ci### Related Modules 20e41f4b71Sopenharmony_ci 21e41f4b71Sopenharmony_ci- [Kconfig update module](https://gitee.com/openharmony/build/blob/master/tools/component_tools/generate_kconfig.py): updates the component information list in the Kconfig menu. 22e41f4b71Sopenharmony_ci 23e41f4b71Sopenharmony_ci- [Config format conversion](https://gitee.com/openharmony/build/blob/master/tools/component_tools/parse_kconf.py): converts the **config** file generated on the GUI to the standard format for compilation and build. 24e41f4b71Sopenharmony_ci 25e41f4b71Sopenharmony_ci## Operation Guide 26e41f4b71Sopenharmony_ci 27e41f4b71Sopenharmony_ci1. Obtain the source code. 28e41f4b71Sopenharmony_ci 29e41f4b71Sopenharmony_ci For details, see [Obtaining Source Code](../get-code/sourcecode-acquire.md). 30e41f4b71Sopenharmony_ci 31e41f4b71Sopenharmony_ci2. Set up the environment. 32e41f4b71Sopenharmony_ci 33e41f4b71Sopenharmony_ci The Kconfiglib required for environment configuration has been embedded in the OpenHarmony hb tool. For details about how to install the hb tool, see [hb Installation](../quick-start/quickstart-pkg-install-tool.md#hb-installation). 34e41f4b71Sopenharmony_ci 35e41f4b71Sopenharmony_ci3. Open the Kconfig configuration interface. 36e41f4b71Sopenharmony_ci 37e41f4b71Sopenharmony_ci ```shell 38e41f4b71Sopenharmony_ci # Go to the build repository directory. 39e41f4b71Sopenharmony_ci cd build/tools/component_tools 40e41f4b71Sopenharmony_ci menuconfig kconfig 41e41f4b71Sopenharmony_ci ``` 42e41f4b71Sopenharmony_ci 43e41f4b71Sopenharmony_ci  44e41f4b71Sopenharmony_ci 45e41f4b71Sopenharmony_ci4. Set parameters. 46e41f4b71Sopenharmony_ci 47e41f4b71Sopenharmony_ci For details about the parameters, see productdefine/common/base/base_product.json. 48e41f4b71Sopenharmony_ci 49e41f4b71Sopenharmony_ci  50e41f4b71Sopenharmony_ci 51e41f4b71Sopenharmony_ci5. Select and configure the component. 52e41f4b71Sopenharmony_ci 53e41f4b71Sopenharmony_ci 1. Press the arrow keys and select a subsystem. The component list of the subsystem is displayed. 54e41f4b71Sopenharmony_ci 55e41f4b71Sopenharmony_ci 2. Press **Enter** to select a component. 56e41f4b71Sopenharmony_ci 57e41f4b71Sopenharmony_ci 3. When setting `feature`, use commas (,) to separate multiple values. 58e41f4b71Sopenharmony_ci 59e41f4b71Sopenharmony_ci  60e41f4b71Sopenharmony_ci 61e41f4b71Sopenharmony_ci6. Save the settings. 62e41f4b71Sopenharmony_ci 63e41f4b71Sopenharmony_ci Press **S** to save the settings. You can set the name of the file to generate. By default, a file named `.config` file is generated in the current directory. 64e41f4b71Sopenharmony_ci 65e41f4b71Sopenharmony_ci  66e41f4b71Sopenharmony_ci 67e41f4b71Sopenharmony_ci7. Generate the OpenHarmony style configuration file. 68e41f4b71Sopenharmony_ci 69e41f4b71Sopenharmony_ci Example: 70e41f4b71Sopenharmony_ci 71e41f4b71Sopenharmony_ci 1. Perform a full build. 72e41f4b71Sopenharmony_ci 73e41f4b71Sopenharmony_ci ```shell 74e41f4b71Sopenharmony_ci cp productdefine/common/base/base_product.json productdefine/common/products/ohos-arm64.json 75e41f4b71Sopenharmony_ci ./build.sh --product-name ohos-arm64 --build-only-gn --ccache --gn-args pycache_enable=true --gn-args check_deps=true --build-only-gn 76e41f4b71Sopenharmony_ci ``` 77e41f4b71Sopenharmony_ci 78e41f4b71Sopenharmony_ci 2. Generate dependency files for the component. 79e41f4b71Sopenharmony_ci 80e41f4b71Sopenharmony_ci ```shell 81e41f4b71Sopenharmony_ci ./build/tools/module_dependence/part_deps.py --deps-files-path out/arm64/deps_files 82e41f4b71Sopenharmony_ci # output: out/arm64/part_deps_info/part_deps_info.json 83e41f4b71Sopenharmony_ci ``` 84e41f4b71Sopenharmony_ci 85e41f4b71Sopenharmony_ci 3. Generate the OpenHarmony style configuration file. 86e41f4b71Sopenharmony_ci 87e41f4b71Sopenharmony_ci ```shell 88e41f4b71Sopenharmony_ci cd build/tools/component_tools 89e41f4b71Sopenharmony_ci python3 parse_kconf.py --deps=/path/to/out/arm64/part_deps_info/part_deps_info.json 90e41f4b71Sopenharmony_ci ``` 91e41f4b71Sopenharmony_ci 92e41f4b71Sopenharmony_ci By default, the file **product.json** is generated in the current directory. You can also use `python3 parse_kconf.py --out="example/out.json"` to specify the file path. 93e41f4b71Sopenharmony_ci 94e41f4b71Sopenharmony_ci For more operations, run `python3 parse_kconf.py -h`. 95e41f4b71Sopenharmony_ci 96e41f4b71Sopenharmony_ci 97e41f4b71Sopenharmony_ci 98e41f4b71Sopenharmony_ci## FAQs 99e41f4b71Sopenharmony_ci 100e41f4b71Sopenharmony_ci### Latest Components Not Displayed in the Menu List 101e41f4b71Sopenharmony_ci 102e41f4b71Sopenharmony_ciThe component list productdefine/common/base/base_product.json is updated with product updates and iterations. The Kconfig menu does not contain the latest components. 103e41f4b71Sopenharmony_ci 104e41f4b71Sopenharmony_ci**Solution** 105e41f4b71Sopenharmony_ci 106e41f4b71Sopenharmony_ciUpdate the [Kconfig file](https://gitee.com/openharmony/build/blob/master/tools/component_tools/kconfig). 107e41f4b71Sopenharmony_ci 108e41f4b71Sopenharmony_ci```shell 109e41f4b71Sopenharmony_cicd build/tools/component_tools 110e41f4b71Sopenharmony_cipython3 generate_kconfig.py 111e41f4b71Sopenharmony_ci``` 112e41f4b71Sopenharmony_ci 113e41f4b71Sopenharmony_ciYou can run `python3 generate_kconfig.py -h` to view more options. 114