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

!9976 [翻译完成】#I5PG68

Merge pull request !9976 from Annie_wang/PR9048
...@@ -193,20 +193,34 @@ Then, run the build commands in command line (CLI) mode or hb mode. ...@@ -193,20 +193,34 @@ Then, run the build commands in command line (CLI) mode or hb mode.
1. Using the CLI 1. Using the CLI
Run the following command in the root directory of the source code to build a full distribution: - Run the following command in the root directory of the source code to build a full distribution:
```shell Release version:
./build.sh --product-name {product_name}
``` ```shell
./build.sh --product-name {product_name}
**{product_name}** specifies the product platform supported by the current distribution, for example, **hispark_taurus_standard**. ```
The image generated is stored in the **out/{device_name}/packages/phone/images/** directory. Debug version:
The **./build.sh** command supports the following options: ```shell
./build.sh --product-name {product_name} --gn-args is_debug=true
```shell ```
-h, --help # Display help information and exit.
![icon-note.gif](public_sys-resources/icon-note.gif) **NOTE**<br>Due to the limitation of the image size, the full build for the debug version may fail to be burnt. You are advised to build the binary file for each module separately. Run the following command to build a module separately:
```shell
./build.sh --product-name {product_name} --gn-args is_debug=true --build-target {target_name}
```
**{product_name}** specifies the product platform supported by the current distribution, for example, **hispark_taurus_standard**.
The image generated is stored in the **out/{device_name}/packages/phone/images/** directory.
- 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. --source-root-dir=SOURCE_ROOT_DIR # Specify the path.
--product-name=PRODUCT_NAME # Specify the product name. --product-name=PRODUCT_NAME # Specify the product name.
--device-name=DEVICE_NAME # Specify the device name. --device-name=DEVICE_NAME # Specify the device name.
...@@ -224,131 +238,126 @@ Then, run the build commands in command line (CLI) mode or hb mode. ...@@ -224,131 +238,126 @@ Then, run the build commands in command line (CLI) mode or hb mode.
--fast-rebuild # Specify whether to allow fast rebuild. The default value is False. --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. --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. --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-variant=BUILD_VARIANT #Specify the device operation mode. The default value is user.
``` ```
2. Using the hb tool
2. Using the hb tool **hb** is an OpenHarmony command line tool for executing build commands. Common hb commands are described as follows:
**hb** is an OpenHarmony command line tool for executing build commands. Common hb commands are described as follows: **hb set**
**hb set** Sets the product to build.
Sets the product to build. ```shell
hb set -h
```shell usage: hb set [-h] [-root [ROOT_PATH]] [-p]
hb set -h
usage: hb set [-h] [-root [ROOT_PATH]] [-p] optional arguments:
-h, --help show this help message and exit
optional arguments: -root [ROOT_PATH], --root_path [ROOT_PATH]
-h, --help show this help message and exit Set OHOS root path
-root [ROOT_PATH], --root_path [ROOT_PATH] -p, --product Set OHOS board and kernel
Set OHOS root path ```
-p, --product Set OHOS board and kernel
``` - If you run **hb set** with no argument, the default setting process starts.
- You can run **hb set -root** *dir* to set the root directory of the source code.
- If you run **hb set** with no argument, the default setting process starts.
- You can run **hb set -p** to set the product to build.
- You can run **hb set -root** *dir* to set the root directory of the source code.
- You can run **hb set -p** to set the product to build.
**hb env**
Displays current settings.
**hb env**
```shell
Displays current settings. hb env
[OHOS INFO] root path: xxx
```shell [OHOS INFO] board: hispark_taurus
hb env [OHOS INFO] kernel: liteos
[OHOS INFO] root path: xxx [OHOS INFO] product: ipcamera
[OHOS INFO] board: hispark_taurus [OHOS INFO] product path: xxx/vendor/hisilicon/ipcamera
[OHOS INFO] kernel: liteos [OHOS INFO] device path: xxx/device/hisilicon/hispark_taurus/sdk_linux_4.19
[OHOS INFO] product: ipcamera ```
[OHOS INFO] product path: xxx/vendor/hisilicon/ipcamera
[OHOS INFO] device path: xxx/device/hisilicon/hispark_taurus/sdk_linux_4.19
```
**hb build**
Builds a product, component, module, or chipset solution.
**hb build**
```shell
Builds a product, component, module, or chipset solution. hb build -h
usage: hb build [-h] [-b BUILD_TYPE] [-c COMPILER] [-t [TEST [TEST ...]]] [-cpu TARGET_CPU] [--dmverity] [--tee]
```shell [-p PRODUCT] [-f] [-n] [-T [TARGET [TARGET ...]]] [-v] [-shs] [--patch] [--compact-mode]
hb build -h [--gn-args GN_ARGS] [--keep-ninja-going] [--build-only-gn] [--log-level LOG_LEVEL] [--fast-rebuild]
usage: hb build [-h] [-b BUILD_TYPE] [-c COMPILER] [-t [TEST [TEST ...]]] [-cpu TARGET_CPU] [--dmverity] [--tee] [--device-type DEVICE_TYPE] [--build-variant BUILD_VARIANT]
[-p PRODUCT] [-f] [-n] [-T [TARGET [TARGET ...]]] [-v] [-shs] [--patch] [--compact-mode] [component [component ...]]
[--gn-args GN_ARGS] [--keep-ninja-going] [--build-only-gn] [--log-level LOG_LEVEL] [--fast-rebuild]
[--device-type DEVICE_TYPE] [--build-variant BUILD_VARIANT] positional arguments:
[component [component ...]] component name of the component, mini/small only
positional arguments: optional arguments:
component name of the component, mini/small only -h, --help show this help message and exit
-b BUILD_TYPE, --build_type BUILD_TYPE
optional arguments: release or debug version, mini/small only
-h, --help show this help message and exit -c COMPILER, --compiler COMPILER
-b BUILD_TYPE, --build_type BUILD_TYPE specify compiler, mini/small only
release or debug version, mini/small only -t [TEST [TEST ...]], --test [TEST [TEST ...]]
-c COMPILER, --compiler COMPILER compile test suit
specify compiler, mini/small only -cpu TARGET_CPU, --target-cpu TARGET_CPU
-t [TEST [TEST ...]], --test [TEST [TEST ...]] select cpu
compile test suit --dmverity enable dmverity
-cpu TARGET_CPU, --target-cpu TARGET_CPU --tee Enable tee
select cpu -p PRODUCT, --product PRODUCT
--dmverity enable dmverity build a specified product with {product_name}@{company}
--tee Enable tee -f, --full full code compilation
-p PRODUCT, --product PRODUCT -n, --ndk compile ndk
build a specified product with {product_name}@{company} -T [TARGET [TARGET ...]], --target [TARGET [TARGET ...]]
-f, --full full code compilation compile single target
-n, --ndk compile ndk -v, --verbose show all command lines while building
-T [TARGET [TARGET ...]], --target [TARGET [TARGET ...]] -shs, --sign_haps_by_server
compile single target sign haps by server
-v, --verbose show all command lines while building --patch apply product patch before compiling
-shs, --sign_haps_by_server --compact-mode compatible with standard build system set to false if we use build.sh as build entrance
sign haps by server --gn-args GN_ARGS specifies gn build arguments, eg: --gn-args="foo="bar" enable=true blah=7"
--patch apply product patch before compiling --keep-ninja-going keeps ninja going until 1000000 jobs fail
--compact-mode compatible with standard build system set to false if we use build.sh as build entrance --build-only-gn only do gn parse, donot run ninja
--gn-args GN_ARGS specifies gn build arguments, eg: --gn-args="foo="bar" enable=true blah=7" --log-level LOG_LEVEL
--keep-ninja-going keeps ninja going until 1000000 jobs fail specifies the log level during compilationyou can select three levels: debug, info and error
--build-only-gn only do gn parse, donot run ninja --fast-rebuild it will skip prepare, preloader, gn_gen steps so we can enable it only when there is no change
--log-level LOG_LEVEL for gn related script
specifies the log level during compilationyou can select three levels: debug, info and error --device-type DEVICE_TYPE
--fast-rebuild it will skip prepare, preloader, gn_gen steps so we can enable it only when there is no change specifies device type
for gn related script --build-variant BUILD_VARIANT
--device-type DEVICE_TYPE specifies device operating mode
specifies device type ```
--build-variant BUILD_VARIANT
specifies device operating mode - If you run **hb build** with no argument, the previously configured code directory, product, and options are used for the build. The **-f** option deletes all products to be built. It is equivalent to running **hb clean** and **hb build**.
``` - You can run **hb build** *{component_name}* to build product components separately based on the development board and kernel set for the product, for example, **hb build kv_store**.
- You can run **hb build -p ipcamera@hisilicon** to skip the setting step and build the product directly.
- If you run **hb build** with no argument, the previously configured code directory, product, and options are used for the build. The **-f** option deletes all products to be built. It is equivalent to running **hb clean** and **hb build**.
- You can run **hb build** in **device/board/device_company** to select the kernel and build an image that contains the kernel and drivers only based on the current development board and the selected kernel.
- You can run **hb build** *{component_name}* to build product components separately based on the development board and kernel set for the product, for example, **hb build kv_store**.
- You can run **hb build -p ipcamera@hisilicon** to skip the setting step and build the product directly.
**hb clean**
- You can run **hb build** in **device/board/device_company** to select the kernel and build an image that contains the kernel and drivers only based on the current development board and the selected kernel.
Deletes all the files except **args.gn** and **build.log** in the **out** directory (default). To clear files in a specified directory, add the directory parameter to the command, for example, **hb clean out/board/product**.
```shell
**hb clean** hb clean
usage: hb clean [-h] [out_path]
Deletes all the files except **args.gn** and **build.log** in the **out** directory (default). To clear files in a specified directory, add the directory parameter to the command, for example, **hb clean out/board/product**.
positional arguments:
```shell out_path clean a specified path.
hb clean
usage: hb clean [-h] [out_path] optional arguments:
-h, --help show this help message and exit
positional arguments: ```
out_path clean a specified path.
optional arguments:
-h, --help show this help message and exit
```
### Building Procedures ### Building Procedures
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册