harmony 鸿蒙Building the Kconfig Visual Configuration

  • 2022-08-09
  • 浏览 (643)

Building the Kconfig Visual Configuration

Overview

Kconfig Visual Configuration

Kconfig visual configuration is implemented on Kconfiglib and Kconfig. It allows customized configuration of OpenHarmony subsystem components.

Kconfig visual configuration has the following advantages:

  • Intuitive display of software component options
  • High reliability (Linux kernel and Buildroot use Kconfig for visualized configuration)

Basic Concepts

  • Kconfig: a visual configuration file format for Linux.

  • Kconfiglib: a visual configuration tool based on the Kconfig format for Linux.

Related Modules

Operation Guide

  1. Obtain the source code.

For details, see Obtaining Source Code.

  1. Set up the environment.

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.

  1. Open the Kconfig configuration interface.
   # Go to the build repository directory.
   cd build/tools/component_tools
   menuconfig kconfig

Kconfig example

  1. Set parameters.

For details about the parameters, see productdefine/common/base/base_product.json.

Setting parameters

  1. Select and configure the component.

    1. Press the arrow keys and select a subsystem. The component list of the subsystem is displayed.

    2. Press Enter to select a component.

    3. When setting feature, use commas (,) to separate multiple values.

    Selecting a component

  2. Save the settings.

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.

Save settings

  1. Generate the OpenHarmony style configuration file.

Example:

  1. Perform a full build.

      cp productdefine/common/base/base_product.json productdefine/common/products/ohos-arm64.json
      ./build.sh --product-name ohos-arm64  --build-only-gn --ccache --gn-args pycache_enable=true --gn-args check_deps=true --build-only-gn
    
  2. Generate dependency files for the component.

      ./build/tools/module_dependence/part_deps.py --deps-files-path out/arm64/deps_files
      # output: out/arm64/part_deps_info/part_deps_info.json
    
  3. Generate the OpenHarmony style configuration file.

      cd build/tools/component_tools
      python3 parse_kconf.py --deps=/path/to/out/arm64/part_deps_info/part_deps_info.json
    

    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.

    For more operations, run python3 parse_kconf.py -h.

FAQs

Latest Components Not Displayed in the Menu List

The component list productdefine/common/base/base_product.json is updated with product updates and iterations. The Kconfig menu does not contain the latest components.

Solution

Update the Kconfig file.

cd build/tools/component_tools
python3 generate_kconfig.py

You can run python3 generate_kconfig.py -h to view more options.

你可能感兴趣的鸿蒙文章

harmony 鸿蒙Subsystems

harmony 鸿蒙AI Framework Development Guide

harmony 鸿蒙NNRt Access Adaptation

harmony 鸿蒙Application Privilege Configuration

harmony 鸿蒙Development Example

harmony 鸿蒙Setting Up a Development Environment

harmony 鸿蒙Development Guidelines

harmony 鸿蒙Application Framework Overview

harmony 鸿蒙ArkCompiler Development

harmony 鸿蒙Custom Window Title Bar Development

0  赞