From 9d80dfd64f817a5183b9089c46f10432cf0a7f10 Mon Sep 17 00:00:00 2001 From: Annie_wang Date: Wed, 29 Mar 2023 16:46:38 +0800 Subject: [PATCH] update docs Signed-off-by: Annie_wang --- en/device-dev/subsystems/subsys-build-all.md | 70 +++++++-------- .../subsystems/subsys-build-reference.md | 86 ++++++++++++++++--- 2 files changed, 111 insertions(+), 45 deletions(-) diff --git a/en/device-dev/subsystems/subsys-build-all.md b/en/device-dev/subsystems/subsys-build-all.md index 7e5d6702fb..a7111d5c13 100644 --- a/en/device-dev/subsystems/subsys-build-all.md +++ b/en/device-dev/subsystems/subsys-build-all.md @@ -143,28 +143,28 @@ To ensure that chipset and product solutions are decoupled from OpenHarmony, you ```shell -/build # Directory for build +/build # Directory for build ├── __pycache__ -├── build_scripts/ # Python scripts for build +├── build_scripts/ # Python scripts for build ├── common/ -├── config/ # Build-related configuration +├── config/ # Build-related configuration ├── core -│ └── gn/ # BUILD.gn configuration +│ └── gn/ # BUILD.gn configuration └── build_scripts/ ├── docs gn_helpers.py* -lite/ # hb and preloader entry +lite/ # hb and preloader entry misc/ -├── ohos # Configuration of OpenHarmony build and packaging -│ ├── kits # Kits build and packaging templates and processing -│ ├── ndk # NDK templates and processing -│ ├── notice # Notice templates and processing -│ ├── packages # Distribution packaging templates and processing -│ ├── sa_profile # SA profiles and processing -│ ├── sdk # SDK templates and processing, which contains the module configuration in the SDK -│ └── testfwk # Testing-related processing -├── ohos.gni* # Common .gni files (facilitating one-time import of each module) +├── ohos # Configuration of OpenHarmony build and packaging +│ ├── kits # Kits build and packaging templates and processing +│ ├── ndk # NDK templates and processing +│ ├── notice # Notice templates and processing +│ ├── packages # Distribution packaging templates and processing +│ ├── sa_profile # SA profiles and processing +│ ├── sdk # SDK templates and processing, which contains the module configuration in the SDK +│ └── testfwk # Testing-related processing +├── ohos.gni* # Common .gni files (facilitating one-time import of each module) ├── ohos_system.prop ├── ohos_var.gni* ├── prebuilts_download.sh* @@ -172,10 +172,10 @@ misc/ ├── scripts/ ├── subsystem_config.json ├── subsystem_config_example.json -├── templates/ # C/C++ build templates +├── templates/ # C/C++ build templates ├── test.gni* -├── toolchain # Build toolchain configuration -├── tools # Common tools +├── toolchain # Build toolchain configuration +├── tools # Common tools ├── version.gni ├── zip.py* @@ -222,25 +222,25 @@ Then, run the build commands in command line (CLI) mode or hb mode. - The **./build.sh** command supports the following options: ```shell - -h, --help # Display help information and exit. - --source-root-dir=SOURCE_ROOT_DIR # Specify the path. - --product-name=PRODUCT_NAME # Specify the product name. - --device-name=DEVICE_NAME # Specify the device name. - --target-cpu=TARGET_CPU # Specify the CPU. - --target-os=TARGET_OS # Specify the operating system. - -T BUILD_TARGET, --build-target=BUILD_TARGET # Specify one or more targets to build. - --gn-args=GN_ARGS # Specify GN parameters. - --ninja-args=NINJA_ARGS # Specify Ninja parameters. - -v, --verbose # Display all commands used. - --keep-ninja-going # Keep Ninja going until 1,000,000 jobs fail. + -h, --help # Display help information and exit. + --source-root-dir=SOURCE_ROOT_DIR # Specify the path. + --product-name=PRODUCT_NAME # Specify the product name. + --device-name=DEVICE_NAME # Specify the device name. + --target-cpu=TARGET_CPU # Specify the CPU. + --target-os=TARGET_OS # Specify the operating system. + -T BUILD_TARGET, --build-target=BUILD_TARGET # Specify one or more targets to build. + --gn-args=GN_ARGS # Specify GN parameters. + --ninja-args=NINJA_ARGS # Specify Ninja parameters. + -v, --verbose # Display all commands used. + --keep-ninja-going # Keep Ninja going until 1,000,000 jobs fail. --jobs=JOBS --export-para=EXPORT_PARA - --build-only-gn # Perform GN parsing and do not run Ninja. - --ccache # (Optional) Use ccache for build. You need to install ccache locally. - --fast-rebuild # Specify whether to allow fast rebuild. The default value is False. - --log-level=LOG_LEVEL # Specify the log level used in the build process. The options are debug, info, and error. The default value is info. - --device-type=DEVICE_TYPE # Specify the device type. The default value is default. - --build-variant=BUILD_VARIANT # Specify the device operation mode. The default value is user. + --build-only-gn # Perform GN parsing and do not run Ninja. + --ccache # (Optional) Use ccache for build. You need to install ccache locally. + --fast-rebuild # Specify whether to allow fast rebuild. The default value is False. + --log-level=LOG_LEVEL # Specify the log level used in the build process. The options are debug, info, and error. The default value is info. + --device-type=DEVICE_TYPE # Specify the device type. The default value is default. + --build-variant=BUILD_VARIANT #Specify the device operation mode. The default value is user. ``` 2. Using the hb tool @@ -381,4 +381,4 @@ You can add and build a product, component, chipset solution, and module. For de - [Information Collected by the Open Source Software Notice](subsys-build-reference.md#information-collected-by-the-open-source-software-notice) - [Parameters for Accelerating Local Build](subsys-build-reference.md#parameters-for-accelerating-local-build) - [Viewing Ninja Build Information](subsys-build-reference.md#viewing-ninja-build-information) - +- [Customizing the chip_prod Image](subsys-build-reference.md#customizing-the-chip_prod-image) diff --git a/en/device-dev/subsystems/subsys-build-reference.md b/en/device-dev/subsystems/subsys-build-reference.md index 49c37d67c3..1d8d952502 100644 --- a/en/device-dev/subsystems/subsys-build-reference.md +++ b/en/device-dev/subsystems/subsys-build-reference.md @@ -55,8 +55,8 @@ The dependency between modules can be classified into **deps** (left in the figu external_deps = [ "part1:module1", ... - ] # Inter-component dependency. The dependent module must be declared in inner_kits by the dependent component. - part_name = "part2" # (Mandatory) Name of the component to which the module belongs. + ] # Inter-component dependency. The dependent module must be declared in inner_kits by the dependent component. + part_name = "part2" # (Mandatory) Name of the component to which the module belongs. } ``` @@ -71,14 +71,14 @@ Sanitizer configuration example: ``` shell ohos_shared_library("example") { sanitize = { - cfi = true # Enable the CFI check. - cfi_cross_dso = true # Enable the cross-DSO CFI check. - integer_overflow = true # Enable the integer overflow check. - boundary_sanitize = true # Enable the bounds check. - ubsan = true # Enable some UBSAN options. - all_ubsan = true # Enable all UBSAN options. - debug = true # Enable the debug mode, which is disabled by default. - blocklist = "./blocklist.txt" # Path of the blocklist. + cfi = true # Enable the CFI check. + cfi_cross_dso = true # Enable the cross-DSO CFI check. + integer_overflow = true # Enable the integer overflow check. + boundary_sanitize = true # Enable the bounds check. + ubsan = true # Enable some UBSAN options. + all_ubsan = true # Enable all UBSAN options. + debug = true # Enable the debug mode, which is disabled by default. + blocklist = "./blocklist.txt" # Path of the blocklist. } ... } @@ -198,3 +198,69 @@ You can graphically display the build time as follows: 1. Click **Success** under **Static Check**. 2. Click **Output** in the **Output** column. The **build.trace.html** file is displayed in the **build_trace** column on the left. Click the file to open it. + +## Customizing the chip_prod Image + +### When to Use + +The different capabilities for the products in the same chip solution are placed in the **chip_prod** partition. You need to generate the **chip_prod.img** specific to the product. + +### Procedure +1. Configure the **config.json** file. + + In the **config.json** file, add **chipprod_config_path**, which specifies the path of the product definition file. + The file is named **chip_product_list.gni**, and in the **chip_product_list = ["productA", "productB", ...]** format. + + Example: + + To customize **chip_prod.img** for **MyProduct**, modify the **//vendor/Product vendor/MyProduct/config.json** as follows: + + ```shell + { + "product_name": "MyProduct", # Product name. + "version": "3.0", # config.json version, which is 3.0. + "chipprod_config_path": "", # (Optional) Path of the chipprod configuration file. + "subsystems": [ + { + "subsystem": "arkui", # Subsystem of the product. + "components": [ + { + "component": "ace_engine", + "features":[ "ace_engine_feature_enable_web = true", + "ace_engine_feature_enable_accessibility = true" ] } + ] + }, + { + ... + } + ... + More subsystems and components. + } + } + ``` + +2. Configure the module. + + If the configuration file has different product configurations, for example, to generate **chip_prod.img** for product A, you need to configure **install_images** and **module_install_dir** for module compilation. + + The following uses **ohos_prebuilt_executable** as an example: + + ```shell + ohos_prebuilt_executable("moduleXXX"){ + install_images = [ "chip_prod" ] + module_install_dir = "productA/etc/***" # The path must start with productA. + } + ``` + +3. Run the build command. +```shell +./build.sh --product-name {product_name} --build-target chip_prod_image +``` + +4. Generate the images. + If products A and B are defined (**chip_product_list = ["productA", "productB"]**) and a module is installed in the products, the following images are generated: + + ``` + images/productA/chip_prod.img + images/productB/chip_prod.img + ``` -- GitLab