提交 8e07568f 编写于 作者: A Annie_wang

update docs

Signed-off-by: NAnnie_wang <annie.wangli@huawei.com>
......@@ -102,10 +102,12 @@ You must install the software packages required for build. The command is as fol
- Method 2: Run the **apt-get install** and **pip3 install** commands.
```shell
apt-get update -y
apt-get install -y apt-utils binutils bison flex bc build-essential make mtd-utils gcc-arm-linux-gnueabi u-boot-tools python3.9.2 python3-pip git zip unzip curl wget gcc g++ ruby dosfstools mtools default-jre default-jdk scons python3-distutils perl openssl libssl-dev cpio git-lfs m4 ccache zlib1g-dev tar rsync liblz4-tool genext2fs binutils-dev device-tree-compiler e2fsprogs git-core gnupg gnutls-bin gperf lib32ncurses5-dev libffi-dev zlib* libelf-dev libx11-dev libgl1-mesa-dev lib32z1-dev xsltproc x11proto-core-dev libc6-dev-i386 libxml2-dev lib32z-dev libdwarf-dev
apt-get install -y
# Install Python 3.9 for Ubuntu 20.04, and install Python 3.8 for Ubuntu 18.04.
apt-get install -y apt-utils binutils bison flex bc build-essential make mtd-utils gcc-arm-linux-gnueabi u-boot-tools python3.9 python3-pip git zip unzip curl wget gcc g++ ruby dosfstools mtools default-jre default-jdk scons python3-distutils perl openssl libssl-dev cpio git-lfs m4 ccache zlib1g-dev tar rsync liblz4-tool genext2fs binutils-dev device-tree-compiler e2fsprogs git-core gnupg gnutls-bin gperf lib32ncurses5-dev libffi-dev zlib* libelf-dev libx11-dev libgl1-mesa-dev lib32z1-dev xsltproc x11proto-core-dev libc6-dev-i386 libxml2-dev lib32z-dev libdwarf-dev
apt-get install -y grsync xxd libglib2.0-dev libpixman-1-dev kmod jfsutils reiserfsprogs xfsprogs squashfs-tools pcmciautils quota ppp libtinfo-dev libtinfo5 libncurses5 libncurses5-dev libncursesw5 libstdc++6 gcc-arm-none-eabi vim ssh locales doxygen
apt-get install -y libxinerama-dev libxcursor-dev libxrandr-dev libxi-dev
# The following modules must be installed for Python. You can obtain the **repo** file from the source code of the build environment mentioned in **Constraints**.
# The following modules must be installed for Python. You can obtain the repo file from the source code of the build environment you use.
chmod +x /usr/bin/repo
pip3 install --trusted-host https://repo.huaweicloud.com -i https://repo.huaweicloud.com/repository/pypi/simple requests setuptools pymongo kconfiglib pycryptodome ecdsa ohos-build pyyaml prompt_toolkit==1.0.14 redis json2html yagmail python-jenkins
pip3 install esdk-obs-python --trusted-host pypi.org
......@@ -170,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*
......@@ -207,18 +209,21 @@ Then, run the build commands in command line (CLI) mode or hb mode.
./build.sh --product-name {product_name} --gn-args is_debug=true
```
![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}
```
>![icon-caution.gif](../public_sys-resources/icon-caution.gif) **CAUTION**<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:
>
>```
>./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.
......@@ -240,6 +245,9 @@ Then, run the build commands in command line (CLI) mode or hb mode.
--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
......@@ -357,7 +365,9 @@ Then, run the build commands in command line (CLI) mode or hb mode.
-h, --help show this help message and exit
```
> ![icon-note.gif](public_sys-resources/icon-note.gif) **NOTE**<br/>
> - For details about how to set up the build environment and perform the build, see the related topics in [Getting Started](../quick-start/Readme-EN.md).
> - OpenHarmony also provides the Docker environment, which spares the installation of the build tool. For details, see [Docker Environment](../get-code/gettools-acquire.md).
### Building Procedures
......@@ -375,6 +385,7 @@ You can add and build a product, component, chipset solution, and module. For de
## Reference
- [deps and external_deps](subsys-build-reference.md#deps-and-external_deps)
- [Using Sanitizer](subsys-build-reference.md#using-sanitizer)
- [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)
......@@ -10,7 +10,7 @@ When adding a module, you must declare its dependencies in **BUILD.gn**. **deps*
The dependency between modules can be classified into **deps** (left in the figure above) and **external_deps** (right in the figure above).
- **deps**: The dependent module to be added belongs to the same part with the current module. For example, module 2 depends on module 1, and both modules 1 and 2 belong to the same component.
- **deps**: The dependent module to be added belongs to the same part with the current module. For example, module 2 depends on module 1, and both modules 1 and 2 belong to the same component.
- **external_deps**: The dependent module to be added belongs to another component. For example, module 2 depends on module 1, and modules 1 and 2 belong to different components.
......@@ -32,8 +32,8 @@ The dependency between modules can be classified into **deps** (left in the figu
deps = [
"GN target of module 1",
...
] # Intra-component dependency
part_name = "part1" # (Mandatory) Name of the component to which the module belongs.
] # Intra-component dependency
part_name = "part1" # (Mandatory) Name of the component to which the module belongs.
}
```
......@@ -55,12 +55,61 @@ 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.
}
```
![icon-note.gif](public_sys-resources/icon-note.gif) **NOTE**<br>The dependency between components must be written in the format of **Component_name:Module_name** in **external_deps**. The dependent module must be declared in **inner_kits**.
![icon-note.gif](public_sys-resources/icon-note.gif) **NOTE**<br>The dependency between components must be written in the format of **Component name:Module name** in **external_deps**. The dependent module must be declared in **inner_kits**.
## Using Sanitizer
When adding a module, you can enable Sanitizer features, such as the integer overflow detection and control-flow integrity (CFI) check, provided by the compiler as required. Each configuration item is optional. It is **false** by default, and can also be left empty.
The following is an example of Sanitizer configuration:
``` shell
ohos_shared_library("example") {
sanitize = {
cfi = true
integer_overflow = true
debug = true # Optional. The default mode is disabled by default.
blocklist = "./blocklist.txt" # Optional. Enter the path of the blocklist.
}
...
}
```
**Supported Sanitizer Features**
- Integer overflow detection: includes detection of unsigned intergers (unsigned_integer_overflow), signed integers (signed_integer_overflow detection), and both (integer_overflow).
- CFI: prevents malware attacks from redirecting the control flow of a program.
**Other Sanitizer Settings**
- Debug: specifies whether the debug mode or the release mode is used. The default value **false** indicates that the release mode is used. The value **true** explicitly declares the debug mode. This option is not provided in the build of the release version.
Sanitizer is used to locate problems during development, which is irrelevant to the debug version built. In debug mode, abundant error-related information is provided to help locate errors. When an error occurs, the program will be restored instead of being interrupted to further identify subsequent errors.
In release mode, the program will be directly interrupted when an error occurs to protect the system against errors or maliciously attacks.
- Blocklist: specifies the functions or source programs that are not affected by Sanitizer in the module. It prevents benign behavior from being identified as errors or hotspot functions from generating unreasonable and unacceptable overheads. Exercise caution when using this function.
Blocklist example:
```
[cfi]
fun:*([Tt]est|TEST)*
fun: main
[integer]
src:example/*.cpp
```
## Information Collected by the Open Source Software Notice
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册
反馈
建议
客服 返回
顶部