未验证 提交 4223e05c 编写于 作者: O openharmony_ci 提交者: Gitee

!22335 [翻译完成】#I7MFEO

Merge pull request !22335 from Annie_wang/PR21100
...@@ -12,7 +12,7 @@ The **bundle.json** file of a component is stored in the root directory of the c ...@@ -12,7 +12,7 @@ The **bundle.json** file of a component is stored in the root directory of the c
"publishAs": "code-segment", # HPM package release mode. The default value is code-segment. "publishAs": "code-segment", # HPM package release mode. The default value is code-segment.
"segment": { "segment": {
"destPath": "" "destPath": ""
}, # Code restoration path (source code path) set when publishAs is code-segment. }, # Code restoration path (source code path) set when publishAs is code-segment.
"dirs": {"base/sensors/sensor_lite"}, # Directory structure of the HPM package. This field is mandatory and can be left empty. "dirs": {"base/sensors/sensor_lite"}, # Directory structure of the HPM package. This field is mandatory and can be left empty.
"scripts": {}, # Scripts to be executed. This field is mandatory and can be left empty. "scripts": {}, # Scripts to be executed. This field is mandatory and can be left empty.
"licensePath": "COPYING", "licensePath": "COPYING",
...@@ -22,7 +22,7 @@ The **bundle.json** file of a component is stored in the root directory of the c ...@@ -22,7 +22,7 @@ The **bundle.json** file of a component is stored in the root directory of the c
"component": { # Component attributes. "component": { # Component attributes.
"name": "sensor_lite", # Component name. "name": "sensor_lite", # Component name.
"subsystem": "", # Subsystem to which the component belongs. "subsystem": "", # Subsystem to which the component belongs.
"syscap": [], # System capabilities provided by the component for applications. "syscap": [], # System capabilities provided by the component for applications.
"features": [], # List of external configurable features of the component. Generally, this parameter corresponds to sub_component in build. "features": [], # List of external configurable features of the component. Generally, this parameter corresponds to sub_component in build.
"adapted_system_type": [], # Types of adapted systems, which can be mini, small, standard, or their combinations. "adapted_system_type": [], # Types of adapted systems, which can be mini, small, standard, or their combinations.
"rom": "92KB", # Component ROM size. "rom": "92KB", # Component ROM size.
...@@ -36,18 +36,20 @@ The **bundle.json** file of a component is stored in the root directory of the c ...@@ -36,18 +36,20 @@ The **bundle.json** file of a component is stored in the root directory of the c
"bounds_checking_function" "bounds_checking_function"
] ]
} }
"build": { # Build-related configurations. "build": { # Build-related configurations.
"sub_component": [ "sub_component": [
""//base/sensors/sensor_lite/services:sensor_service"", # Component build entry. ""//base/sensors/sensor_lite/services:sensor_service"", # Component build entry.
], # Component build entry. Configure modules here. ], # Component build entry. Configure modules here.
"inner_kits": [], # APIs between components. "inner_kits": [], # APIs between components.
"test": [] # Entry for building the component's test cases. "test": [] # Entry for building the component's test cases.
} }
} }
} }
``` ```
> ![icon-note.gif](public_sys-resources/icon-note.gif) **NOTE**<br>Existing components on the LiteOS are configured in the JSON file of the corresponding subsystem in the **build/lite/components** directory. The directory is named in the **{Domain}/{Subsystem}/{Component}** format. The component directory structure is as follows: > **CAUTION**
>
> Existing components on the LiteOS are configured in the JSON file of the corresponding subsystem in the **build/lite/components** directory. The directory is named in the **{Domain}/{Subsystem}/{Component}** format. The component directory structure is as follows:
```shell ```shell
component component
...@@ -123,7 +125,7 @@ When adding a component, you must add the component definition to the JSON file ...@@ -123,7 +125,7 @@ When adding a component, you must add the component definition to the JSON file
deps = [ # Dependent modules in the component deps = [ # Dependent modules in the component
"../feature1:helloworld_lib" "../feature1:helloworld_lib"
] ]
external_deps = [ "partB:module1" ] # (Optional) Dependent modules of another component are named in the Component name:Module name format. external_deps = [ "partB:module1" ] # (Optional) Dependent modules of another component are named in the Component name:Module name format.
install_enable = true # By default, executable programs are not installed. Set this parameter to true if an executable program needs to be installed. install_enable = true # By default, executable programs are not installed. Set this parameter to true if an executable program needs to be installed.
part_name = "partA" part_name = "partA"
} }
...@@ -134,22 +136,55 @@ When adding a component, you must add the component definition to the JSON file ...@@ -134,22 +136,55 @@ When adding a component, you must add the component definition to the JSON file
```shell ```shell
ohos_prebuilt_etc("feature3_etc") { ohos_prebuilt_etc("feature3_etc") {
source = "src/config.conf" source = "src/config.conf"
relative_install_dir = "init" # (Optional) Relative directory for installing the module. The default installation directory is **/system/etc**. relative_install_dir = "init" # (Optional) Relative directory for installing the module. The default installation directory is /system/etc.
part_name = "partA" part_name = "partA"
} }
``` ```
(d) Add the module configuration **test/examples/bundle.json** to the **bundle.json** file of the component. Each component has a **bundle.json** file in the root directory of the component. For details, see the [component bundle.json file](subsys-build-component.md#configuration-rules). (d) Add the module configuration **test/examples/bundle.json** to the **bundle.json** file of the component. Each component has a **bundle.json** file in the root directory of the component. For details, see the [component bundle.json file](subsys-build-component.md#configuration-rules).
2. Add the component to **//vendor/{*product_company*}/{*product_name*}/config.json**. 2. Add the component to the product configuration file.
For example, add "subsystem_examples:partA" to the product **config.json** file. Then, **partA** will be built and packaged into the distribution. Add the component to **//vendor/{*product_company*}/{*product_name*}/config.json**.
The following uses **vendor/hisilicon/hispark_taurus_standard/config.json** as an example:
```shell
{
"product_name": "hispark_taurus_standard",
"device_company": "hisilicon",
"device_build_path": "device/board/hisilicon/hispark_taurus/linux",
"target_cpu": "arm",
"type": "standard",
"version": "3.0",
"board": "hispark_taurus",
"inherit": [ "productdefine/common/base/standard_system.json",
"productdefine/common/inherit/ipcamera.json"
],
"enable_ramdisk": true,
"subsystems": [
{
"subsystem": "subsystem_examples", # Subsystem to which the component belongs.
"components": [
{
"component": "partA", # Component name.
"features": [] # Configurable features of the component.
}
]
},
···
}
```
The configuration file contains information about the the product name and chip vendor. **inherit** specifies the dependent, and **subsystems** specifies the components other than the common components.
For example, add "subsystem_examples:partA" to the product **config.json** file. Then, **partA** will be built and packaged into the distribution.
3. Start the build. 3. Start the build.
You can start the build by using the [CLI or hb tool](subsys-build-all.md#build-commands). The following uses the CLI as an example: You can start the build by using the [CLI or hb tool](subsys-build-all.md#build-commands). The following uses the CLI as an example:
You can run '--build-target componentName' to build a component separately. For example, to build the musl component of hispark_taurus_standard, run the following command: You can run '**--build-target *componentName***' to build a component separately. For example, to build the musl component of hispark_taurus_standard, run the following command:
``` ```
./build.sh --product-name hispark_taurus_standard --build-target musl --ccache ./build.sh --product-name hispark_taurus_standard --build-target musl --ccache
...@@ -163,4 +198,4 @@ When adding a component, you must add the component definition to the JSON file ...@@ -163,4 +198,4 @@ When adding a component, you must add the component definition to the JSON file
4. Obtain the build result. 4. Obtain the build result.
You can obtain the generated files from the **out/hispark_taurus/** directory and the image in the **out/hispark_taurus/packages/phone/images/** directory. You can obtain the generated files from the **out/hispark_taurus/** directory and the image in the **out/hispark_taurus/packages/phone/images/** directory.
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册