1# Building the Kconfig Visual Configuration 2 3## Overview 4 5### Kconfig Visual Configuration 6Kconfig visual configuration is implemented on [Kconfiglib](https://github.com/ulfalizer/Kconfiglib) and [Kconfig](https://www.kernel.org/doc/html/latest/kbuild/kconfig-language.html#introduction). It allows customized configuration of OpenHarmony subsystem components. 7 8Kconfig visual configuration has the following advantages: 9 10- Intuitive display of software component options 11- High reliability (Linux kernel and Buildroot use Kconfig for visualized configuration) 12 13### Basic Concepts 14 15- [Kconfig](https://www.kernel.org/doc/html/latest/kbuild/kconfig-language.html#introduction): a visual configuration file format for Linux. 16 17- [Kconfiglib](https://github.com/ulfalizer/Kconfiglib): a visual configuration tool based on the Kconfig format for Linux. 18 19### Related Modules 20 21- [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. 22 23- [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. 24 25## Operation Guide 26 271. Obtain the source code. 28 29 For details, see [Obtaining Source Code](../get-code/sourcecode-acquire.md). 30 312. Set up the environment. 32 33 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). 34 353. Open the Kconfig configuration interface. 36 37 ```shell 38 # Go to the build repository directory. 39 cd build/tools/component_tools 40 menuconfig kconfig 41 ``` 42 43 ![Kconfig example](./figures/kconfig_interface.png) 44 454. Set parameters. 46 47 For details about the parameters, see [productdefine/common/base/base_product.json](https://gitee.com/openharmony/productdefine_common/blob/master/base/base_product.json). 48 49 ![Setting parameters](./figures/kconfig_set_parameters.gif) 50 515. Select and configure the component. 52 53 1. Press the arrow keys and select a subsystem. The component list of the subsystem is displayed. 54 55 2. Press **Enter** to select a component. 56 57 3. When setting `feature`, use commas (,) to separate multiple values. 58 59 ![Selecting a component](./figures/kconfig_select_component.gif) 60 616. Save the settings. 62 63 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. 64 65 ![Save settings](./figures/kconfig_save.png) 66 677. Generate the OpenHarmony style configuration file. 68 69 Example: 70 71 1. Perform a full build. 72 73 ```shell 74 cp productdefine/common/base/base_product.json productdefine/common/products/ohos-arm64.json 75 ./build.sh --product-name ohos-arm64 --build-only-gn --ccache --gn-args pycache_enable=true --gn-args check_deps=true --build-only-gn 76 ``` 77 78 2. Generate dependency files for the component. 79 80 ```shell 81 ./build/tools/module_dependence/part_deps.py --deps-files-path out/arm64/deps_files 82 # output: out/arm64/part_deps_info/part_deps_info.json 83 ``` 84 85 3. Generate the OpenHarmony style configuration file. 86 87 ```shell 88 cd build/tools/component_tools 89 python3 parse_kconf.py --deps=/path/to/out/arm64/part_deps_info/part_deps_info.json 90 ``` 91 92 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. 93 94 For more operations, run `python3 parse_kconf.py -h`. 95 96 97 98## FAQs 99 100### Latest Components Not Displayed in the Menu List 101 102The component list [productdefine/common/base/base_product.json](https://gitee.com/openharmony/productdefine_common/blob/master/base/base_product.json) is updated with product updates and iterations. The Kconfig menu does not contain the latest components. 103 104**Solution** 105 106Update the [Kconfig file](https://gitee.com/openharmony/build/blob/master/tools/component_tools/kconfig). 107 108```shell 109cd build/tools/component_tools 110python3 generate_kconfig.py 111``` 112 113You can run `python3 generate_kconfig.py -h` to view more options. 114