@@ -34,7 +34,8 @@ The **bundle.json** file of a component is stored in the root directory of the c
...
@@ -34,7 +34,8 @@ The **bundle.json** file of a component is stored in the root directory of the c
],
],
"third_party": [# Third-party open-source software on which this component depends.
"third_party": [# Third-party open-source software on which this component depends.
"bounds_checking_function"
"bounds_checking_function"
]
],
"hisysevent_config": []# Build entry of the HiSysEvent configuration file.
}
}
"build": {# Build-related configurations.
"build": {# Build-related configurations.
"sub_component": [
"sub_component": [
...
@@ -47,7 +48,9 @@ The **bundle.json** file of a component is stored in the root directory of the c
...
@@ -47,7 +48,9 @@ The **bundle.json** file of a component is stored in the root directory of the c
}
}
```
```
> **CAUTION**<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
...
@@ -61,6 +64,10 @@ component
...
@@ -61,6 +64,10 @@ component
You need to configure the component name, source code path, function description, mandatory or not, build target, RAM, ROM, output, adapted kernel, configurable features, and dependencies.
You need to configure the component name, source code path, function description, mandatory or not, build target, RAM, ROM, output, adapted kernel, configurable features, and dependencies.
> **NOTE**
>
> For details about how to use the HiSysEvent configuration file in component configuration, see [HiSysEvent Logging Configuration](subsys-dfx-hisysevent-logging-config.md).
When adding a component, you must add the component definition to the JSON file of the corresponding subsystem. The component configured for a product must have been defined in a subsystem. Otherwise, the verification will fail.
When adding a component, you must add the component definition to the JSON file of the corresponding subsystem. The component configured for a product must have been defined in a subsystem. Otherwise, the verification will fail.
### Adding and Building a Component
### Adding and Building a Component
...
@@ -134,14 +141,47 @@ When adding a component, you must add the component definition to the JSON file
...
@@ -134,14 +141,47 @@ 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.
Add the component to **//vendor/{*product_company*}/{*product_name*}/config.json**.
The following uses **vendor/hisilicon/hispark_taurus_standard/config.json** as an example:
"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.
For example, add "subsystem_examples:partA" to the product **config.json** file. Then, **partA** will be built and packaged into the distribution.
...
@@ -149,7 +189,7 @@ When adding a component, you must add the component definition to the JSON file
...
@@ -149,7 +189,7 @@ When adding a component, you must add the component definition to the JSON file
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: