提交 1e8be39f 编写于 作者: O openharmony_ci 提交者: Gitee

!285 master更新同步release分支

Merge pull request !285 from NEEN/master
......@@ -53,7 +53,7 @@ This layer provides with what you need to develop OpenHarmony applications: appl
**Application layer**
This layer consists of system applications and third-party applications. Each OpenHarmony application is powered by one or more Feature Abilities \(FAs\) or Particle Abilities \(PA\). An FA provides a UI for user interaction. A PA has no UI and provides background task processing as well as data access. Applications developed based on FAs and PAs provide specific service characteristics and enable cross-device scheduling and distribution, delighting users with consistent and efficient experience.
This layer consists of system applications and third-party applications. Each OpenHarmony application is powered by one or more Feature Abilities \(FAs\) or Particle Abilities \(PAs\). An FA provides a UI for user interaction. A PA has no UI and provides background task processing as well as data access. Applications developed based on FAs and PAs provide specific service characteristics and enable cross-device scheduling and distribution, delighting users with consistent and efficient experience.
## Technical Features<a name="section12212842173518"></a>
......@@ -218,7 +218,7 @@ For details about the subsystems in the following table, see [https://gitee.com
</tr>
<tr id="row198318945311"><td class="cellrowborder" align="left" valign="top" width="13%" headers="mcps1.1.4.1.1 "><p id="p25014935113"><a name="p25014935113"></a><a name="p25014935113"></a>Testing</p>
</td>
<td class="cellrowborder" align="left" valign="top" width="75%" headers="mcps1.1.4.1.2 "><p id="p1950149205111"><a name="p1950149205111"></a><a name="p1950149205111"></a>The development process is tset driven. You can develop new cases or modify existing cases to test new or enhanced system features. The test helps you develop high-quality code in the development phase.</p>
<td class="cellrowborder" align="left" valign="top" width="75%" headers="mcps1.1.4.1.2 "><p id="p1950149205111"><a name="p1950149205111"></a><a name="p1950149205111"></a>The development process is test driven. You can develop new cases or modify existing cases to test new or enhanced system features. The test helps you develop high-quality code in the development phase.</p>
</td>
<td class="cellrowborder" align="left" valign="top" width="12%" headers="mcps1.1.4.1.3 "><p id="p450117935113"><a name="p450117935113"></a><a name="p450117935113"></a><a href="https://gitee.com/openharmony/docs/blob/master/en/readme/testing-subsystem.md" target="_blank" rel="noopener noreferrer">README</a></p>
</td>
......@@ -248,7 +248,7 @@ For details about the subsystems in the following table, see [https://gitee.com
</td>
<td class="cellrowborder" align="left" valign="top" width="75%" headers="mcps1.1.4.1.2 "><p id="p050219175120"><a name="p050219175120"></a><a name="p050219175120"></a>The power management subsystem provides capabilities such as querying the battery charging/discharging status and managing the system power. Currently, available capabilities include querying the battery level and keeping the device screen always on.</p>
</td>
<td class="cellrowborder" align="left" valign="top" width="12%" headers="mcps1.1.4.1.3 "><p id="p20502119175116"><a name="p20502119175116"></a><a name="p20502119175116"></a><a href="https://gitee.com/openharmony/docs/blob/master/en/readme/lite-power-management.md" target="_blank" rel="noopener noreferrer">README</a></p>
<td class="cellrowborder" align="left" valign="top" width="12%" headers="mcps1.1.4.1.3 "><p id="p20502119175116"><a name="p20502119175116"></a><a name="p20502119175116"></a><a href="https://gitee.com/openharmony/docs/blob/master/en/readme/power-management.md" target="_blank" rel="noopener noreferrer">README</a></p>
</td>
</tr>
<tr id="row163116577176"><td class="cellrowborder" align="left" valign="top" width="13%" headers="mcps1.1.4.1.1 "><p id="p185021915120"><a name="p185021915120"></a><a name="p185021915120"></a>Update</p>
......@@ -331,13 +331,13 @@ For details about how to obtain the source code of OpenHarmony, see [Source Cod
## How to Participate<a name="section19611528174215"></a>
For details about how to join in the OpenHarmony community, see [OpenHarmony Community](https://gitee.com/openharmony/community/blob/master/README.md).
For details about how to join the OpenHarmony community, see [OpenHarmony Community](https://gitee.com/openharmony/community/blob/master/README.md).
For details about how to contribute, see [Contribution](https://gitee.com/openharmony/docs/blob/master/en/contribute/contribution.md).
For details about how to contribute, see [Contribution](https://gitee.com/openharmony/docs/blob/master/en/contribute/contribution.md).
## License Agreement<a name="section1245517472115"></a>
OpenHarmony is open-source. For details, see the LICENSE in each repository.
OpenHarmony mainly complies with Apache License v2.0. For details, see the LICENSE in each repository.
## Contact Info<a name="section61728335424"></a>
......
......@@ -235,7 +235,7 @@ OpenHarmony支持如下几种设备类型:
</td>
<td class="cellrowborder" valign="top" width="75.85758575857585%" headers="mcps1.2.4.1.2 "><p id="p13967237151716"><a name="p13967237151716"></a><a name="p13967237151716"></a>电源管理子系统主要提供了电池、充放电状态查询能力和系统电源管理服务能力,目前主要包括电量查询和亮灭屏控制锁的能力。</p>
</td>
<td class="cellrowborder" valign="top" width="10.76107610761076%" headers="mcps1.2.4.1.3 "><p id="p782825121818"><a name="p782825121818"></a><a name="p782825121818"></a><a href="https://gitee.com/openharmony/docs/blob/master/zh-cn/readme/轻量级电源管理子系统.md" target="_blank" rel="noopener noreferrer">README</a></p>
<td class="cellrowborder" valign="top" width="10.76107610761076%" headers="mcps1.2.4.1.3 "><p id="p782825121818"><a name="p782825121818"></a><a name="p782825121818"></a><a href="https://gitee.com/openharmony/docs/blob/master/zh-cn/readme/电源管理子系统.md" target="_blank" rel="noopener noreferrer">README</a></p>
</td>
</tr>
<tr id="row163116577176"><td class="cellrowborder" valign="top" width="13.381338133813381%" headers="mcps1.2.4.1.1 "><p id="p143265731720"><a name="p143265731720"></a><a name="p143265731720"></a>升级服务</p>
......@@ -321,9 +321,13 @@ English Version:[OpenHarmony Documentation](https://gitee.com/openharmony/docs
参与贡献:[如何贡献链接](https://gitee.com/openharmony/docs/blob/master/zh-cn/contribute/%E5%8F%82%E4%B8%8E%E8%B4%A1%E7%8C%AE.md)
参与API治理:[OpenHarmony API治理章程](https://gitee.com/openharmony/docs/tree/master/zh-cn/design/OpenHarmony-API-governance.md)
## 许可协议<a name="section1245517472115"></a>
OpenHarmony是一种开源软件,参考各仓下LICENSE文本。
OpenHarmony主要遵循Apache License V2.0协议,详情请参考各代码仓LICENSE声明。
OpenHarmony引用三方开源软件及许可证说明,参考[第三方开源软件说明](https://gitee.com/openharmony/docs/blob/master/zh-cn/contribute/%E7%AC%AC%E4%B8%89%E6%96%B9%E5%BC%80%E6%BA%90%E8%BD%AF%E4%BB%B6%E5%8F%8A%E8%AE%B8%E5%8F%AF%E8%AF%81%E8%AF%B4%E6%98%8E.md)
## 联系方式<a name="section61728335424"></a>
......
......@@ -25,7 +25,7 @@ OpenHarmony is an open-source community and encourages everyone in the community
- [Contributing to the Code](en/contribute/contributing-code.md)
- [Contributing to the Documentation](en/contribute/documentation-contribution.md)
For more details on how to contribute, see [Contributing Documents](en/contibute).
For more details on how to contribute, see [Contributing Documents](en/contribute).
## Get Source Code and Tools
To download the source code and tools required for the project, click the following links:
- [Source Code Acquisition](en/device-dev/get-code/source-code-acquisition.md)
......
......@@ -17,8 +17,8 @@ For details, see [Contribution Process](contribution-process.md).
## Security Issue Disclosure<a name="en-us_topic_0000001051566732_section725624119448"></a>
- Security handling procedure
- [Security Issue Handling and Release Processes](https://gitee.com/openharmony/security/blob/master/en/security-process/README.md)
- Security disclosure information
- [OpenHarmony Security and Disclosure Statement](https://gitee.com/openharmony/security/blob/master/en/security-process/security-disclosure.md)
......@@ -10,7 +10,7 @@
## Preparations<a name="section124971410183614"></a>
- Install, configure, and use Git. For details, visit [https://gitee.com/help/categories/43](https://gitee.com/help/categories/43).
- Register an SSH public key. For details, visit [https://gitee.com/help/articles/4181](https://gitee.com/help/articles/4181).
- Register an SSH public key. For details, visit [https://gitee.com/help/articles/4191](https://gitee.com/help/articles/4191).
- Find the repository that you are interested in on the code hosting platform of OpenHarmony.
## Downloading Code<a name="section6125202333611"></a>
......@@ -122,7 +122,7 @@ Perform the following steps to download the code in the repository to your compu
repo config --global repo.token {TOKEN}
```
The token is generated by choosing **Settings** \> **Security Settings** \> **Private Token** on Gitee. Example:
The token is generated by choosing **Settings** \> **Security Settings** \> [**Private Token**](https://gitee.com/profile/personal_access_tokens) on Gitee. Example:
```
repo config --global repo.token 211XXXXXXXXXXXXXXXXXXXXXXXX
......
......@@ -4,8 +4,7 @@
- [HPM-based Docker](#en-us_topic_0000001055701144_section580016182283)
- [Standalone Docker Environment](#en-us_topic_0000001055701144_section319412277287)
- [Setting Up the Docker Environment](#en-us_topic_0000001055701144_section436042904715)
- [Building for and](#en-us_topic_0000001055701144_section19121250134716)
- [Setting Up the Docker Environment for](#en-us_topic_0000001055701144_section776616712419)
- [Building](#en-us_topic_0000001055701144_section19121250134716)
- [Acquiring the Device Development Tool \(HUAWEI DevEco Device Tool\)](#en-us_topic_0000001055701144_section2452141120244)
- [Acquiring the Application Development Tool \(HUAWEI DevEco Studio\)](#en-us_topic_0000001055701144_section0904101019258)
......@@ -103,7 +102,7 @@ Start building. The following takes ip\_camera\_hi3518ev300 as an example. Docke
The following will be displayed if the building is successful:
```
......
...
ohos ipcamera_hi3518 build success!
@ohos/ip_camera_hi3518ev300: distribution building completed.
```
......@@ -128,7 +127,7 @@ Start building. The following takes ip\_camera\_hi3518ev300 as an example. Docke
The Docker image of OpenHarmony is hosted on [HUAWEI Cloud SWR](https://auth.huaweicloud.com/authui/login.html?service=https%3A%2F%2Fconsole.huaweicloud.com%2Fswr%2F%3Fregion%3Dcn-south-1%26cloud_route_state%3D%2Fapp%2Fwarehouse%2FwarehouseMangeDetail%2Fgoldensir%2Fopenharmony-docker%2Fopenharmony-docker%3Ftype%3DownImage&locale=en-us#/login). Using the Docker image will help simplify environment configurations needed for the building. After configuring the development environments, perform the steps below to access the Docker environment. The following steps use Ubuntu as an example \(Windows is also supported\).
### Setting Up the Docker Environment<a name="en-us_topic_0000001055701144_section436042904715"></a>
### Setting Up the Docker Environment for Mini-System Devices \(reference memory ≥ 128 KB\) and Small-System Devices \(reference memory ≥ 1 MB\)<a name="en-us_topic_0000001055701144_section436042904715"></a>
**Method 1: Obtaining the Docker image from HuaweiCloud SWR**
......@@ -207,50 +206,11 @@ The following uses the Hi3516 platform as an example to describe the build proce
The files will be generated in the **out/hispark\_taurus/ipcamera\_hispark\_taurus** directory.
### Setting Up the Docker Environment for Large-System Devices \(reference memory ≥ 1 GB\)<a name="en-us_topic_0000001055701144_section776616712419"></a>
**Method 1: Obtaining the Docker image from HuaweiCloud SWR**
1. Obtain the Docker image.
```
docker pull swr.cn-south-1.myhuaweicloud.com/openharmony-docker/openharmony-docker:0.0.3
```
2. Go to the root directory of OpenHarmony code and run the following command to access the Docker build environment:
```
docker run -it -v $(pwd):/home/openharmony swr.cn-south-1.myhuaweicloud.com/openharmony-docker/openharmony-docker:0.0.3
```
**Method 2: Using the Dockerfile to Build a Local Docker Image**
1. Obtain the Dockerfile script for a local Docker image.
```
git clone https://gitee.com/openharmony/docs.git
```
2. Go to the directory of the Dockerfile code and run the following command to build the Docker image:
```
cd docs/docker
./build.sh
```
3. Go to the root directory of OpenHarmony code and run the following command to access the Docker build environment:
```
docker run -it -v $(pwd):/home/openharmony openharmony-docker:0.0.3
```
## Acquiring the Device Development Tool \(HUAWEI DevEco Device Tool\)<a name="en-us_topic_0000001055701144_section2452141120244"></a>
HUAWEI DevEco Device Tool is a one-stop integrated development environment \(IDE\) provided to develop applications for HarmonyOS-based smart devices. It allows on-demand customization of HarmonyOS components, code editing, compilation, burning, and debugging, and supports C and C++ languages. This tool is installed in Visual Studio Code as a plug-in. For details, see [Tool Acquisition](https://device.harmonyos.com/en/ide) and [HUAWEI DevEco Device Tool User Guide](https://device.harmonyos.com/en/docs/ide/user-guides/service_introduction-0000001050166905).
HUAWEI DevEco Device Tool is a one-stop integrated development environment \(IDE\) provided to develop applications for OpenHarmony-based smart devices. It allows on-demand customization of OpenHarmony components, code editing, compilation, burning, and debugging, and supports C and C++ languages. This tool is installed in Visual Studio Code as a plug-in. For details, see [Tool Acquisition](https://device.harmonyos.com/en/ide) and [HUAWEI DevEco Device Tool User Guide](https://device.harmonyos.com/en/docs/ide/user-guides/service_introduction-0000001050166905).
## Acquiring the Application Development Tool \(HUAWEI DevEco Studio\)<a name="en-us_topic_0000001055701144_section0904101019258"></a>
HUAWEI DevEco Studio \(DevEco Studio for short\) is a one-stop IDE oriented to Huawei devices in all scenarios. It provides E2E HarmonyOS application development services, ranging from project template creation to development, compilation, debugging, and release. With DevEco Studio, you will be able to efficiently develop HarmonyOS applications with distributed capabilities while speeding up innovation. For details, see [Tool Acquisition](https://developer.harmonyos.com/en/develop/deveco-studio) and [HUAWEI DevEco Studio User Guide](https://developer.harmonyos.com/en/docs/documentation/doc-guides/tools_overview-0000001053582387).
HUAWEI DevEco Studio \(DevEco Studio for short\) is a one-stop IDE oriented to Huawei devices in all scenarios. It provides E2E OpenHarmony application development services, ranging from project template creation to development, compilation, debugging, and release. With DevEco Studio, you will be able to efficiently develop OpenHarmony applications with distributed capabilities while speeding up innovation. For details, see [Tool Acquisition](https://developer.harmonyos.com/en/develop/deveco-studio) and [HUAWEI DevEco Studio User Guide](https://developer.harmonyos.com/en/docs/documentation/doc-guides/tools_overview-0000001053582387).
......@@ -68,7 +68,7 @@ static void *ChildThreadFunc(void *arg)
/* Attempt to lock a mutex, which is failed in normal cases. */
rc = pthread_mutex_trylock(&g_td.mutex);
if (rc == 0) {
printf("ERROR: mutex gets an abnomal lock!\n");
printf("ERROR: mutex gets an abnormal lock!\n");
goto EXIT;
}
......
......@@ -5,7 +5,7 @@
## Building Process<a name="section1111311235313"></a>
The compilation and building subsystem is a building system based on Generate Ninja \(GN\) and Ninja. The following figure shows the building process.
The compilation and building subsystem is a building system based on Generate Ninja \(GN\) and Ninja. It supports on-demand configuration, tailoring, and assembly by component to customize desired products. The following figure shows the building process.
**Figure 1** Building process<a name="fig23781931124913"></a>
![](figures/building-process.png "building-process")
......@@ -15,7 +15,7 @@ The compilation and building subsystem is a building system based on Generate Ni
>![](public_sys-resources/icon-note.gif) **NOTE:**
>If the building type is debug, XTS will be involved in the building. If the building type is release, the symbol table and debugging information of the file generated after building will be removed.
- **Read the product configuration**: Read the **vendor/_x\_company_/_x\_product_.json** file that contains the development board, kernel type, kernel version, and components to configure.
- **Read the product configuration**: Read the **vendor/_my\_company_/_my\_product_.json** file that contains the development board, kernel type, kernel version, and components to configure.
- **Run the gn gen command to generate the ninja file**: Based on the parsed product configuration, add the selected components to build according to the corresponding building toolchain and configure global building options.
- **Use Ninja to start building**: Build and link the components one by one.
......@@ -29,13 +29,13 @@ You need to create a directory for the development board. Taking the **RTL8720*
The **ohos-clang** toolchain is used by default. SoC vendors can also customize the configuration based on their development boards. The building-related variables in the building configuration file of the development board are described as follows:
- **kernel\_type**: kernel type used by the development board, for example, **"liteos\_a"**, **"liteos\_m"**, or **"Linux"**.
- **kernel\_type**: kernel type used by the development board, for example, **"liteos\_a"**, **"liteos\_m"**, or **"linux"**.
- **kernel\_version**: kernel version used for development, for example, **"4.19"**.
- **board\_cpu**: CPU type of the development board, for example, **"cortex-a7"** or **"riscv32"**.
- **board\_arch**: chip architecture of the development board, for example, **"armv7-a"**, or **"rv32imac"**.
- **board\_arch**: chip architecture of the development board, for example, **"armv7-a"** or **"rv32imac"**.
- **board\_toolchain**: name of the customized building toolchain used by the development board, for example, **"gcc-arm-none-eabi"**. If this variable is not specified, **ohos-clang** will be used by default.
- **board\_toolchain\_prefix**: prefix of the building toolchain, for example, **"gcc-arm-none-eabi"**.
- **board\_toolchain\_type**: building toolchain type. Currently, GNU compiler collection \(GCC\) and clang are supported, for example, **"gcc"** and **"clang"**.
- **board\_toolchain\_type**: building toolchain type. Currently, GNU compiler collection \(GCC\) and clang are supported, for example, **"gcc"** or **"clang"**.
- **board\_cflags**: building options of the **.c** file configured for the development board.
- **board\_cxx\_flags**: building options of the **.cpp** file configured for the development board.
- **board\_ld\_flags**: link options configured for the development board.
......@@ -50,7 +50,7 @@ You need to create a directory for the development board. Taking the **RTL8720*
kernel_type = "liteos_m"
# Kernel version.
kernel_version = ""
kernel_version = "3.0.0"
# Board CPU type, e.g. "cortex-a7", "riscv32".
board_cpu = "real-m300"
......@@ -80,20 +80,59 @@ You need to create a directory for the development board. Taking the **RTL8720*
board_ld_flags = []
```
2. Compile the development board script.
2. Edit the building script of the development board.
For a newly added development board, the **BUILD.gn** file that functions as the entry for building must be added to the board directory. Taking the RTL8720 development board of Realtek as an example, the content in the **device/realtek/rtl8720/BUILD.gn** file is as follows:
```
group("rlt8720") {
group("rtl8720") {
...
}
```
3. Start building and debugging
3. Build and debug the development board.
1. Run the **hb set** command in any directory to set the source code path and the product to build.
2. Run the **hb build** command in the development board directory to start the building.
4. Build and debug the product.
Write the development board and component information to the product configuration file. Fields in the configuration file are as follows:
- **product\_name**: product name, which can be customized. It is recommended that the value be the same as the level-3 directory name under the **vendor** directory.
- **ohos\_version**: OpenHarmony version number, which must be the same as the actual version number.
- **device\_company**: name of the chip solution vendor. It is recommended that the value be the same as the level-2 directory name under the **device** directory.
- **board**: name of the development board. It is recommended that the value be the same as the level-3 directory name under the **device** directory.
- **kernel\_type**: kernel type, which must match the kernel type supported by the development board.
- **kernel\_version**: kernel version, which must match the kernel version supported by the development board.
- **subsystem**: OpenHarmony subsystem selected for the product. For details about the subsystems supported by OpenHarmony, see the descriptions of the subsystems in the **build/lite/components** directory.
- **components**: subsystem-specific components selected for the product. For details about the components supported by the selected subsystem, see the **build/lite/components/_Specific subsystem_.json** file.
- **features**: component-specific features configured for the product. For details about the features supported by the selected component, see the **features** field of the component in **build/lite/components/_Specific subsystem_.json** file.
Taking the Wi-Fi IoT module based on the RTL8720 development board as an example, the **vendor/my\_company/wifiiot/config.json** file is as follows:
```
{
"product_name": "wifiiot", # Product name
"ohos_version": "OpenHarmony 1.0", # In-use OS version
"device_company": "realtek", # Name of the chip solution vendor
"board": "rtl8720", # Name of the development board
"kernel_type": "liteos_m", # Selected kernel type
"kernel_version": "3.0.0", # Selected kernel version
"subsystems": [
{
"subsystem": "kernel", # Selected subsystem
"components": [
{ "component": "liteos_m", "features":[] } # Selected component and its features
]
},
...
{
More subsystems and components
}
]
}
```
......@@ -14,7 +14,7 @@ The Utils subsystem provides common basic components that can be used by other s
**Description for HAL APIs of the Utils subsystem**
The SoC needs to implement related APIs. For details about the dependency of OpenHarmony on the SoC file system APIs, see [HAL Header Files of Utils](https://gitee.com/openharmony/utils_native_lite/tree/master/hals/file).
The SoC needs to implement related APIs. For details about the dependency of OpenHarmony on the SoC file system APIs, see [HAL header files of Utils](https://gitee.com/openharmony/utils_native_lite/tree/master/hals/file).
## IoT Peripheral Subsystem<a name="section958113200811"></a>
......@@ -24,7 +24,7 @@ The IoT peripheral subsystem provides dedicated peripheral operation interfaces
**Description for HAL APIs of the IoT peripheral subsystem**
The SoC needs to implement related APIs. For details about the dependency of OpenHarmony on the chip peripheral APIs, see [HAL Header Files of wifiiot](https://gitee.com/openharmony/iothardware_hals_wifiiot_lite/tree/master).
The SoC needs to implement related APIs. For details about the dependency of OpenHarmony on the chip peripheral APIs, see [HAL header files of IoT peripherals](https://gitee.com/openharmony/iothardware_peripheral/tree/master/interfaces/kits).
## WLAN<a name="section1331917210911"></a>
......@@ -70,5 +70,5 @@ vendor/hisi/hi3861/hi3861_adapter/hals/communication/wifi_lite/wifiservice/
└── wifi_hotspot.c
```
The SoC needs to implement related APIs. For details about the dependency of OpenHarmony on the chip peripheral APIs, see [Header Files of WLAN](https://gitee.com/openharmony/communication_interfaces_kits_wifi_lite/tree/master/wifiservice).
The SoC needs to implement related APIs. For details about the dependency of OpenHarmony on the chip peripheral APIs, see [header files of WLAN](https://gitee.com/openharmony/communication_wifi_lite/tree/master/interfaces/wifiservice).
......@@ -9,16 +9,18 @@
- [Using Docker to Install the Linux Environment](#section107932281315)
- [Using an Installation Package to Install the Linux Environment](#section497484245614)
- [Connecting to a Linux Server](#section723115618340)
- [Changing Linux Shell to Bash](#section1715027152617)
- [Installing a Python Environment](#section11255767343)
- [Installing and Configuring Python](#section11255767343)
- [Installing gn](#section9262166183410)
- [Installing ninja](#section02645617348)
- [Installing LLVM](#section149564754)
- [Installing hb](#section6201103143120)
- [Obtaining Source Code](#section1545225464016)
- [Obtaining OpenHarmony Source Code](#section1545225464016)
- [FAQ](#section19253140111619)
- [What should I do if garbled characters and segmentation faults occur during hb installation?](#section347685141717)
- [What should I do if the message "cannot import 'sysconfig' from 'distutils'" is displayed during hb installation?](#section1996804118553)
- [What should I do if the message "module 'platform' has no attribute 'linux\_distribution'" is displayed during hb Installation?](#section6992181918582)
- [What should I do if the message "ImportError: No module named apt\_pkg" is displayed during the execution of an unidentifiable command?](#section7854153010120)
Before setting up the environment for a development board, you must set up the basic OS environment for OpenHarmony first. The basic OS environment refers to the building environment and development environment of OpenHarmony. You can choose one of the following methods to set up the basic OS environment based on your preference and the hardware and software used.
......@@ -142,14 +144,7 @@ The following table describes the tools required for setting up the general envi
</td>
<td class="cellrowborder" valign="top" width="20.7020702070207%" headers="mcps1.2.4.1.2 "><p id="p43003270510"><a name="p43003270510"></a><a name="p43003270510"></a>Executes script compilation.</p>
</td>
<td class="cellrowborder" valign="top" width="53.73537353735374%" headers="mcps1.2.4.1.3 "><p id="p18254155164617"><a name="p18254155164617"></a><a name="p18254155164617"></a><a href="https://www.python.org/ftp/python/3.8.5/Python-3.8.5.tgz" target="_blank" rel="noopener noreferrer">https://www.python.org/ftp/python/3.8.5/Python-3.8.5.tgz</a></p>
</td>
</tr>
<tr id="row42668197206"><td class="cellrowborder" valign="top" width="25.562556255625562%" headers="mcps1.2.4.1.1 "><p id="p426711912014"><a name="p426711912014"></a><a name="p426711912014"></a>bash</p>
</td>
<td class="cellrowborder" valign="top" width="20.7020702070207%" headers="mcps1.2.4.1.2 "><p id="p14267131962014"><a name="p14267131962014"></a><a name="p14267131962014"></a>Executes commands.</p>
</td>
<td class="cellrowborder" valign="top" width="53.73537353735374%" headers="mcps1.2.4.1.3 "><p id="p14267101962014"><a name="p14267101962014"></a><a name="p14267101962014"></a>Internet</p>
<td class="cellrowborder" valign="top" width="53.73537353735374%" headers="mcps1.2.4.1.3 "><p id="p34760459518"><a name="p34760459518"></a><a name="p34760459518"></a>Internet</p>
</td>
</tr>
<tr id="row1711946154018"><td class="cellrowborder" valign="top" width="25.562556255625562%" headers="mcps1.2.4.1.1 "><p id="p15588165684216"><a name="p15588165684216"></a><a name="p15588165684216"></a>gn</p>
......@@ -177,7 +172,7 @@ The following table describes the tools required for setting up the general envi
</td>
<td class="cellrowborder" valign="top" width="20.7020702070207%" headers="mcps1.2.4.1.2 "><p id="p1244114913492"><a name="p1244114913492"></a><a name="p1244114913492"></a>Compiles the source code.</p>
</td>
<td class="cellrowborder" valign="top" width="53.73537353735374%" headers="mcps1.2.4.1.3 "><p id="p1244120916499"><a name="p1244120916499"></a><a name="p1244120916499"></a>The <strong id="b146115915482"><a name="b146115915482"></a><a name="b146115915482"></a>build_lite</strong> repository in HarmonyOS source code</p>
<td class="cellrowborder" valign="top" width="53.73537353735374%" headers="mcps1.2.4.1.3 "><p id="p1463918124619"><a name="p1463918124619"></a><a name="p1463918124619"></a>Internet</p>
</td>
</tr>
</tbody>
......@@ -218,30 +213,7 @@ Using PuTTY to log in to a Linux server from a PC running Windows
![](figures/successful-login.png "successful-login")
### Changing Linux Shell to Bash<a name="section1715027152617"></a>
Check whether bash is used as the shell.
```
ls -l /bin/sh
```
If **/bin/sh -\> bash** is not displayed, do as follows to change shell to bash.
**Method 1:** Run the following command on the device and then click **No**.
```
sudo dpkg-reconfigure dash
```
**Method 2:** Run the first command to delete **sh** and then run the second command to create a new soft link.
```
sudo rm -rf /bin/sh
sudo ln -s /bin/bash /bin/sh
```
### Installing a Python Environment<a name="section11255767343"></a>
### Installing and Configuring Python<a name="section11255767343"></a>
1. Start a Linux server.
2. Check the Python version \(Python 3.7 or later is required\).
......@@ -265,40 +237,33 @@ sudo ln -s /bin/bash /bin/sh
sudo apt-get install python3.8
```
- If the Ubuntu version is **16**, download the installation package and install Python.
- If the Ubuntu version is 16, perform the following steps:
1. Install Python environment dependencies \(gcc, g++, make, zlib, libffi\).
a. Install dependency packages.
```
sudo apt-get install gcc && sudo apt-get install g++ && sudo apt-get install make && sudo apt-get install zlib* && sudo apt-get install libffi-dev
sudo apt update && sudo apt install software-properties-common
```
1. Obtain the [Python 3.8.5 installation package](https://www.python.org/ftp/python/3.8.5/Python-3.8.5.tgz), save it to the Linux server, and run the following command:
b. Add the source of deadsnakes PPA and press **Enter**.
```
tar -xvzf Python-3.8.5.tgz && cd Python-3.8.5 && sudo ./configure && sudo make && sudo make install
sudo add-apt-repository ppa:deadsnakes/ppa
```
c. Install Python 3.8.
```
sudo apt upgrade && sudo apt install python3.8
```
3. Link the Python path to **/usr/bin/python** after Python is installed.
Check whether Python is soft linked to Python 3.8.
```
python --version
```
If the command output is not **python 3.8.5**, run the following command to check the directory where Python 3.8 is stored:
```
which python3.8
```
Replace **python3.8-path** in the following command with the output path of the **which python3.8** command.
3. Set the soft link of **python** and **python3** to **python3.8**.
```
cd /usr/bin && sudo rm python && sudo rm python3 && sudo ln -s python3.8-path python && sudo ln -s python3.8-path python3 && python3 --version
sudo update-alternatives --install /usr/bin/python python /usr/bin/python3.8 1
sudo update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.8 1
```
4. Install and upgrade the Python package management tool \(pip3\) using either of the following methods:
......@@ -317,104 +282,6 @@ sudo ln -s /bin/bash /bin/sh
```
5. Install setuptools.
```
pip3 install setuptools
```
6. Install the GUI menuconfig tool \(Kconfiglib\). You are advised to install Kconfiglib 13.2.0 or later.
- **Command line:**
```
sudo pip3 install kconfiglib
```
- **Installation package:**
1. Download the **.whl** file, for example, **kconfiglib-13.2.0-py2.py3-none-any.whl**.
Download path: [https://pypi.org/project/kconfiglib\#files](https://pypi.org/project/kconfiglib#files)
1. Install the **.whl** file.
```
sudo pip3 install kconfiglib-13.2.0-py2.py3-none-any.whl
```
7. <a name="li195884268616"></a>Install **pycryptodome** using either of the following methods:
>![](public_sys-resources/icon-notice.gif) **NOTICE:**
>Steps [7](#li195884268616) to [9](#li125926111510) are required only for the Hi3861 development board.
Install the Python component packages on which the file signature depends, including pycryptodome, six, and ecdsa. As the installation of **ecdsa** depends on that of **six**, install **six** first.
- **Command line:**
```
sudo pip3 install pycryptodome
```
- **Installation package:**
1. Download the **.whl** file \(for example, **pycryptodome-3.9.9-cp38-cp38-manylinux1\_x86\_64.whl**\).
Download path: [https://pypi.org/project/pycryptodome/\#files](https://pypi.org/project/pycryptodome/#files)
1. Install the **.whl** file.
```
sudo pip3 install pycryptodome-3.9.9-cp38-cp38-manylinux1_x86_64.whl
```
8. Install **six** using either of the following methods:
- **Command line:**
```
sudo pip3 install six --upgrade --ignore-installed six
```
- **Installation package:**
1. Download the **.whl** file, for example, **six-1.12.0-py2.py3-none-any.whl**.
Download path: [https://pypi.org/project/six/\#files](https://pypi.org/project/six/#files)
1. Install the **.whl** file.
```
sudo pip3 install six-1.12.0-py2.py3-none-any.whl
```
9. <a name="li125926111510"></a>Install **ecdsa** using either of the following methods:
- **Command line:**
```
sudo pip3 install ecdsa
```
- **Installation package:**
1. Download the **.whl** file, for example, **ecdsa-0.14.1-py2.py3-none-any.whl**.
Download path: [https://pypi.org/project/ecdsa/\#files](https://pypi.org/project/ecdsa/#files)
1. Install the **.whl** file.
```
sudo pip3 install ecdsa-0.14.1-py2.py3-none-any.whl
```
### Installing gn<a name="section9262166183410"></a>
......@@ -513,15 +380,15 @@ sudo ln -s /bin/bash /bin/sh
**Prerequisites**
- Python 3.7.4 or later has been installed. For details, see steps 1 to 4 in [Installing a Python Environment](#section11255767343).
- Python 3.7.4 or later has been installed. For details, see [Installing and Configuring Python](#section11255767343).
- The source code has been downloaded. For details, see [Source Code Acquisition](../get-code/source-code-acquisition.md).
**Installation**
1. Run the following command in the root directory of the source code:
1. Install **hb**.
```
python3 -m pip install --user build/lite
python3 -m pip install --user ohos-build
```
2. Set an environment variable.
......@@ -542,7 +409,7 @@ sudo ln -s /bin/bash /bin/sh
source ~/.bashrc
```
3. Run the **hb -h** command. The installation is successful until the following information is displayed:
3. Run the **hb -h** command. If the following information is displayed, the installation is successful:
```
usage: hb
......@@ -572,7 +439,7 @@ python3 -m pip uninstall ohos-build
## Obtaining OpenHarmony Source Code<a name="section1545225464016"></a>
You need to acquire [OpenHarmony source code](https://repo.huaweicloud.com/harmonyos/os/1.0/code-1.0.tar.gz), download it on a Linux server, and decompress it. For more obtaining methods, see [Source Code Acquisition](../get-code/source-code-acquisition.md).
You need to acquire OpenHarmony [source code](https://repo.huaweicloud.com/harmonyos/os/1.0.1/code-1.0.1.tar.gz), download it on a Linux server, and decompress it. For more obtaining methods, see [Source Code Acquisition](../get-code/source-code-acquisition.md).
## FAQ<a name="section19253140111619"></a>
......@@ -580,7 +447,7 @@ You need to acquire [OpenHarmony source code](https://repo.huaweicloud.com/harm
- **Symptom**
Garbled characters and segmentation faults occur during execution of the **python3 -m pip install --user build/lite** command.
Garbled characters and segmentation faults occur during the execution of the **python3 -m pip install --user ohos-build** command.
- **Possible Causes**
......@@ -589,10 +456,72 @@ You need to acquire [OpenHarmony source code](https://repo.huaweicloud.com/harm
- **Solutions**
Run the following command to upgrade pip:
Upgrade pip.
```
python3 -m pip install -U pip
```
### What should I do if the message "cannot import 'sysconfig' from 'distutils'" is displayed during hb installation?<a name="section1996804118553"></a>
- **Symptom**
The message "cannot import 'sysconfig' from 'distutils'" is displayed during the execution of the **python3 -m pip install --user ohos-build** command.
- **Possible Causes**
The **distutils** module is unavailable.
- **Solutions**
Install **distutils**.
```
sudo apt-get install python3.8-distutils
```
### What should I do if the message "module 'platform' has no attribute 'linux\_distribution'" is displayed during hb Installation?<a name="section6992181918582"></a>
- **Symptom**
The message "module 'platform' has no attribute 'linux\_distribution'" is displayed during the execution of the **python3 -m pip install --user ohos-build** command.
- **Possible Causes**
There is a compatibility issue of python3-pip.
- **Solutions**
Reinstall pip.
```
sudo apt remove python3-pip
curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
python get-pip.py
```
### What should I do if the message "ImportError: No module named apt\_pkg" is displayed during the execution of an unidentifiable command?<a name="section7854153010120"></a>
- **Symptom**
The message "ImportError: No module named apt\_pkg" is displayed when an unidentifiable command is executed on the Linux server.
- **Possible Causes**
There is a compatibility issue of python3-apt.
- **Solutions**
Reinstall python3-apt.
```
sudo apt-get remove python3-apt
sduo apt-get install python3-apt
```
......@@ -6,6 +6,8 @@
- [Software Requirements](#section965634210501)
- [Installing the Linux Compilation Environment](#section182916865219)
- [Changing Linux Shell to Bash](#section1715027152617)
- [Installing Basic Software Used for Compilation and Building \(Required Only for Ubuntu 20+\)](#section45512412251)
- [Installing a File Packing Tool](#section8352161417450)
- [Installing hc-gen](#section2075110583451)
- [Installing the JVM](#section101989994613)
......@@ -47,11 +49,25 @@ The following table describes the tools required for setting up the general envi
</th>
</tr>
</thead>
<tbody><tr id="row76242594498"><td class="cellrowborder" valign="top" width="13.081308130813083%" headers="mcps1.2.4.1.1 "><p id="p1682494111548"><a name="p1682494111548"></a><a name="p1682494111548"></a>dosfstools, mtools, and mtd-utils</p>
<tbody><tr id="row167343191518"><td class="cellrowborder" valign="top" width="13.081308130813083%" headers="mcps1.2.4.1.1 "><p id="p467443191517"><a name="p467443191517"></a><a name="p467443191517"></a>bash</p>
</td>
<td class="cellrowborder" valign="top" width="19.921992199219922%" headers="mcps1.2.4.1.2 "><p id="p1362445934918"><a name="p1362445934918"></a><a name="p1362445934918"></a>Pack files.</p>
<td class="cellrowborder" valign="top" width="19.921992199219922%" headers="mcps1.2.4.1.2 "><p id="p0674153114151"><a name="p0674153114151"></a><a name="p0674153114151"></a>Processes CLI commands.</p>
</td>
<td class="cellrowborder" valign="top" width="66.996699669967%" headers="mcps1.2.4.1.3 "><p id="p1262475944916"><a name="p1262475944916"></a><a name="p1262475944916"></a>apt-get install</p>
<td class="cellrowborder" valign="top" width="66.996699669967%" headers="mcps1.2.4.1.3 "><p id="p116746312151"><a name="p116746312151"></a><a name="p116746312151"></a>System configuration</p>
</td>
</tr>
<tr id="row14885193315201"><td class="cellrowborder" valign="top" width="13.081308130813083%" headers="mcps1.2.4.1.1 "><p id="p137174662119"><a name="p137174662119"></a><a name="p137174662119"></a>Basic software package for compilation and building (required only for Ubuntu 20+)</p>
</td>
<td class="cellrowborder" valign="top" width="19.921992199219922%" headers="mcps1.2.4.1.2 "><p id="p258814561424"><a name="p258814561424"></a><a name="p258814561424"></a>Provides a basic software package for compilation and building.</p>
</td>
<td class="cellrowborder" valign="top" width="66.996699669967%" headers="mcps1.2.4.1.3 "><p id="p1749611716181"><a name="p1749611716181"></a><a name="p1749611716181"></a>Internet</p>
</td>
</tr>
<tr id="row52253812238"><td class="cellrowborder" valign="top" width="13.081308130813083%" headers="mcps1.2.4.1.1 "><p id="p28007392236"><a name="p28007392236"></a><a name="p28007392236"></a>dosfstools, mtools, and mtd-utils</p>
</td>
<td class="cellrowborder" valign="top" width="19.921992199219922%" headers="mcps1.2.4.1.2 "><p id="p98008390232"><a name="p98008390232"></a><a name="p98008390232"></a>Pack files.</p>
</td>
<td class="cellrowborder" valign="top" width="66.996699669967%" headers="mcps1.2.4.1.3 "><p id="p280018394233"><a name="p280018394233"></a><a name="p280018394233"></a>apt-get install</p>
</td>
</tr>
<tr id="row18516509507"><td class="cellrowborder" valign="top" width="13.081308130813083%" headers="mcps1.2.4.1.1 "><p id="p14521650135017"><a name="p14521650135017"></a><a name="p14521650135017"></a>hc-gen</p>
......@@ -77,6 +93,37 @@ The following table describes the tools required for setting up the general envi
>- If you acquire the source code using an HPM component or HPM CLI tool, compilation tools like **LLVM** and **hc-gen** are not required.
>- \(Recommended\) If you obtain the source code through an image site or a code repository, install compilation tools like **LLVM** and **hc-gen**. When installing **LLVM** and **hc-gen**, ensure that the environment variable paths of the compilation tools are unique.
### Changing Linux Shell to Bash<a name="section1715027152617"></a>
Check whether bash is used as the shell.
```
ls -l /bin/sh
```
If **/bin/sh -\> bash** is not displayed, do as follows to change shell to bash.
**Method 1:** Run the following command on the device and then click **No**.
```
sudo dpkg-reconfigure dash
```
**Method 2:** Run the first command to delete **sh** and then run the second command to create a new soft link.
```
sudo rm -rf /bin/sh
sudo ln -s /bin/bash /bin/sh
```
### Installing Basic Software Used for Compilation and Building \(Required Only for Ubuntu 20+\)<a name="section45512412251"></a>
Install the software.
```
sudo apt-get install build-essential && sudo apt-get install gcc && sudo apt-get install g++ && sudo apt-get install make && sudo apt-get install zlib* && sudo apt-get install libffi-dev
```
### Installing a File Packing Tool<a name="section8352161417450"></a>
1. Start a Linux server.
......
# Setting Up the Hi3518 Development Environment<a name="EN-US_TOPIC_0000001054022306"></a>
- [Prerequisites](#section2074878255)
- [Requirements Specific to the Hi3518 Development Environment](#section1724111409282)
- [Setting Up the Hi3518 Development Environment](#section1724111409282)
- [Hardware Requirements](#section487353718276)
- [Software Requirements](#section17315193935817)
- [Installing the Linux Compilation Environment](#section8831868501)
- [Changing Linux Shell to Bash](#section1715027152617)
- [Installing Basic Software Used for Compilation and Building \(Required Only for Ubuntu 20+\)](#section45512412251)
- [Installing a File Packing Tool](#section480195453419)
- [Installing hc-gen](#section351420104218)
......@@ -14,7 +16,7 @@
You must complete the settings in [Basic OS Environment Setup](basic-os-environment-setup.md).
## Requirements Specific to the Hi3518 Development Environment<a name="section1724111409282"></a>
## Setting Up the Hi3518 Development Environment<a name="section1724111409282"></a>
### Hardware Requirements<a name="section487353718276"></a>
......@@ -45,7 +47,21 @@ The following table describes the tools required for setting up the general envi
</th>
</tr>
</thead>
<tbody><tr id="row08231641105420"><td class="cellrowborder" valign="top" width="13.081308130813083%" headers="mcps1.2.4.1.1 "><p id="p1682494111548"><a name="p1682494111548"></a><a name="p1682494111548"></a>dosfstools, mtools, and mtd-utils</p>
<tbody><tr id="row18630134151917"><td class="cellrowborder" valign="top" width="13.081308130813083%" headers="mcps1.2.4.1.1 "><p id="p1563113417199"><a name="p1563113417199"></a><a name="p1563113417199"></a>bash</p>
</td>
<td class="cellrowborder" valign="top" width="19.921992199219922%" headers="mcps1.2.4.1.2 "><p id="p463193418190"><a name="p463193418190"></a><a name="p463193418190"></a>Processes CLI commands.</p>
</td>
<td class="cellrowborder" valign="top" width="66.996699669967%" headers="mcps1.2.4.1.3 "><p id="p1063118344191"><a name="p1063118344191"></a><a name="p1063118344191"></a>System configuration</p>
</td>
</tr>
<tr id="row7598468212"><td class="cellrowborder" valign="top" width="13.081308130813083%" headers="mcps1.2.4.1.1 "><p id="p659815642111"><a name="p659815642111"></a><a name="p659815642111"></a>Basic software package for compilation and building (required only for Ubuntu 20+)</p>
</td>
<td class="cellrowborder" valign="top" width="19.921992199219922%" headers="mcps1.2.4.1.2 "><p id="p137174662119"><a name="p137174662119"></a><a name="p137174662119"></a>Provides a basic software package for compilation and building.</p>
</td>
<td class="cellrowborder" valign="top" width="66.996699669967%" headers="mcps1.2.4.1.3 "><p id="p125983652118"><a name="p125983652118"></a><a name="p125983652118"></a>Internet</p>
</td>
</tr>
<tr id="row08231641105420"><td class="cellrowborder" valign="top" width="13.081308130813083%" headers="mcps1.2.4.1.1 "><p id="p1682494111548"><a name="p1682494111548"></a><a name="p1682494111548"></a>dosfstools, mtools, and mtd-utils</p>
</td>
<td class="cellrowborder" valign="top" width="19.921992199219922%" headers="mcps1.2.4.1.2 "><p id="p1362445934918"><a name="p1362445934918"></a><a name="p1362445934918"></a>Pack files.</p>
</td>
......@@ -68,6 +84,37 @@ The following table describes the tools required for setting up the general envi
>- If you acquire the source code using an HPM component or HPM CLI tool, compilation tools like **gn**, **ninja**, **LLVM**, and **hc-gen** are not required.
>- \(Recommended\) If you obtain the source code through an image site or a code repository, compilation tools like **LLVM** and **hc-gen** need to be installed. When installing **LLVM** and **hc-gen**, ensure that the environment variable paths of the compilation tools are unique.
### Changing Linux Shell to Bash<a name="section1715027152617"></a>
Check whether bash is used as the shell.
```
ls -l /bin/sh
```
If **/bin/sh -\> bash** is not displayed, do as follows to change shell to bash.
**Method 1:** Run the following command on the device and then click **No**.
```
sudo dpkg-reconfigure dash
```
**Method 2:** Run the first command to delete **sh** and then run the second command to create a new soft link.
```
sudo rm -rf /bin/sh
sudo ln -s /bin/bash /bin/sh
```
### Installing Basic Software Used for Compilation and Building \(Required Only for Ubuntu 20+\)<a name="section45512412251"></a>
Install the software.
```
sudo apt-get install build-essential && sudo apt-get install gcc && sudo apt-get install g++ && sudo apt-get install make && sudo apt-get install zlib* && sudo apt-get install libffi-dev
```
### Installing a File Packing Tool<a name="section480195453419"></a>
1. Start a Linux server.
......
......@@ -3,19 +3,21 @@
- [Prerequisites](#section2074878255)
- [Requirements Specific to the Hi3861 Development Environment](#section466851916410)
- [Installing the Linux Compilation Environment](#section497484245614)
- [Installing Basic Software Used for Compilation and Building \(Required Only for Ubuntu 20+\)](#section45512412251)
- [Installing Scons](#section13515123015279)
- [Installing Python Modules](#section88701892341)
- [Installing gcc\_riscv32 \(Compilation Toolchain for WLAN Module\)](#section1842910288284)
>![](public_sys-resources/icon-notice.gif) **NOTICE:**
>This section describes how to use an installation package to set up the compilation and building environment. If you are going to use Docker to set up the environment, the Linux server-related tools SCons 3.0.4+ and build-essential are not required, and you only need to install the Windows workstation.
## Prerequisites<a name="section2074878255"></a>
You must complete the settings in [Basic OS Environment Setup](basic-os-environment-setup.md).
## Requirements Specific to the Hi3861 Development Environment<a name="section466851916410"></a>
>![](public_sys-resources/icon-notice.gif) **NOTICE:**
>This section describes how to use an installation package to set up the compilation and building environment. If you are going to use Docker to set up the environment, the Linux server-related tools in [Table 1](#table6299192712513) are not required, and you only need to install the Windows workstation.
The following table describes the environment configuration requirements specific to the Hi3861 development board.
**Table 1** Hi3861 development environment-specific requirements
......@@ -31,7 +33,16 @@ The following table describes the environment configuration requirements specifi
</th>
</tr>
</thead>
<tbody><tr id="row1397335913612"><td class="cellrowborder" valign="top" width="17.54%" headers="mcps1.2.5.1.1 "><p id="p3711468218"><a name="p3711468218"></a><a name="p3711468218"></a>Linux server</p>
<tbody><tr id="row935218593572"><td class="cellrowborder" valign="top" width="17.54%" headers="mcps1.2.5.1.1 "><p id="p105554418586"><a name="p105554418586"></a><a name="p105554418586"></a>Linux server</p>
</td>
<td class="cellrowborder" valign="top" width="19.89%" headers="mcps1.2.5.1.2 "><p id="p45551740589"><a name="p45551740589"></a><a name="p45551740589"></a>Basic software package for compilation and building (required only for Ubuntu 20+)</p>
</td>
<td class="cellrowborder" valign="top" width="26.279999999999998%" headers="mcps1.2.5.1.3 "><p id="p655594115814"><a name="p655594115814"></a><a name="p655594115814"></a>Provides a basic software package for compilation and building.</p>
</td>
<td class="cellrowborder" valign="top" width="36.29%" headers="mcps1.2.5.1.4 "><p id="p165558415589"><a name="p165558415589"></a><a name="p165558415589"></a>Internet</p>
</td>
</tr>
<tr id="row1397335913612"><td class="cellrowborder" valign="top" width="17.54%" headers="mcps1.2.5.1.1 "><p id="p3711468218"><a name="p3711468218"></a><a name="p3711468218"></a>Linux server</p>
</td>
<td class="cellrowborder" valign="top" width="19.89%" headers="mcps1.2.5.1.2 "><p id="p097355911620"><a name="p097355911620"></a><a name="p097355911620"></a>SCons 3.0.4+</p>
</td>
......@@ -40,13 +51,22 @@ The following table describes the environment configuration requirements specifi
<td class="cellrowborder" valign="top" width="36.29%" headers="mcps1.2.5.1.4 "><p id="p1722663441514"><a name="p1722663441514"></a><a name="p1722663441514"></a>Internet</p>
</td>
</tr>
<tr id="row1463517494402"><td class="cellrowborder" valign="top" width="17.54%" headers="mcps1.2.5.1.1 "><p id="p137174662119"><a name="p137174662119"></a><a name="p137174662119"></a>Linux server</p>
<tr id="row1968013216717"><td class="cellrowborder" valign="top" width="17.54%" headers="mcps1.2.5.1.1 "><p id="p2681632977"><a name="p2681632977"></a><a name="p2681632977"></a>Linux server</p>
</td>
<td class="cellrowborder" valign="top" width="19.89%" headers="mcps1.2.5.1.2 "><p id="p1991501391312"><a name="p1991501391312"></a><a name="p1991501391312"></a>Python modules: setuptools, Kconfiglib, PyCryptodome, six, and ecdsa</p>
</td>
<td class="cellrowborder" valign="top" width="26.279999999999998%" headers="mcps1.2.5.1.3 "><p id="p968120325715"><a name="p968120325715"></a><a name="p968120325715"></a>Executes script compilation.</p>
</td>
<td class="cellrowborder" valign="top" width="36.29%" headers="mcps1.2.5.1.4 "><p id="p268116326711"><a name="p268116326711"></a><a name="p268116326711"></a>Internet</p>
</td>
</tr>
<tr id="row020914491313"><td class="cellrowborder" valign="top" width="17.54%" headers="mcps1.2.5.1.1 "><p id="p20209749103116"><a name="p20209749103116"></a><a name="p20209749103116"></a>Linux server</p>
</td>
<td class="cellrowborder" valign="top" width="19.89%" headers="mcps1.2.5.1.2 "><p id="p258814561424"><a name="p258814561424"></a><a name="p258814561424"></a>build-essential</p>
<td class="cellrowborder" valign="top" width="19.89%" headers="mcps1.2.5.1.2 "><p id="p7209104910317"><a name="p7209104910317"></a><a name="p7209104910317"></a>gcc riscv32</p>
</td>
<td class="cellrowborder" valign="top" width="26.279999999999998%" headers="mcps1.2.5.1.3 "><p id="p1749611716181"><a name="p1749611716181"></a><a name="p1749611716181"></a>Provides basic software package for compilation.</p>
<td class="cellrowborder" valign="top" width="26.279999999999998%" headers="mcps1.2.5.1.3 "><p id="p102093498311"><a name="p102093498311"></a><a name="p102093498311"></a>Executes script compilation.</p>
</td>
<td class="cellrowborder" valign="top" width="36.29%" headers="mcps1.2.5.1.4 "><p id="p8635174916403"><a name="p8635174916403"></a><a name="p8635174916403"></a>Internet</p>
<td class="cellrowborder" valign="top" width="36.29%" headers="mcps1.2.5.1.4 "><p id="p321054953116"><a name="p321054953116"></a><a name="p321054953116"></a>Internet</p>
</td>
</tr>
<tr id="row1596703610215"><td class="cellrowborder" valign="top" width="17.54%" headers="mcps1.2.5.1.1 "><p id="p071946112113"><a name="p071946112113"></a><a name="p071946112113"></a>Windows workstation</p>
......@@ -55,7 +75,7 @@ The following table describes the environment configuration requirements specifi
</td>
<td class="cellrowborder" valign="top" width="26.279999999999998%" headers="mcps1.2.5.1.3 "><p id="p94491342131413"><a name="p94491342131413"></a><a name="p94491342131413"></a>USB-to-Serial adapter driver</p>
</td>
<td class="cellrowborder" valign="top" width="36.29%" headers="mcps1.2.5.1.4 "><p id="p6449184214148"><a name="p6449184214148"></a><a name="p6449184214148"></a><a href="http://www.wch-ic.com/downloads/CH341SER_EXE.html" target="_blank" rel="noopener noreferrer">http://www.wch-ic.com/downloads/CH341SER_EXE.html</a></p>
<td class="cellrowborder" valign="top" width="36.29%" headers="mcps1.2.5.1.4 "><p id="p6449184214148"><a name="p6449184214148"></a><a name="p6449184214148"></a><a href="http://www.wch-ic.com/downloads/CH341SER_EXE.html" target="_blank" rel="noopener noreferrer">http://www.wch.cn/search?q=ch340g&amp;t=downloads</a></p>
</td>
</tr>
</tbody>
......@@ -67,39 +87,129 @@ The following table describes the environment configuration requirements specifi
>- If you acquire the source code using an HPM component or HPM CLI tool, **gcc\_riscv32** is not required.
>- \(Recommended\) If you obtain the source code via the mirror site or code repository, install **gcc\_riscv32**. When installing **gcc\_riscv32**, ensure that the environment variable paths of the compilation tools are unique.
### Installing Basic Software Used for Compilation and Building \(Required Only for Ubuntu 20+\)<a name="section45512412251"></a>
Install the software.
```
sudo apt-get install build-essential && sudo apt-get install gcc && sudo apt-get install g++ && sudo apt-get install make && sudo apt-get install zlib* && sudo apt-get install libffi-dev
```
### Installing Scons<a name="section13515123015279"></a>
1. Start a Linux server.
2. Install the SCons installation package.
```
sudo apt-get install scons -y
python3 -m pip install scons
```
3. Check whether the installation is successful.
```
scons -v
```
If the installation package cannot be found in the software source, do as follows:
**Figure 1** Successful installation \(SCons version requirement: 3.0.4 or later\)<a name="fig235815252492"></a>
![](figures/successful-installation-(scons-version-requirement-3-0-4-or-later).png "successful-installation-(scons-version-requirement-3-0-4-or-later)")
1. Download the source code package from [https://scons.org/pages/download.html](https://scons.org/pages/download.html). The recommended SCons version is 3.0.4 or later.
2. Decompress the source code package to any directory, for example, scons-3.1.2.
### Installing Python Modules<a name="section88701892341"></a>
1. Install setuptools.
```
pip3 install setuptools
```
2. Install the GUI menuconfig tool \(Kconfiglib\). You are advised to install Kconfiglib 13.2.0 or later.
- **Command line:**
```
tar -xvf scons-3.1.2.tar.gz
sudo pip3 install kconfiglib
```
3. Go to the source code directory and run the following command to install the source code package:
- **Installation package:**
1. Download the **.whl** file \(for example, **kconfiglib-13.2.0-py2.py3-none-any.whl**\).
Download path: [https://pypi.org/project/kconfiglib\#files](https://pypi.org/project/kconfiglib#files)
1. Install the **.whl** file.
```
sudo pip3 install kconfiglib-13.2.0-py2.py3-none-any.whl
```
3. Install **PyCryptodome** using either of the following methods:
Install the Python component packages on which the file signature depends, including PyCryptodome, six, and ecdsa. As the installation of **ecdsa** depends on that of **six**, install **six** first.
- **Command line:**
```
sudo python3 setup.py install
sudo pip3 install pycryptodome
```
- **Installation package:**
1. Download the **.whl** file \(for example, **pycryptodome-3.9.9-cp38-cp38-manylinux1\_x86\_64.whl**\).
3. Check whether the installation is successful.
Download path: [https://pypi.org/project/pycryptodome/\#files](https://pypi.org/project/pycryptodome/#files)
1. Install the **.whl** file.
```
sudo pip3 install pycryptodome-3.9.9-cp38-cp38-manylinux1_x86_64.whl
```
4. Install **six** using either of the following methods:
- **Command line:**
```
sudo pip3 install six --upgrade --ignore-installed six
```
- **Installation package:**
1. Download the **.whl** file, for example, **six-1.12.0-py2.py3-none-any.whl**.
Download path: [https://pypi.org/project/six/\#files](https://pypi.org/project/six/#files)
1. Install the **.whl** file.
```
sudo pip3 install six-1.12.0-py2.py3-none-any.whl
```
5. Install **ecdsa** using either of the following methods:
- **Command line:**
```
sudo pip3 install ecdsa
```
- **Installation package:**
1. Download the **.whl** file, for example, **ecdsa-0.14.1-py2.py3-none-any.whl**.
Download path: [https://pypi.org/project/ecdsa/\#files](https://pypi.org/project/ecdsa/#files)
1. Install the **.whl** file.
```
sudo pip3 install ecdsa-0.14.1-py2.py3-none-any.whl
```
```
scons -v
```
**Figure 1** Successful installation<a name="fig235815252492"></a>
![](figures/successful-installation.png "successful-installation")
### Installing gcc\_riscv32 \(Compilation Toolchain for WLAN Module\)<a name="section1842910288284"></a>
......@@ -172,7 +282,7 @@ The following table describes the environment configuration requirements specifi
cd /opt && mkdir gcc_riscv32
```
13. Build **Bintutils**.
13. Compile **binutils**.
```
mkdir build_binutils && cd build_binutils && ../riscv-binutils-gdb/configure --prefix=/opt/gcc_riscv32 --target=riscv32-unknown-elf --with-arch=rv32imc --with-abi=ilp32 --disable-__cxa_atexit --disable-libgomp --disable-libmudflap --enable-libssp --disable-libstdcxx-pch --disable-nls --disable-shared --disable-threads --disable-multilib --enable-poison-system-directories --enable-languages=c,c++ --with-gnu-as --with-gnu-ld --with-newlib --with-system-zlib CFLAGS="-fstack-protector-strong -O2 -D_FORTIFY_SOURCE=2 -Wl,-z,relro,-z,now,-z,noexecstack -fPIE" CXXFLAGS="-fstack-protector-strong -O2 -D_FORTIFY_SOURCE=2 -Wl,-z,relro,-z,now,-z,noexecstack -fPIE" CXXFLAGS_FOR_TARGET="-Os -mcmodel=medlow -Wall -fstack-protector-strong -Wl,-z,relro,-z,now,-z,noexecstack -Wtrampolines -fno-short-enums -fno-short-wchar" CFLAGS_FOR_TARGET="-Os -mcmodel=medlow -Wall -fstack-protector-strong -Wl,-z,relro,-z,now,-z,noexecstack -Wtrampolines -fno-short-enums -fno-short-wchar" --bindir=/opt/gcc_riscv32/bin --libexecdir=/opt/gcc_riscv32/riscv32 --libdir=/opt/gcc_riscv32 --includedir=/opt/gcc_riscv32 && make -j16 && make install && cd ..
......
......@@ -7,7 +7,7 @@ This module implements automatic service initialization. That is, the initializa
For details about how to include the **zInit** code segment, see the Hi3861 linker script in **vendor/hisi/hi3861/hi3861/build/link/link.ld.S**.
For details about the macros used by the bootstrap module to implement automatic service initialization, see [API document](https://gitee.com/openharmony/docs/blob/master/api/api-SmartVision-Devices/OHOS-Init.md) for the startup subsystem.
For details about the macros used by the bootstrap module to implement automatic service initialization, see [API document](https://device.harmonyos.com/en/docs/develop/apiref/init-0000001054598113) the startup subsystem.
## Available APIs<a name="section1633115419401"></a>
......
......@@ -52,7 +52,7 @@
- **Solution**
```
sudo apt-get install dosfstools mtools
sudo apt-get install dosfstools mtools
```
......@@ -67,7 +67,7 @@
Permission is required to access files in the **riscv** compiler path.
- **Solution**
1. Run the following command to query the directory where **hcc\_riscv32** is located:
1. Run the following command to query the directory where **gcc\_riscv32** is located:
```
which riscv32-unknown-elf-gcc
......
......@@ -15,7 +15,6 @@ build/lite # Primary directory for compilation and building
│ ├── kernel # Compilation configuration parameters of the kernel
│ └── subsystem # Subsystem template
├── ndk # NDK-related compilation scripts and configuration parameters
├── product # Full configuration tables of the product, which contain configuration units, the subsystem list, and the compiler
└── toolchain # Compilation toolchains, which contain the compiler directories, compilation options, and linking options
```
......
......@@ -102,17 +102,16 @@ It is considered best practice to learn the following basic concepts before you
build a specified product with
{product_name}@{company}, eg: ipcamera@hisilcon
-f, --full full code compilation
-n, --ndk compile ndk
```
- If you run **hb build** with no argument, the previously configured code directory, product, and options are used for the compilation.
- If you run **hb build** with no argument, the previously configured code directory, product, and options are used for the compilation. The **-f** option will delete all products to be compiled, which is equivalent to running **hb clean** and **hb build**.
- You can run **hb build** _\{component\_name\}_ to compile 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 compile the product directly.
- You can run **hb build** in **device/device\_company/board** to select the kernel and start compilation based on the current development board and the selected kernel to generate an image that contains the kernel and driver only.
4. **hb clean**
Clear the compilation result of the product in the **out** directory, and leave the **args.gn** and **build.log** files only. To clear files in a specified directory, add the directory parameter to the command, for example, **hb clean** _xxx_**/out/**_xxx_.
Clear the compilation result of the product in the **out** directory, and retain the **args.gn** and **build.log** files only. To clear files in a specified directory, add the directory parameter to the command, for example, **hb clean** _xxx_**/out/**_xxx_.
```
......
# Development Example<a name="EN-US_TOPIC_0000001061399563"></a>
For details, see the [example in the open-source project](https://gitee.com/openharmony/aafwk_frameworks_kits_ability_lite/tree/master/example).
For details, see the [example in the open-source project](https://gitee.com/openharmony/aafwk_aafwk_lite/tree/master/frameworks/ability_lite/example).
......@@ -3,7 +3,15 @@
- [When to Use](#section18502174174019)
- [Signature Verification Process](#section554632717226)
- [Available APIs](#section1633115419401)
- [How to Develop](#section4207112818418)
- [Development Procedure \(Scenario 1\)](#section4207112818418)
- [Signature Verification](#section11470123816297)
- [Self-signed Application Generation](#section167151429133312)
- [Development Examples](#section174318361353)
- [Development Procedure \(Scenario 2\)](#section81272563427)
- [Signature Verification](#section07028210442)
- [Development Examples](#section1930711345445)
- [Debugging and Verification](#section427316292411)
## When to Use<a name="section18502174174019"></a>
......@@ -23,24 +31,23 @@ After the HAP is signed, a signature block is added between the file block and t
The signature verification process consists of three steps: HAP signature verification, signature verification for the profile signature block, and profile content verification.
- HAP signature verification
The process is as follows:
1. Use the preset root certificate of the device to verify the certificate chain in the file signature block and prove that the leaf certificate is trusted.
2. Use the public key in the leaf certificate to verify the file signature block and prove that this block is not tampered with.
3. Calculate and merge the digests of the file block, central directory, and EOCD. Merge the calculation result with the digest of the profile signature block in the signature block. Then compare the merge result with the digest of the file signature block. If they are the same, the HAP signature verification is successful.
**HAP signature verification**
Use the preset root certificate of the device and the certificate chain to prove that the leaf certificate is trusted. Then use the digest obtained by decrypting the public key of the leaf certificate to prove that the HAP is not tampered with.
- Signature verification for the profile signature block
The process is as follows:
First of all, check who issued the signature of the profile signature block. If the signature was issued by the application market, the signature is trusted and does not need to be verified. Otherwise, the signature needs to be verified. Next, verify the certificate chain and then use the leaf certificate to verify the signature of the profile signature block to prove that it is not tampered with.
1. Use the preset root certificate of the device to verify the certificate chain in the file signature block and prove that the leaf certificate is trusted.
2. Use the public key in the leaf certificate to verify the file signature block and prove that this block is not tampered with.
3. Calculate and merge the digests of the file block, central directory, and EOCD. Merge the calculation result with the digest of the profile signature block in the signature block. Then compare the merge result with the digest of the file signature block. If they are the same, the HAP signature verification is successful.
**Signature verification for the profile signature block**
- Profile content verification
First of all, check who issued the signature of the profile signature block. If the signature was issued by the application market, the signature is trusted and does not need to be verified. Otherwise, the signature needs to be verified. Next, verify the certificate chain and then use the leaf certificate to verify the signature of the profile signature block to prove that it is not tampered with.
Obtain the profile and check the validity of its content. If the HAP is a debugging application, check whether the UDID of the current device is contained in the UDID list in the profile. If yes, the verification is successful. Then compare the certificate in the profile with the leaf certificate used for HAP verification \(this is not required for a released or OpenHarmony self-signed application\). If they are the same, the entire signature verification process is complete.
**Profile content verification**
Obtain the profile and check the validity of its content. If the HAP is a debugging application, check whether the UDID of the current device is contained in the UDID list in the profile. If yes, the verification is successful. Then compare the certificate in the profile with the leaf certificate used for HAP verification \(this is not required for a released or OpenHarmony self-signed application\). If they are the same, the entire signature verification process is complete.
## Available APIs<a name="section1633115419401"></a>
......@@ -74,62 +81,81 @@ The following table lists the innerkits APIs provided by the signature verificat
</tbody>
</table>
## How to Develop<a name="section4207112818418"></a>
## Development Procedure \(Scenario 1\)<a name="section4207112818418"></a>
Application signature verification applies to the following scenarios:
### Signature Verification<a name="section11470123816297"></a>
- Verification of applications released in the application market, debugging applications signed with debugging certificates of the application market, and OpenHarmony self-signed applications
- Verification of applications signed with certificates that are based on debugging root keys
Verification of applications released in the application market, debugging applications signed with debugging certificates of the application market, and OpenHarmony self-signed applications
The signature verification procedure in the first scenario is as follows:
1. Construct the **VerifyResult** structure.
1. Construct the VerifyResult structure.
```
VerifyResult verifyResult = {0};
```
2. Call the **APPVERI\_AppVerify** function by specifying the file path and **VerifyResult** to verify the application signature.
2. Call the APPVERI\_AppVerify function by specifying the file path and VerifyResult to verify the application signature.
```
int32_t ret = APPVERI_AppVerify(hapFilepath.c_str(), &verifyResult);
```
3. Check the returned result. If the verification is successful, obtain and process the data in **VerifyResult**.
3. Check the returned result. If the verification is successful, obtain and process the data in VerifyResult.
```
signatureInfo.appId = verifyResult.profile.appid;
signatureInfo.provisionBundleName = verifyResult.profile.bundleInfo.bundleName;
```
4. Call the **APPVERI\_FreeVerifyRst** function to release memory in **VerifyResult**.
4. Call the APPVERI\_FreeVerifyRst function to release memory in VerifyResult.
```
APPVERI_FreeVerifyRst(&verifyResult);
```
>![](public_sys-resources/icon-note.gif) **NOTE:**
>To obtain a OpenHarmony self-signed application, prepare the signature tool, system application HAP, system application profile \(\*.p7b\), signing certificate \(\*.cer\), and signing public/private key pair \(\*.jks\).
>After obtaining the preceding materials, perform the following operations:
>1. Place all the materials in the same directory and start the shell.
>2. Run the following command in the shell to sign the application:
> ```
> java -jar hapsigntoolv2.jar sign -mode localjks -privatekey "OpenHarmony Software Signature" -inputFile camera.hap -outputFile signed_camera.hap -signAlg SHA256withECDSA -keystore OpenHarmony.jks -keystorepasswd 123456 -keyaliaspasswd 123456 -profile camera_release.p7b -certpath OpenHarmony.cer -profileSigned 1
> ```
> Key fields:
> **-jar**: signature tool, which is **[hapsigntool](https://repo.huaweicloud.com/harmonyos/develop_tools/hapsigntoolv2.jar)**
> **-mode**: local signature flag, which is fixed at **localjks**
> **-privatekey**: alias of the public/private key pair, which is **OpenHarmony Software Signature**
> **-inputFile**: application to be signed, which is generated through compilation
> **-outputFile**: signed application
> **-signAlg**: signing algorithm, which is fixed at **SHA256withECDSA**
> **-keystore**: public/private key pair, which is **[OpenHarmony.jks](https://gitee.com/openharmony/security_services_app_verify/blob/master/OpenHarmonyCer/OpenHarmony.jks)** in the **OpenHarmonyCer** directory of the **security\_services\_app\_verify** repository. The default password is **123456**. You can use a tool \(such as keytool\) to change the password.
> **-keystorepasswd**: password of the public/private key pair, which is **123456** by default
> **-keyaliaspasswd**: password of the public/private key pair alias, which is **123456** by default
> **-profile**: application profile, which is stored in the code directory
> **-certpath**: signing certificate, which is **[OpenHarmony.cer](https://gitee.com/openharmony/security_services_app_verify/blob/master/OpenHarmonyCer/OpenHarmony.cer)** in the **OpenHarmonyCer** directory of the **security\_services\_app\_verify** repository.
> **-profileSigned**: whether the signature block contains the profile. The value is fixed at **1**, indicating that the signature block contains the profile.
### OpenHarmony Self-signed Application Generation<a name="section167151429133312"></a>
The OpenHarmony self-signed application generation procedure is as follows:
1. Prepare required materials.
Prepare the signature tool, system application HAP, system application profile \(\*.p7b\), signing certificate \(\*.cer\), and signing public/private key pair \(\*.jks\).
2. Place all the materials in the same directory and start the shell.
3. Run the following command in the shell to sign the application:
```
java -jar hapsigntoolv2.jar sign -mode localjks -privatekey "OpenHarmony Software Signature" -inputFile camera.hap -outputFile signed_camera.hap -signAlg SHA256withECDSA -keystore OpenHarmony.jks -keystorepasswd 123456 -keyaliaspasswd 123456 -profile camera_release.p7b -certpath OpenHarmony.cer -profileSigned 1
```
Key fields:
**-jar**: signature tool, which is **[hapsigntool](https://repo.huaweicloud.com/harmonyos/develop_tools/hapsigntoolv2.jar)**
**-mode**: local signature flag, which is fixed at **localjks**
**-privatekey**: alias of the public/private key pair, which is **OpenHarmony Software Signature**
**-inputFile**: application to be signed, which is generated through compilation
**-outputFile**: signed application
**-signAlg**: signing algorithm, which is fixed at **SHA256withECDSA**
**-keystore**: public/private key pair, which is [OpenHarmony.jks](https://gitee.com/openharmony/security_appverify/blob/master/interfaces/innerkits/appverify_lite/OpenHarmonyCer/OpenHarmony.jks) in the **OpenHarmonyCer** directory of the **security\_services\_app\_verify** repository. The default password is **123456**. You can use a tool \(such as keytool\) to change the password.
**-keystorepasswd**: password of the public/private key pair, which is **123456** by default
**-keyaliaspasswd**: password of the public/private key pair alias, which is **123456** by default
**-profile**: application profile, which is stored in the code directory
**-certpath**: signing certificate, which is [OpenHarmony.cer](https://gitee.com/openharmony/security_appverify/blob/master/interfaces/innerkits/appverify_lite/OpenHarmonyCer/OpenHarmony.cer) in the **OpenHarmonyCer** directory of the **security\_services\_app\_verify** repository.
**-profileSigned**: whether the signature block contains the profile. The value is fixed at **1**, indicating that the signature block contains the profile.
### Development Examples<a name="section174318361353"></a>
The following example describes how the application management framework component verifies the signature of an application during its installation.
......@@ -160,9 +186,13 @@ uint8_t HapSignVerify::VerifySignature(const std::string &hapFilepath, Signature
}
```
The signature verification procedure in the second scenario is as follows:
## Development Procedure \(Scenario 2\)<a name="section81272563427"></a>
1. Call the **APPVERI\_SetDebugMode\(true\)** function to enable debugging mode.
### Signature Verification<a name="section07028210442"></a>
The procedure is as follows:
1. Call the APPVERI\_SetDebugMode\(true\) function to enable the debugging mode.
```
ManagerService::SetDebugMode(true);
......@@ -181,13 +211,15 @@ The signature verification procedure in the second scenario is as follows:
```
2. Construct the **VerifyResult** structure, verify the application signature, and release memory in **VerifyResult**.
3. Call the **APPVERI\_SetDebugMode\(false\)** function to disable debugging mode.
3. Call the APPVERI\_SetDebugMode\(false\) function to disable the debugging mode.
```
ManagerService::SetDebugMode(false);
```
### Development Examples<a name="section1930711345445"></a>
The following is the example code \(supplemented based on the example code for scenario 1\):
```
......
......@@ -38,23 +38,25 @@ You can use APIs of the distributed communication subsystem to implement fast an
1. **Device discovery**
When using device discovery, ensure that the device to perform a discovery and the device to discover are in the same LAN and the devices can receive packets from each other.
When using device discovery, ensure that the device to perform a discovery and the device to discover are in the same LAN and the devices can receive packets from each other.
a. After a device sends a discovery request, it uses Constrained Application Protocol \(CoAP\) to send a broadcast packet in the LAN.
a. After a device sends a discovery request, it uses Constrained Application Protocol \(CoAP\) to send a broadcast packet in the LAN.
b. The discovered device uses the **PublishService** API to publish services. After receiving the broadcast packet, the device sends a CoAP unicast packet to the device that performs the discovery.
b. The discovered device uses the **PublishService** API to publish services. After receiving the broadcast packet, the device sends a CoAP unicast packet to the device that performs the discovery.
c. After receiving the packet, the device that performs the discovery updates device information.
c. After receiving the packet, the device that performs the discovery updates device information.
**2. Transmission**
2. **Transmission**
The soft bus provides unified session-based transmission. Services can receive and send data or obtain basic attributes through **sessionId**. Currently, services can determine whether to accept a received session based on the service requirements and session attributes. Currently, sessions cannot be enabled.
## Repositories Involved<a name="section4499619123117"></a>
communication\_softbus\_lite
**Intelligent Soft Bus subsystem**
communication\_ipc\_lite
[communication\_softbus\_lite](https://gitee.com/openharmony/communication_softbus_lite/blob/master/README.md)
communication\_wifi\_aware
[communication\_ipc\_lite](https://gitee.com/openharmony/communication_ipc_lite/blob/master/README.md)
[communication\_wifi\_aware](https://gitee.com/openharmony/communication_wifi_aware/blob/master/README.md)
# LiteIPC driver
## Overview
LiteIPC is an OpenHarmony extension to the LiteOS(a) kernel which provides a means for processes on the same device to communicate with each other. It is a somewhat higher level mechanism than POSIX IPC methods such as message queues or shared memory, providing automatic management of resources used for IPC and control of access rights to send messages to other processes. IPC messages are exchanged between tasks. An IPC service is a task which has been set up to receive request type messages. Access rights are granted to processes, if a process has access to a service then all tasks in the process are able to send requests to the service.
## API
*Application-layer Interface*
//foundation/communication/ipc_lite/frameworks/liteipc/include/liteipc.h
//foundation/communication/ipc_lite/interfaces/kits/liteipc_adapter.h
*Implementation*
//kernel/liteos_a/kernel/extended/liteipc/hm_liteipc.h
//kernel/liteos_a/kernel/extended/liteipc/hm_liteipc.c
`LITEIPC_DRIVER` specifies the name of the character device used to communicate with the LiteIPC driver (currently /dev/lite_ipc).
Memory mapping allocates a memory area for storing messages received by the process' tasks. ioctl calls to the driver before it has been memory mapped return with error **ENOMEM**.
The IpcMsg structure is the basic unit of transaction for LiteIPC.
| Member | Type | Description |
| --------- | ----------- | ----------- |
| type | MsgType | The message's type. It can be one of the following values **MT_REQUEST**, **MT_REPLY**, **MT_FAILED_REPLY**, **MT_DEATH_NOTIFY**. |
| target | SvcIdentity | Specifies the message's recipient. |
| flag | IpcFlag | Indicates whether the message can be replied to or is one-way. It can be one of the following values **LITEIPC_FLAG_DEFAULT**, **LITEIPC_FLAG_ONEWAY**. |
| dataSz | UINT32 | The size of the message data in bytes pointed to by data (cannot exceed IPC_MSG_DATA_SZ_MAX, currently 1024 bytes). |
| data | void* | Pointer to the message data. |
| spObjNum | UINT32 | The number of special objects contained in the message data (cannot exceed IPC_MSG_OBJECT_NUM_MAX). |
| offsets | void* | An array of offsets relative to data pointing to SpecialObj special objects in data. |
| code | UINT32 | Service function code. |
| timestamp | UINT64 | Timestamp for when the message was sent. Automatically set by the IPC system for requests and death notifications. |
| taskID | UINT32 | Specifies the message's sender. Automatically set by the IPC system. |
| processID | UINT32 | Additional information on the message's sender. Automatically set by the IPC system. |
SpecialObj
| Member | Type | Description |
| ------- | ---------- | ----------- |
| type | ObjType | The type of special object. It can be one of the following values **OBJ_FD**, **OBJ_PTR**, **OBJ_SVC**. |
| content | ObjContent | The special object. |
ObjContent
| SpecialObj type | Member | Type | Description |
| --------------- | ------ | ----------- | ----------- |
| OBJ_FD | fd | UINT32 | Currently does nothing. |
| OBJ_PTR | ptr | BuffPtr | Auxiliary data to be sent (not limited by IPC_MSG_DATA_SZ_MAX). |
| OBJ_SVC | svc | SvcIdentity | A service to give the recipient permission to send requests to. |
`IPC_SEND_RECV_MSG` is the primary request which provides the ability to send and receive IpcMsg messages as well as free memory used by unneeded messages. Its argument is a pointer to an IpcContent structure.
IpcContent
| Member | Type | Description |
| ---------- | ----------- | ----------- |
| flag | UINT32 | Specifies the operation(s) to be performed. It is the bitwise-or of one or more of the following flags **SEND**, **RECV**, **BUFF_FREE**. |
| outMsg | IpcMsg* | Points to a message to be sent. |
| inMsg | IpcMsg* | Points to a message that has been received. |
| buffToFree | void* | Points to IPC memory to be freed (a previously received message which is no longer needed). |
- The **SEND** flag indicates a request to send outMsg. Returns with error **EINVAL** if any member of the message has been given an invalid value.
- Sending a message with type **MT_REQUEST** returns with error **EACCES** if the task doesn't have access rights to the recipient, and **EINVAL** for an invalid recipient. All tasks have access rights to the CMS (see IPC_SET_CMS), and to their own process' IPC services.
- Sending a message with type **MT_REPLY** or **MT_FAILED_REPLY** returns with error **EINVAL** if any of the following are not satisifed:
- buffToFree must point at the message being replied to and the **BUFF_FREE** flag must be set.
- The outMsg recipient (target.handle) must match the buffToFree sender (taskID).
- The outMsg and buffToFree timestamps must match.
- buffToFree must be a **MT_REQUEST** type message and cannot be marked as **LITEIPC_FLAG_ONEWAY**.
- buffToFree must be addressed to a service of the current process.
Trying to reply to a message sent more than LITEIPC_TIMEOUT_NS nanoseconds ago (currently 5 seconds) returns with error **ETIME**.
The message is copied into memory allocated from the IPC memory area of the process for the recipient task specified by target.handle. Returns with error **ENOMEM** if the memory cannot be allocated. Special objects in offsets are then processed. **OBJ_PTR** objects' data is copied into memory allocated from the recipient's IPC memory area, discards the message and returns with error **EINVAL** if unable to allocate enough memory. **OBJ_SVC** objects grant the recipient access rights to the service specified by the object if the sender already has access and the service is set as an IPC task (see IPC_SET_IPC_THREAD), discards the message and returns with error **EACCES** if the sender doesn't have access or **EINVAL** if the service isn't running. Access rights are not revokable, on error any access rights granted before the special object which caused the error will remain. The message is then added to the tail end of the recipient's list of received messages, the recipient is woken and the scheduler is called.
- The **BUFF_FREE** flag indicates a request to free the memory used by the buffToFree message so it can be used again later for receiving messages. Returns with error **EFAULT** if buffToFree doesn't point to a received message. Returns with error **EINVAL** if an invalid address.
- The **RECV** flag indicates a request to receive a message.
- If the **SEND** flag is set the task will wait for a message for up to LITEIPC_TIMEOUT_MS milliseconds (currently 5 seconds). Returns with error **ETIME** on timeout. Messages with a type of **MT_REQUEST** and **MT_REPLY** or **MT_FAILED_REPLY** type messages which don't match outMsg (matching timestamp or matching code and target.token depending on kernel configuration) are discarded (resets timer). Sets inMsg to point at the received message and removes it from the list of received messages for **MT_REPLY** or **MT_DEATH_NOTIFY** type messages. Note that receiving a **MT_DEATH_NOTIFY** makes it impossible to receive the reply so send/receive requests shouldn't be used by services which might receive death notifications. Discards the message and returns with error **ENOENT** without changing inMsg if the received message has type **MT_FAILED_REPLY**.
- If the **SEND** flag is not set, the task will sleep until a message with type **MT_REQUEST** or **MT_DEATH_NOTIFY** is received. Sets inMsg to point at the received message, and removes the message from its list of received messages. Discards **MT_REPLY** or **MT_FAILED_REPLY** type messages received while waiting.
For a single request the operations are processed in the order **SEND**->**BUFF_FREE**->**RECV** with **BUFF_FREE** being processed even if there was an error in **SEND**. Error checking on buffToFree occurs before **SEND**, an error in buffToFree will abort the request without doing anything.
The `IPC_SET_IPC_THREAD` request designates the current task as the IPC task for the current process. It can only be performed once per process. Returns the ID of the task set as IPC task on success, subsequent calls return with error **EINVAL**. The IPC task receives the death notifications from IPC services the process has access rights to when those services terminate. A service which has been set as IPC task can have access rights to itself distributed through special objects without using the CMS.
IPC_SEND_RECV_MSG and IPC_SET_IPC_THREAD both return with error **EINVAL** if the CMS has not been set.
### Internal functions
The first task to use the `IPC_SET_CMS` request sets itself as the system's CMS. OpenHarmony assigns this role to the distributed scheduler's samgr. Once set it cannot be changed. Returns with error **EEXIST** if the CMS has already been set. Messages are sent to the CMS by setting a recipient handle of 0. The argument to the request specifies the maximum size of a message sent to the CMS. Sending a message whose total size including IpcMsg data structure, data size, size of special object offsets, and data in any BuffPtr special objects exceeds the maximum size (currently 256 bytes) returns with error **EINVAL**.
The `IPC_CMS_CMD` request provides various service related utility functions to the CMS. It can only be used by the CMS, any other task making this request will get an **EACCES** error. The argument to the request is a pointer to a CmsCmdContent structure. The cmd member indicates the function to be performed.
- **CMS_GEN_HANDLE** creates a service handle for the task specified by taskID member and stores the handle in the serviceHandle member. The CMS always has access rights to any created IPC services.
- **CMS_REMOVE_HANDLE** unregisters the service handle specified by the serviceHandle member.
- **CMS_ADD_ACCESS** gives the task specified by the taskID member access rights to the service specified by the serviceHandle member.
LiteIPC includes utility functions for the kernel to manage the IPC system.
`LiteIpcInit` initializes the IPC system and must be called before it can be used.
`LiteIpcPoolInit` performs basic initialization of a ProcIpcInfo. Called by the kernel on task creation to initialize the IPC variables in the task's control block.
`LiteIpcPoolReInit` initializes the IPC variables of a child task from it's parent's task. Called by the kernel on the creation of child tasks for basic initialization.
`LiteIpcPoolDelete` removes a process' IPC memory pool allocated by memory mapping and all the process' access rights. Called by the kernel on process deletion for automatic memory and IPC resource management.
`LiteIpcRemoveServiceHandle` deregisters a service, clearing out the service task's message list and the list of processes with access rights to the service and sending death notification messages to any services with a set IPC task which had access. Death notification messages are only sent once, if there is an error in the send (**ENOMEM**) the recipient will not get the death notification. Death notification messages set target.token to the sevice handle of the service which terminated. Called by the kernel on task deletion for automatic IPC resource management.
### Sample code
1. Initialization before we can use LiteIPC.
```
#include "liteipc_adapter.h"
#include "liteipc.h"
int fd = open(LITEIPC_DRIVER, O_RDONLY);
mmap(NULL, 10000, PROT_READ, MAP_PRIVATE, fd, 0);
```
2. Send a message to the CMS. For simplicity let's say we have a primitive CMS which simply gives us access to and returns the handle of the service named in the request we send to it.
```
#define SVCNAME "wakeup service"
IpcMsg msg = {
.type = MT_REQUEST,
.target = { 0, 0, 0 },
.flag = LITEIPC_FLAG_DEFAULT,
.dataSz = sizeof(SVCNAME),
.data = SVCNAME,
.spObjNum = 0,
.offsets = NULL
};
IpcContent content = {
.flag = SEND | RECV,
.outMsg = &msg
};
// Send a message to the CMS
if (ioctl(fd, IPC_SEND_RECV_MSG, &content) < 0) {
goto ERROR;
}
```
3. Set our IPC task and send a message to the wakeup service.
```
// Set ourselves as IPC task so we can distribute access on our own
int myId = ioctl(fd, IPC_SET_IPC_THREAD, 0);
struct {
char summary[20];
SpecialObj command;
SpecialObj svc;
} wakeupData = {
.summary = "one wakeup"
};
char commandStr[100] = "Wake me up at 9:00 in the morning.";
void* wakeupOffsets[2] = {
(void*)((uintptr_t)&wakeupData.command - (uintptr_t)&wakeupData),
(void*)((uintptr_t)&wakeupData.svc - (uintptr_t)&wakeupData)
};
// Send a request to the wakeup service and free the CMS's reply
content.flag = SEND | BUFF_FREE;
content.buffToFree = content.inMsg;
msg.type = MT_REQUEST;
// Set the recipient from the CMS' reply
msg.target.handle = *(uint32_t*)content.inMsg->data;
// Add the auxiliary data.
wakeupData.command.type = OBJ_PTR;
wakeupData.command.content.ptr.buffSz = sizeof(commandStr);
wakeupData.command.content.ptr.buff = commandStr;
// Give the wakeup service access to send us requests.
wakeupData.svc.type = OBJ_SVC;
wakeupData.svc.content.svc.handle = myId;
// Complete the message and send it.
msg.data = &wakeupData;
msg.dataSz = sizeof(wakeupData);
msg.offsets = wakeupOffsets;
msg.spObjNum = 2;
if (ioctl(fd, IPC_SEND_RECV_MSG, &content) < 0) {
goto ERROR;
}
```
4. Wait for wakeup and process the wakeup message.
```
// Enter "server" mode, wait for the service to wake us up.
content.flag = RECV;
ioctl(fd, IPC_SEND_RECV_MSG, &content);
// Free the received message
content.flag = BUFF_FREE;
content.buffToFree = content.inMsg;
ioctl(fd, IPC_SEND_RECV_MSG, &content);
```
5. LiteIPC automatically cleans up our IPC resources when we exit, but closing the file descriptor when we're done using it is a good habit.
```
ERROR:
close(fd);
```
# Lite Power Management<a name="EN-US_TOPIC_0000001083440980"></a>
# Power Management<a name="EN-US_TOPIC_0000001083440980"></a>
- [Introduction](#section11660541593)
- [Directory Structure](#section19472752217)
......@@ -6,12 +6,12 @@
## Introduction<a name="section11660541593"></a>
The lite power management subsystem provides the following capabilities:
The power management subsystem provides the following capabilities:
1. Querying the battery level
2. Keeping the device screen always on using a lock
**Figure 1** Lite power management subsystem architecture<a name="fig106301571239"></a>
**Figure 1** power management subsystem architecture<a name="fig106301571239"></a>
![](figures/en-us_image_0000001130297625.png)
......@@ -20,15 +20,14 @@ The lite power management subsystem provides the following capabilities:
```
base/powermgr/powermgr_lite
├── interfaces # APIs
├── interfaces # APIs
│ └── kits
│ └── battery # API for querying the battery level
└── services # Services
└── services # Services
├── include
└── source
```
## Repositories Involved<a name="section63151229062"></a>
**hmf/powermgr/powermgr\_lite**
[**powermgr_powermgr_lite**](https://gitee.com/openharmony/powermgr_powermgr_lite)
此差异已折叠。
# OpenHarmony 1.0 \(2020-09-10\)<a name="EN-US_TOPIC_0000001079132978"></a>
OpenHarmony 1.0 is the initial release for this product.
- [Overview](#section249611124916)
- [Source Code Acquisition](#section127301717165113)
- [Acquiring Source Code from an Image Site](#section157648475298)
- [Acquiring Source Code Using the repo Tool](#section49746186307)
## Overview<a name="section249611124916"></a>
This is the initial release for this product.
## Source Code Acquisition<a name="section127301717165113"></a>
### Acquiring Source Code from an Image Site<a name="section157648475298"></a>
**Table 1** Sites for acquiring source code
<a name="table91984129177"></a>
<table><thead align="left"><tr id="row51981312101713"><th class="cellrowborder" valign="top" width="25%" id="mcps1.2.5.1.1"><p id="p16618172471719"><a name="p16618172471719"></a><a name="p16618172471719"></a>Source Code</p>
</th>
<th class="cellrowborder" valign="top" width="25%" id="mcps1.2.5.1.2"><p id="p46181224161718"><a name="p46181224161718"></a><a name="p46181224161718"></a>Version Information</p>
</th>
<th class="cellrowborder" valign="top" width="25%" id="mcps1.2.5.1.3"><p id="p1461814241177"><a name="p1461814241177"></a><a name="p1461814241177"></a>Site</p>
</th>
<th class="cellrowborder" valign="top" width="25%" id="mcps1.2.5.1.4"><p id="p12618192481716"><a name="p12618192481716"></a><a name="p12618192481716"></a>SHA-256 Verification Code</p>
</th>
</tr>
</thead>
<tbody><tr id="row174961746125013"><td class="cellrowborder" valign="top" width="25%" headers="mcps1.2.5.1.1 "><p id="p697315226515"><a name="p697315226515"></a><a name="p697315226515"></a>Full code base</p>
</td>
<td class="cellrowborder" valign="top" width="25%" headers="mcps1.2.5.1.2 "><p id="p1997312229519"><a name="p1997312229519"></a><a name="p1997312229519"></a>1.0</p>
</td>
<td class="cellrowborder" valign="top" width="25%" headers="mcps1.2.5.1.3 "><p id="p1797320223518"><a name="p1797320223518"></a><a name="p1797320223518"></a><a href="https://repo.huaweicloud.com/harmonyos/os/1.0/code-1.0.tar.gz" target="_blank" rel="noopener noreferrer">Site</a></p>
</td>
<td class="cellrowborder" valign="top" width="25%" headers="mcps1.2.5.1.4 "><p id="p6973102210516"><a name="p6973102210516"></a><a name="p6973102210516"></a><a href="https://repo.huaweicloud.com/harmonyos/os/1.0/code-1.0.tar.gz.sha256" target="_blank" rel="noopener noreferrer">SHA-256 verification code</a></p>
</td>
</tr>
<tr id="row1049714618507"><td class="cellrowborder" valign="top" width="25%" headers="mcps1.2.5.1.1 "><p id="p14973722165114"><a name="p14973722165114"></a><a name="p14973722165114"></a>Hi3861 solution (binary)</p>
</td>
<td class="cellrowborder" valign="top" width="25%" headers="mcps1.2.5.1.2 "><p id="p1361982418176"><a name="p1361982418176"></a><a name="p1361982418176"></a>1.0</p>
</td>
<td class="cellrowborder" valign="top" width="25%" headers="mcps1.2.5.1.3 "><p id="p797314223515"><a name="p797314223515"></a><a name="p797314223515"></a><a href="https://repo.huaweicloud.com/harmonyos/os/1.0/wifiiot-1.0.tar.gz" target="_blank" rel="noopener noreferrer">Site</a></p>
</td>
<td class="cellrowborder" valign="top" width="25%" headers="mcps1.2.5.1.4 "><p id="p5973422115112"><a name="p5973422115112"></a><a name="p5973422115112"></a><a href="https://repo.huaweicloud.com/harmonyos/os/1.0/wifiiot-1.0.tar.gz.sha256" target="_blank" rel="noopener noreferrer">SHA-256 verification code</a></p>
</td>
</tr>
<tr id="row7498114620508"><td class="cellrowborder" valign="top" width="25%" headers="mcps1.2.5.1.1 "><p id="p1097311229513"><a name="p1097311229513"></a><a name="p1097311229513"></a>Hi3518 solution (binary)</p>
</td>
<td class="cellrowborder" valign="top" width="25%" headers="mcps1.2.5.1.2 "><p id="p0619122471719"><a name="p0619122471719"></a><a name="p0619122471719"></a>1.0</p>
</td>
<td class="cellrowborder" valign="top" width="25%" headers="mcps1.2.5.1.3 "><p id="p19973222165111"><a name="p19973222165111"></a><a name="p19973222165111"></a><a href="https://repo.huaweicloud.com/harmonyos/os/1.0/ipcamera_hi3518ev300-1.0.tar.gz" target="_blank" rel="noopener noreferrer">Site</a></p>
</td>
<td class="cellrowborder" valign="top" width="25%" headers="mcps1.2.5.1.4 "><p id="p10973722105113"><a name="p10973722105113"></a><a name="p10973722105113"></a><a href="https://repo.huaweicloud.com/harmonyos/os/1.0/ipcamera_hi3518ev300-1.0.tar.gz.sha256" target="_blank" rel="noopener noreferrer">SHA-256 verification code</a></p>
</td>
</tr>
<tr id="row19498194619507"><td class="cellrowborder" valign="top" width="25%" headers="mcps1.2.5.1.1 "><p id="p8973202285119"><a name="p8973202285119"></a><a name="p8973202285119"></a>Hi3516 solution (binary)</p>
</td>
<td class="cellrowborder" valign="top" width="25%" headers="mcps1.2.5.1.2 "><p id="p10619182441718"><a name="p10619182441718"></a><a name="p10619182441718"></a>1.0</p>
</td>
<td class="cellrowborder" valign="top" width="25%" headers="mcps1.2.5.1.3 "><p id="p497442295116"><a name="p497442295116"></a><a name="p497442295116"></a><a href="https://repo.huaweicloud.com/harmonyos/os/1.0/ipcamera_hi3516dv300-1.0.tar.gz" target="_blank" rel="noopener noreferrer">Site</a></p>
</td>
<td class="cellrowborder" valign="top" width="25%" headers="mcps1.2.5.1.4 "><p id="p1997442295110"><a name="p1997442295110"></a><a name="p1997442295110"></a><a href="https://repo.huaweicloud.com/harmonyos/os/1.0/ipcamera_hi3516dv300-1.0.tar.gz.sha256" target="_blank" rel="noopener noreferrer">SHA-256 verification code</a></p>
</td>
</tr>
<tr id="row14989469503"><td class="cellrowborder" valign="top" width="25%" headers="mcps1.2.5.1.1 "><p id="p997482215517"><a name="p997482215517"></a><a name="p997482215517"></a>RELEASE-NOTES</p>
</td>
<td class="cellrowborder" valign="top" width="25%" headers="mcps1.2.5.1.2 "><p id="p176191824181712"><a name="p176191824181712"></a><a name="p176191824181712"></a>1.0</p>
</td>
<td class="cellrowborder" valign="top" width="25%" headers="mcps1.2.5.1.3 "><p id="p697413223518"><a name="p697413223518"></a><a name="p697413223518"></a><a href="https://repo.huaweicloud.com/harmonyos/os/1.0/RELEASE-NOTES.txt" target="_blank" rel="noopener noreferrer">Site</a></p>
</td>
<td class="cellrowborder" valign="top" width="25%" headers="mcps1.2.5.1.4 "><p id="p15974222165114"><a name="p15974222165114"></a><a name="p15974222165114"></a>N/A</p>
</td>
</tr>
</tbody>
</table>
### Acquiring Source Code Using the repo Tool<a name="section49746186307"></a>
Method 1 \(recommended\): Use the **repo** tool to download the source code.
```
repo init -u https://gitee.com/openharmony/manifest.git -b master --no-repo-verify
repo sync -c
```
Method 2: Run the **git clone** command to clone a single code repository.
Go to the [code repository homepage](https://gitee.com/openharmony), select the code repository to be cloned, and run the following command:
```
git clone https://gitee.com/openharmony/manifest.git -b master
```
# OpenHarmony Release Notes
- [OpenHarmony 1.0.1 \(2021-03-15\)](OpenHarmony-1-0-1.md)
- [OpenHarmony 1.0 \(2020-09-10\)](OpenHarmony-1-0.md)
- [OpenHarmony 1.1.0 LTS \(2021-04-27\)](openharmony-1-1-0-lts.md)
- [OpenHarmony 1.0 \(2020-09-10\)](openharmony-1-0.md)
此差异已折叠。
......@@ -8,7 +8,10 @@
您必须首先签署“贡献者许可协议”(CLA),然后才能参与社区贡献。
在“[docs/zh-cn/contribute](https://gitee.com/openharmony/docs/tree/master/zh-cn/contribute)“路径下获取CLA文本,发送邮件至[contact@openharmony.io](mailto:contact@openharmony.io) 。(线上签署待开放)
在“[docs/zh-cn/contribute](https://gitee.com/openharmony/docs/tree/master/zh-cn/contribute)“路径下获取CLA Markdown文件,将签署后的CLA Markdown文件发送邮件至[contact@openharmony.io](mailto:contact@openharmony.io) 。(线上签署待开放)
- 签署CLA--个人独立贡献者:个人名义参与开源,选择CLA协议。
- 签署CLA--法律实体贡献者:以公司、团队或者项目参与开源,代表XX法律实体签署CLA协议。
**行为准则**
......
......@@ -34,5 +34,5 @@
\* 必填。请确保邮箱与你的gitee账号绑定。
请将签署后的CLA文件发送邮件至contact@openharmony.io 。(线上签署待开放)
请将签署后的CLA Markdown文件发送邮件至contact@openharmony.io 。(线上签署待开放)
......@@ -40,3 +40,4 @@
\* 必填。请确保邮箱与你的gitee账号绑定。
请将签署后的CLA Markdown文件发送邮件至contact@openharmony.io 。(线上签署待开放)
\ No newline at end of file
......@@ -21,8 +21,8 @@
## 社区安全问题披露<a name="section725624119448"></a>
- 安全处理流程
- [安全问题处理和发布流程](https://gitee.com/openharmony/security/blob/master/zh/security-process/README.md)
- 安全披露信息
- [安全和披露说明](https://gitee.com/openharmony/security/blob/master/zh/security-process/security-disclosure.md)
......@@ -10,7 +10,7 @@
## 环境准备<a name="section124971410183614"></a>
- 针对Git的安装、环境配置及使用方法,请参考码云帮助中心的Git知识大全:[https://gitee.com/help/categories/43](https://gitee.com/help/categories/43)
- 注册SSH公钥,请参考码云帮助中心的公钥管理:[https://gitee.com/help/articles/4181](https://gitee.com/help/articles/4181)
- 注册SSH公钥,请参考码云帮助中心的公钥管理:[https://gitee.com/help/articles/4191](https://gitee.com/help/articles/4191)
- 在开展Gitee的工作流之前,您需要先在OpenHarmony的代码托管平台上找到您感兴趣的Repository。
## 代码下载<a name="section6125202333611"></a>
......@@ -18,7 +18,7 @@
## 从云上Fork代码分支<a name="section8365811818"></a>
1. 找到并打开对应Repository的首页。
2. 点击右上角的 Fork 按钮,按照指引,建立一个属于**“个人”**的云上Fork分支。
2. 点击右上角的 Fork 按钮,按照指引,建立一个属于**个人**的云上Fork分支。
## 把Fork仓下载到本地<a name="section49051646201819"></a>
......@@ -122,7 +122,7 @@
repo config --global repo.token {TOKEN}
```
token码在码云个人设置→安全设置→私人令牌中生成,例如
token码在码云[个人设置→安全设置→私人令牌](https://gitee.com/profile/personal_access_tokens)中生成,例如
```
repo config --global repo.token 211XXXXXXXXXXXXXXXXXXXXXXXX
......@@ -212,7 +212,7 @@ repo push --br="20200903" --d="master" --content="#I1TVV4"
## 将Issue与PR关联<a name="section5470144853615"></a>
创建PR或编已有的PR时,描述框输入\#+I+五位Issue ID,即可将Issue与PR关联。
创建PR或编已有的PR时,描述框输入\#+I+五位Issue ID,即可将Issue与PR关联。
**约束:**
......
# OpenHarmony API治理章程
## 总览
为了引导OpenHarmony应用生态健康、有序发展演进,本章程对OpenHarmony API的新增、变更、废弃、删除等生命周期与治理流程进行约束,同时定义了基本的API设计要求。
本章程由API SIG制定,经PMC批准发布;本对章程的修订必须经由API SIG评审后,由PMC批准发布。
## API范围与定义
应用程序接口(API)位于应用层和框架层之间,是由操作系统预定义的、由框架层和系统应用提供给应用(包括系统应用和三方应用)开发使用的类、方法等用户程序编程接口;不包括OEM扩展接口。
![](figures/API-Scope-And-Definition.png)
OpenHarmony API按使用方分类包括:
- PublicApi:公开发布,提供给三方应用开发使用的API。
- SystemApi:非公开发布,仅授权系统应用可使用的API。
- TestApi:受限发布,仅适用于xTS或应用调试阶段可使用的API。
OpenHarmony API按编程语言分类包括:
- Java API:面向应用开放的Java编程语言接口。
- JS API:面向应用开放的JavaScript编程语言接口。
- Native API:面向应用开放的C/C++编程语言接口。
## API治理
### 角色与职责
|**涉及角色**|**API治理中的职责**|
| - | - |
|Contributor|API的设计和交付主体,负责API相关的代码与设计文档提交。|
|Committer|API相关的代码评审,涉及API提交预审。|
|领域SIG|<p>新增API相关的代码提交评审,领域SIG评审通过即可合入。</p><p>变更API相关的代码提交预审。</p>|
|API SIG|变更API相关的代码提交评审。|
|PMC|API Version计划发布、API治理章程修订评审发布等。|
### API评审流程
API评审流程如下:
![](figures/API-Review-Process.png)
主要过程说明:
1. API评审申请、代码提交(Owner:Contributor),除代码提交外,如果涉及API新增或变更需同步提交相应的API设计文档,详细说明API的需求来源、场景与使用方法、权限设计、隐私保护澄清等,详见后面的API评审申请要素。为避免后续的返工,Contributor可以在正式的API评审申请、代码提交之前,先通过邮件方式将API设计文档提交Committer、领域SIG、API SIG等相关人员预审。
1. 代码评审(Owner:Committer),代码评审和API预审,涉及API提交CodeReview通过后,还需要进一步领域SIG评审。如果单次提交同时涉及多个领域的API新增或变更,相应的API评审申请和代码需要同时提交给相关领域的Committer评审,只有所有对应领域的Committer都完成CodeReview后才能进入下一评审环节。
1. API评审(Owner:领域SIG),新增API相关的代码提交评审,领域SIG评审通过即可代码合入;变更API相关的代码提交,领域SIG评审通过后,还需要进一步提交API SIG。如果单次提交同时涉及多个领域的API新增,相应的API评审申请和代码需要同时提交给相关领域的SIG评审,只需一个领域SIG评审通过即可代码合入。如果单次提交同时涉及多个领域的API变更,相应的API评审申请和代码需要同时提交给相关领域的SIG评审,只有所有对应领域的SIG都要评审通过才能进入下一评审环节。
1. API变更评审(Owner:SIG),变更API相关的代码提交评审,评审通过即可代码。
1. 评审完成。
### API评审申请要素
如果涉及API新增或变更需同步提交相应的API设计文档,建议包含如下要素:
1. 需求来源与使用场景(必须)。
1. API现状与差距分析,说明API新增或变更的必要性(必须)。
1. API原型设计与使用方法说明(必须);必要时,可以进一步包含相应的使用样例(可选)。
1. API权限设计(必须)。
1. API隐私保护方案与要求满足情况澄清(必须);
1. 提交代码的同时提交相应的API参考(必须);必要时,可同步提交相应的开发者指南文档(可选)。
1. 针对老接口的处理方式(废弃、隐藏或彻底删除)、替代接口和相应的应用兼容措施(可选,如果涉及API变更,则必须包含)。
1. 兼容性/性能/功耗/可靠性/测试等相关情况说明(可选,如不满足本章程 “4 API设计要求”,则必须包含相关说明)。
## API设计要求
### 一致性要求
1. 概念一致性:基于场景的业务模型抽象,形成OpenHarmony的连贯、一致、自恰的用户程序模型和业务概念。
1. 术语一致性:相应的业务术语必须采用统一名词,不允许使用多个语意接近的名词表示同一个业务对象;同样地,为了避免产生混淆,也不允许针对不同的业务对象使用相同的名词或语言接近的名词。
1. 操作一致性:相同的操作动作必须采用同一动词。
1. 参数顺序一致性:相同参数/参数序列在多个API中的位置和顺序保持一致。
1. 机制及算法一致性:通信机制、调用模式、认证机制、加密算法等保持一致。
1. 帮助、Demo、模板风格一致性:排版、用法等保持一致。
### 易用性要求
以“能力使用者”视角,而不是“能力提供者”视角设计API:
1. 可理解:API命名和功能特性必须容易理解。
1. 易使用:提供简单易用的API,减少API之间不必要的耦合,避免多个无之间关联关系API之间调用顺序的依赖,尽可能使调用者优雅,尽量避免使用单一功能时必须同时组合调用多个包/模块或类中的多方法才能实现。
1. 避免误导:提供使用者期望的能力,避免误导,减少误用。
1. 提供必要的API文档。
### 命名要求
1. 能清晰的表达意图:使用完整的描述性的单词。
1. 避免造成误导:有误导的名字比表达不清的名字还要有危害性。
1. 词义清晰明了,避免使用info,data,object等一般意义的词。
1. 作用域越大,命名应越精确。
1. 不用或少用缩写,业界通用术语遵从行业习惯允许使用缩写。
1. 包名/模块名/命名空间前缀约定:
1. Java API 统一包名: package ohos.\*
2. JS API 统一模块名:@system.\*
3. Native API 统一命名空间:namespace OHOS.\*
4. 引用外部开源代码的,可以保留原包名/模块名/命名空间,也可以按照上述规则统一进行替换。
7. 包名/模块名/命名空间最短不少于2段,最长不超过4段;每一段建议使用一个单词,最长不超过2个单词。
8. 类名、方法名/函数名、成员变量、变量名最多不超过4个单词。
### 权限控制要求
1. 完备性原则:一切穿透应用沙箱的行为都需考虑使用权限来管控。
1. 最优粒度原则:一个权限只保护一类对象;一个接口仅需申请一个权限即可访问。
1. 清晰完整原则:权限定义中必须清晰说明保护对象、开放范围、敏感级别。
1. 最小开放原则:一个权限仅对确有正当业务需求的应用开放,开放控制可通过权限来实现。
### 隐私保护要求
1. API调用的返回仅包含必要的内容, 避免携带额外信息。
1. API调用不允许获取、手机用户个人数据, 除非通过用户权限管控、由用户授权同意。
1. API涉及跨应用调用时,如涉及个人数据向被调用者的披露,由调用方在隐私声明中说明披露的数据类型、数据接收者和数据使用目的。
1. API涉及到用户敏感数据(如电话、通讯录、媒体等)访问时,需要使用system picker的机制,禁止API通过申请敏感权限方式访问。
1. API开放禁止捆绑与所开放能力不相关的功能。
### 文档化要求
1. API参考采用英文方式交付。
1. 模块/包模块的API参考必须包括简要描述和详细描述。
1. 类、方法、“Interface”、枚举或成员变量的API参考必须包括简要描述。
1. 类、方法、“Interface”、枚举或成员变量的API参考可选包括详细描述。
1. 方法、“Interface”的API参考必须包括所有入参的参数描述。
1. 如果方法或“Interface”有返回值,则API参考必须包含返回值描述。
1. 如果执行过程中可能抛出异常,则API参数必须包含相关的异常描述。
1. 必须包含API的起始版本号(使用@since注释标记)。
1. 可选包括本模块或类自己的版本号(使用@version注释标记)。
### 兼容性要求
1. 按严格程度从高到低,API兼容要求包括:契约兼容 > 二进制兼容 > 源码兼容。
1. 源码兼容:指版本演进后,开发者已有的源代码可正常编译通过。
1. 二进制兼容:指版本演进后,开发者已有程序不用重新编译可正常链接、运行。
1. 契约兼容:也称语义兼容,指版本演进后,开发者原有程序行为不发生变化。
1. OpenHarmony API后向兼容必须满足二进制兼容要求,常见破坏二进制兼容的API变更包括:
1. 任何API元素删除;
1. 降低方法的可见性,例如protected修改为了private,或者public修改为protected。
1. 类类型发生变化,例如抽象类变更为非抽象类,或者接口类(“Interface”)变更为非接口类。
1. 方法原型发生变化,例如返回值类型修改,或入参顺序或入参类型发生变化。
1. 成员final/static等属性发生变化,例如非final成员变成final,或者非static的成员变成static。
1. OpenHarmony API在特定目的下,如Bugfix,允许不遵守契约兼容要求。
1. 禁止“原型相同、功能不兼容”的API修改,可受限使用“废弃old-api、新增new-api”的方式进行修改。
1. 根据发布类型不同,API的生命周期和兼容性要求:
![](figures/API-Lifecycle.png)
1. Canary版本:相同API Version的多个Canary版本之间要求保持API兼容,Canary阶段新增的API允许在后续的Canary版本中标记为废弃或隐藏。Canary阶段新增的API允许在后续第一个Beta版本中彻底删除。
2. Beta版本:相同API Version的多个Beta版本之间要求保持API兼容,Beta阶段新增的API允许在后续的Beta版本中标记为废弃或隐藏,API Stable版本发布之后API即冻结,之后再发布的Beta版不允许任何形式的API新增或变更。Beta阶段新增的且在API Stable版本中标记为废弃或隐藏的API允许在后续第一个Release版本中彻底删除。
3. Release版本:通过Release版本对外发布的API,需要遵守对外部开发者的“契约承诺”,原则上不允许对已经Release发布的API进行不兼容修改,受限允许对已发布的API进行废弃。已经Release发布的API废弃基本要求包括:
1. 废弃接口标记。
2. 提供可替代接口。
3. 废弃API至少保留5个API Version版本(对废弃5个API Version的API可以彻底删除,不再支持)。
### 性能/功耗/可靠性要求
1. 应及时响应,避免调用者等待;如果API调用执行时间过长应设计为异步方式。
1. 应关注API调用时机、调用频次对RAM占用的影响。
1. 应关注API调用时机、调用频次对功耗的影响。
1. API内部创建对象的生命周期要闭合,避免对象资源泄漏。
1. 满足幂等性要求,相同业务含义的请求API调用一次或多次重试总能获得相同的效果(API调用依赖外部资源的变化除外)。针对可重入的API调用实现内部应尽量避免引入时变因素,如系统tick、静态变量、没有互斥保护的全局变量等;针对同一客户端的多次重复调用,可以使用contextID、clientToken、squenceNo等作为调用入参。
### 测试要求
1. 新增API必须同步交付API自动化测试用例,用例100%覆盖API接口。
1. 用例场景单一,单条用例覆盖接口单个功能场景,简化单条用例代码逻辑。
1. 用例执行高效,每条用例执行时间控制在毫秒级。
\ No newline at end of file
......@@ -208,9 +208,9 @@ OpenHarmony的Docker镜像托管在[HuaweiCloud SWR](https://console.huaweicloud
## 获取设备开发工具(HUAWEI DevEco Device Tool)<a name="zh-cn_topic_0000001055701144_section2452141120244"></a>
HUAWEI DevEco Device Tool是HarmonyOS面向智能设备开发者提供的一站式集成开发环境,支持HarmonyOS的组件按需定制,支持代码编辑、编译、烧录、调试等功能,支持C/C++语言,以插件的形式部署在Visual Studio Code上。具体可参见[获取工具](https://device.harmonyos.com/cn/ide)[工具使用指南](https://device.harmonyos.com/cn/docs/ide/user-guides/service_introduction-0000001050166905)**。**
HUAWEI DevEco Device Tool是OpenHarmony面向智能设备开发者提供的一站式集成开发环境,支持OpenHarmony的组件按需定制,支持代码编辑、编译、烧录、调试等功能,支持C/C++语言,以插件的形式部署在Visual Studio Code上。具体可参见[获取工具](https://device.harmonyos.com/cn/ide)[工具使用指南](https://device.harmonyos.com/cn/docs/ide/user-guides/service_introduction-0000001050166905)**。**
## 获取应用开发工具(HUAWEI DevEco Studio)<a name="zh-cn_topic_0000001055701144_section0904101019258"></a>
HUAWEI DevEco Studio(以下简称DevEco Studio)是面向华为终端全场景多设备的一站式集成开发环境(IDE),为开发者提供工程模板创建、开发、编译、调试、发布等E2E的HarmonyOS应用开发服务。通过使用DevEco Studio,开发者可以更高效的开发具备HarmonyOS分布式能力的应用,进而提升创新效率。具体可参见[获取工具](https://developer.harmonyos.com/cn/develop/deveco-studio)[工具使用指南](https://developer.harmonyos.com/cn/docs/documentation/doc-guides/tools_overview-0000001053582387)
HUAWEI DevEco Studio(以下简称DevEco Studio)是面向华为终端全场景多设备的一站式集成开发环境(IDE),为开发者提供工程模板创建、开发、编译、调试、发布等E2E的OpenHarmony应用开发服务。通过使用DevEco Studio,开发者可以更高效的开发具备OpenHarmony分布式能力的应用,进而提升创新效率。具体可参见[获取工具](https://developer.harmonyos.com/cn/develop/deveco-studio)[工具使用指南](https://developer.harmonyos.com/cn/docs/documentation/doc-guides/tools_overview-0000001053582387)
......@@ -24,7 +24,7 @@ HAL层主要功能是实现轻OpenHarmony与芯片的解耦,以下模块描述
**IOT外设子系统HAL层接口说明**:
需要芯片适配相关接口的实现,对芯片设备外设接口依赖请参考[wifiiot的HAL头文件](https://gitee.com/openharmony/iothardware_hals_wifiiot_lite/tree/master)
需要芯片适配相关接口的实现,对芯片设备外设接口依赖请参考[IOT外设子系统的HAL头文件](https://gitee.com/openharmony/iothardware_peripheral/tree/master/interfaces/kits)
## WLAN服务<a name="section1331917210911"></a>
......@@ -70,5 +70,5 @@ vendor/hisi/hi3861/hi3861_adapter/hals/communication/wifi_lite/wifiservice/
└── wifi_hotspot.c
```
需要芯片适配相关接口的实现,对芯片设备外设接口依赖请参考[WLAN服务的头文件](https://gitee.com/openharmony/communication_interfaces_kits_wifi_lite/tree/master/wifiservice)
需要芯片适配相关接口的实现,对芯片设备外设接口依赖请参考[WLAN服务的头文件](https://gitee.com/openharmony/communication_wifi_lite/tree/master/interfaces/wifiservice)
......@@ -5,7 +5,7 @@
## 编译构建流程<a name="section1111311235313"></a>
编译构建系统是一个基于gn和ninja组件化构建系统,支持按组件配置、裁剪和拼装,按需构建出定制化的产品。编译构建流程如下:
编译构建系统是一个基于gn和ninja组件化构建系统,支持按组件配置、裁剪和拼装,按需构建出定制化的产品。编译构建流程如下:
**图 1** 编译构建流程<a name="fig23781931124913"></a>
![](figures/编译构建流程.png "编译构建流程")
......@@ -15,7 +15,7 @@
>![](public_sys-resources/icon-note.gif) **说明:**
>编译类型debug选项涉及到XTS的测试用例是否参与编译;release选项会移除最后编译生成文件的符号表、调试信息等
- 读取产品配置:读取解决方案厂商的产品配置文件vendor/x\_company/x\_product.json文件,主要包括开发板、内核类型、内核版本和配置的组件。
- 读取产品配置:读取解决方案厂商的产品配置文件vendor/my\_company/my\_product.json文件,主要包括开发板、内核类型、内核版本和配置的组件。
- gn生成ninja文件:根据产品的配置解析结果,按对应的编译工具链将所选组件加入编译,配置全局的编译选项。
- 执行ninja启动编译:组件逐个编译和链接。
......@@ -25,7 +25,7 @@ gn语法和基础知识请参见官方[快速入门](https://gn.googlesource.com
首先,创建开发板目录,以芯片厂商realtek的“rtl8720“开发板为例,需创建device/realtek/rtl8720目录。编译相关的适配步骤如下:
1. 编译工具链和编译选项配置
1. 编译工具链和编译选项配置
构建系统默认使用ohos-clang编译工具链,也支持芯片厂商按开发板自定义配置。开发板编译配置文件编译相关的变量如下:
......@@ -43,14 +43,14 @@ gn语法和基础知识请参见官方[快速入门](https://gn.googlesource.com
编译构建会按产品的选择的开发板,加载对应的config.gni,该文件中变量对系统组件全局可见。
以芯片厂商realtek的“rtl8720“开发板为例,device/realtek/rtl8720/liteos\_m/config.gni如下:
以芯片厂商realtek的“rtl8720“开发板为例,device/realtek/rtl8720/liteos\_m/config.gni的内容如下:
```
# Kernel type, e.g. "linux", "liteos_a", "liteos_m".
kernel_type = "liteos_m"
# Kernel version.
kernel_version = ""
kernel_version = "3.0.0"
# Board CPU type, e.g. "cortex-a7", "riscv32".
board_cpu = "real-m300"
......@@ -80,20 +80,59 @@ gn语法和基础知识请参见官方[快速入门](https://gn.googlesource.com
board_ld_flags = []
```
2. 开发板编译脚本
2. 开发板编译脚本
新增的开发板,对应目录下需要新增BUILD.gn文件作为开发板编译的总入口。以芯片厂商realtek的rtl8720开发板为例,对应的device/realtek/rtl8720/BUILD.gn为:
```
group("rlt8720") {
group("rtl8720") {
...
}
```
3. 编译调试
3. 编译调试开发板。
1. 任意目录执行hb set按提示设置源码路径和要编译的产品。
2. 在开发板目录下执行hb build, 即可启动开发板的编译。
4. 编译调试产品
将开发板和组件信息写入产品配置文件,该配置文件字段说明如下:
- product\_name:产品名称,支持自定义,建议与vendor下的三级目录名称一致。
- ohos\_version:OpenHarmony版本号,应与实际下载的版本一致。
- device\_company:芯片解决方案厂商名称,建议与device的二级目录名称一致。
- board:开发板名称,建议与device的三级级目录名称一致。
- kernel\_type:内核类型,应与开发板支持的内核类型匹配。
- kernel\_version:内核版本号,应与开发板支持的内核版本匹配。
- subsystem:产品选择的子系统,应为OS支持的子系统,OS支持的子系统请见build/lite/components目录下的各子系统描述文件。
- components:产品选择的某个子系统下的组件,应为某个子系统支持的组件,子系统支持的组件请见build/lite/components/子系统.json文件。
- features:产品配置的某个组件的特性,组件支持的特性请见build/lite/components/子系统.json中对应组件的features字段。
以基于“rtl8720“开发板的wifiiot模组为例,vendor/my\_company/wifiiot/config.json如下:
```
{
"product_name": "wifiiot", # 产品名称
"ohos_version": "OpenHarmony 1.0", # 使用的OS版本
"device_company": "realtek", # 芯片解决方案厂商名称
"board": "rtl8720", # 开发板名称
"kernel_type": "liteos_m", # 选择的内核类型
"kernel_version": "3.0.0", # 选择的内核版本
"subsystems": [
{
"subsystem": "kernel", # 选择的子系统
"components": [
{ "component": "liteos_m", "features":[] } # 选择的组件和组件特性
]
},
...
{
更多子系统和组件
}
]
}
```
......@@ -6,6 +6,8 @@
- [软件要求](#section965634210501)
- [安装Linux编译环境](#section182916865219)
- [将Linux shell改为bash](#section1715027152617)
- [安装编译依赖基础软件(仅Ubuntu 20+需要)](#section45512412251)
- [安装文件打包工具](#section8352161417450)
- [安装hc-gen](#section2075110583451)
- [安装Java 虚拟机环境](#section101989994613)
......@@ -39,31 +41,45 @@ Hi3516开发板对Linux服务器通用环境配置需要的工具及其获取途
**表 1** Linux服务器开发工具及获取途径
<a name="table6299192712513"></a>
<table><thead align="left"><tr id="row122993276512"><th class="cellrowborder" valign="top" width="22.152215221522155%" id="mcps1.2.4.1.1"><p id="p1829914271858"><a name="p1829914271858"></a><a name="p1829914271858"></a>开发工具</p>
<table><thead align="left"><tr id="row122993276512"><th class="cellrowborder" valign="top" width="25.112511251125113%" id="mcps1.2.4.1.1"><p id="p1829914271858"><a name="p1829914271858"></a><a name="p1829914271858"></a>开发工具</p>
</th>
<th class="cellrowborder" valign="top" width="18.09180918091809%" id="mcps1.2.4.1.2"><p id="p429918274517"><a name="p429918274517"></a><a name="p429918274517"></a>用途</p>
<th class="cellrowborder" valign="top" width="15.13151315131513%" id="mcps1.2.4.1.2"><p id="p429918274517"><a name="p429918274517"></a><a name="p429918274517"></a>用途</p>
</th>
<th class="cellrowborder" valign="top" width="59.75597559755976%" id="mcps1.2.4.1.3"><p id="p12997271757"><a name="p12997271757"></a><a name="p12997271757"></a>获取途径</p>
</th>
</tr>
</thead>
<tbody><tr id="row76242594498"><td class="cellrowborder" valign="top" width="22.152215221522155%" headers="mcps1.2.4.1.1 "><p id="p1682494111548"><a name="p1682494111548"></a><a name="p1682494111548"></a>dosfstools、mtools、mtd-utils</p>
<tbody><tr id="row167343191518"><td class="cellrowborder" valign="top" width="25.112511251125113%" headers="mcps1.2.4.1.1 "><p id="p467443191517"><a name="p467443191517"></a><a name="p467443191517"></a>bash</p>
</td>
<td class="cellrowborder" valign="top" width="18.09180918091809%" headers="mcps1.2.4.1.2 "><p id="p1362445934918"><a name="p1362445934918"></a><a name="p1362445934918"></a>文件打包工具</p>
<td class="cellrowborder" valign="top" width="15.13151315131513%" headers="mcps1.2.4.1.2 "><p id="p0674153114151"><a name="p0674153114151"></a><a name="p0674153114151"></a>命令行处理工具</p>
</td>
<td class="cellrowborder" valign="top" width="59.75597559755976%" headers="mcps1.2.4.1.3 "><p id="p1262475944916"><a name="p1262475944916"></a><a name="p1262475944916"></a>通过apt-get install安装</p>
<td class="cellrowborder" valign="top" width="59.75597559755976%" headers="mcps1.2.4.1.3 "><p id="p116746312151"><a name="p116746312151"></a><a name="p116746312151"></a>系统配置</p>
</td>
</tr>
<tr id="row18516509507"><td class="cellrowborder" valign="top" width="22.152215221522155%" headers="mcps1.2.4.1.1 "><p id="p14521650135017"><a name="p14521650135017"></a><a name="p14521650135017"></a>hc-gen</p>
<tr id="row14885193315201"><td class="cellrowborder" valign="top" width="25.112511251125113%" headers="mcps1.2.4.1.1 "><p id="p137174662119"><a name="p137174662119"></a><a name="p137174662119"></a>编译基础软件包(仅ubuntu 20+需要)</p>
</td>
<td class="cellrowborder" valign="top" width="18.09180918091809%" headers="mcps1.2.4.1.2 "><p id="p125255010501"><a name="p125255010501"></a><a name="p125255010501"></a>驱动配置编译工具</p>
<td class="cellrowborder" valign="top" width="15.13151315131513%" headers="mcps1.2.4.1.2 "><p id="p258814561424"><a name="p258814561424"></a><a name="p258814561424"></a>编译依赖的基础软件包</p>
</td>
<td class="cellrowborder" valign="top" width="59.75597559755976%" headers="mcps1.2.4.1.3 "><p id="p1749611716181"><a name="p1749611716181"></a><a name="p1749611716181"></a>通过互联网获取</p>
</td>
</tr>
<tr id="row52253812238"><td class="cellrowborder" valign="top" width="25.112511251125113%" headers="mcps1.2.4.1.1 "><p id="p28007392236"><a name="p28007392236"></a><a name="p28007392236"></a>dosfstools、mtools、mtd-utils</p>
</td>
<td class="cellrowborder" valign="top" width="15.13151315131513%" headers="mcps1.2.4.1.2 "><p id="p98008390232"><a name="p98008390232"></a><a name="p98008390232"></a>文件打包工具</p>
</td>
<td class="cellrowborder" valign="top" width="59.75597559755976%" headers="mcps1.2.4.1.3 "><p id="p280018394233"><a name="p280018394233"></a><a name="p280018394233"></a>通过apt-get install安装</p>
</td>
</tr>
<tr id="row18516509507"><td class="cellrowborder" valign="top" width="25.112511251125113%" headers="mcps1.2.4.1.1 "><p id="p14521650135017"><a name="p14521650135017"></a><a name="p14521650135017"></a>hc-gen</p>
</td>
<td class="cellrowborder" valign="top" width="15.13151315131513%" headers="mcps1.2.4.1.2 "><p id="p125255010501"><a name="p125255010501"></a><a name="p125255010501"></a>驱动配置编译工具</p>
</td>
<td class="cellrowborder" valign="top" width="59.75597559755976%" headers="mcps1.2.4.1.3 "><p id="p145061517114519"><a name="p145061517114519"></a><a name="p145061517114519"></a><a href="https://repo.huaweicloud.com/harmonyos/compiler/hc-gen/0.65/linux/hc-gen-0.65-linux.tar" target="_blank" rel="noopener noreferrer">https://repo.huaweicloud.com/harmonyos/compiler/hc-gen/0.65/linux/hc-gen-0.65-linux.tar</a></p>
</td>
</tr>
<tr id="row29204072315"><td class="cellrowborder" valign="top" width="22.152215221522155%" headers="mcps1.2.4.1.1 "><p id="p5921190162318"><a name="p5921190162318"></a><a name="p5921190162318"></a>Java 虚拟机环境</p>
<tr id="row29204072315"><td class="cellrowborder" valign="top" width="25.112511251125113%" headers="mcps1.2.4.1.1 "><p id="p5921190162318"><a name="p5921190162318"></a><a name="p5921190162318"></a>Java 虚拟机环境</p>
</td>
<td class="cellrowborder" valign="top" width="18.09180918091809%" headers="mcps1.2.4.1.2 "><p id="p17921110152311"><a name="p17921110152311"></a><a name="p17921110152311"></a>编译、调试和运行Java程序</p>
<td class="cellrowborder" valign="top" width="15.13151315131513%" headers="mcps1.2.4.1.2 "><p id="p17921110152311"><a name="p17921110152311"></a><a name="p17921110152311"></a>编译、调试和运行Java程序</p>
</td>
<td class="cellrowborder" valign="top" width="59.75597559755976%" headers="mcps1.2.4.1.3 "><p id="p16921805237"><a name="p16921805237"></a><a name="p16921805237"></a>通过apt-get install安装</p>
</td>
......@@ -77,6 +93,37 @@ Hi3516开发板对Linux服务器通用环境配置需要的工具及其获取途
>- 如果后续通过“HPM组件方式”或“HPM包管理器命令行工具方式”获取源码,不需要安装LLVM、hc-gen编译工具。
>- (推荐)如果后续通过“镜像站点方式”或“代码仓库方式”获取源码,需要安装LLVM、hc-gen编译工具。安装LLVM、hc-gen编译工具时,请确保编译工具的环境变量路径唯一。
### 将Linux shell改为bash<a name="section1715027152617"></a>
查看shell是否为bash,在终端运行如下命令
```
ls -l /bin/sh
```
如果显示为“/bin/sh -\> bash”则为正常,否则请按以下方式修改:
**方法一**:在终端运行如下命令,然后选择 no。
```
sudo dpkg-reconfigure dash
```
**方法二**:先删除sh,再创建软链接。
```
sudo rm -rf /bin/sh
sudo ln -s /bin/bash /bin/sh
```
### 安装编译依赖基础软件(仅Ubuntu 20+需要)<a name="section45512412251"></a>
执行以下命令进行安装:
```
sudo apt-get install build-essential && sudo apt-get install gcc && sudo apt-get install g++ && sudo apt-get install make && sudo apt-get install zlib* && sudo apt-get install libffi-dev
```
### 安装文件打包工具<a name="section8352161417450"></a>
1. 打开Linux编译服务器终端。
......
此差异已折叠。
# 快速入门
- [环境搭建](环境搭建.md)
- [搭建系统基础环境](搭建系统基础环境.md)
- [搭建系统基础环境](搭建系统基础环境.md)
- [Hi3861开发板](Hi3861开发板.md)
- [Hi3861开发板介绍](Hi3861开发板介绍.md)
......
......@@ -438,13 +438,13 @@
![](figures/chuankou1.png)
1. 单击**Serial port**打开串口。
2. 输入串口编号\(按照烧录步骤中查询的串口号,此处以com11举例\),并连续输入回车直到串口显示"hisillicon"。
2. 输入串口编号\(按照烧录步骤中查询的串口号,此处以com11举例\),并连续输入回车直到串口显示"hisilicon"。
3. 单板初次启动或修改启动参数,请进入[步骤2](开发Hi3516第一个应用程序示例.md#l5b42e79a33ea4d35982b78a22913b0b1),否则进入[步骤3](开发Hi3516第一个应用程序示例.md#ld26f18828aa44c36bfa36be150e60e49)。
2. (单板初次启动必选)修改U-boot的bootcmd及bootargs内容:该步骤为固化操作,若不修改参数只需执行一次。每次复位单板均会自动进入系统。
>![](public_sys-resources/icon-notice.gif) **须知:**
>U-boot引导程序默认会有2秒的等待时间,用户可使用回车打断等待并显示"hisillicon",通过**reset**命令可再次启动系统。
>U-boot引导程序默认会有2秒的等待时间,用户可使用回车打断等待并显示"hisilicon",通过**reset**命令可再次启动系统。
**表 1** U-boot修改命令
......
......@@ -7,7 +7,7 @@ bootstrap服务启动组件实现了服务的自动初始化,即服务的初
zInit段的添加可参考已有的Hi3861平台的链接脚本,文件路径为vendor/hisi/hi3861/hi3861/build/link/link.ld.S。
用于实现服务的自动初始化的宏定义接口请参见启动恢复子系统的[API接口文档](https://gitee.com/openharmony/docs/blob/master/api/api-SmartVision-Devices/OHOS-Init.md)
用于实现服务的自动初始化的宏定义接口请参见启动恢复子系统的[API接口文档](https://device.harmonyos.com/cn/docs/develop/apiref/init-0000001054598113)
## 接口说明<a name="section1633115419401"></a>
......
......@@ -142,7 +142,7 @@
-signAlg:签名算法,当前固定为SHA256withECDSA
-keystore:公私钥对,使用签名公私钥对,位于开源库security\_services\_app\_verify仓中OpenHarmonyCer目录下,[OpenHarmony.jks](https://gitee.com/openharmony/security_services_app_verify/blob/master/OpenHarmonyCer/OpenHarmony.jks)。默认密码为123456 ,用户可采用工具\(例如keytool\)更改默认密码
-keystore:公私钥对,使用签名公私钥对,位于开源库security\_services\_app\_verify仓中OpenHarmonyCer目录下,[OpenHarmony.jks](https://gitee.com/openharmony/security_appverify/blob/master/interfaces/innerkits/appverify_lite/OpenHarmonyCer/OpenHarmony.jks)。默认密码为123456 ,用户可采用工具\(例如keytool\)更改默认密码
-keystorepasswd:公私钥对密码,默认签名公私钥对密码为123456
......@@ -150,7 +150,7 @@
-profile:描述文件,应用的描述文件位于对应源代码目录中
-certpath:使用签名证书,位于开源库security\_services\_app\_verify仓中OpenHarmonyCer目录下,[OpenHarmony.cer](https://gitee.com/openharmony/security_services_app_verify/blob/master/OpenHarmonyCer/OpenHarmony.cer)
-certpath:使用签名证书,位于开源库security\_services\_app\_verify仓中OpenHarmonyCer目录下,[OpenHarmony.cer](https://gitee.com/openharmony/security_appverify/blob/master/interfaces/innerkits/appverify_lite/OpenHarmonyCer/OpenHarmony.cer)
-profileSigned:签名块中是否包含描述文件\(profile\)。固定为1(包含)
......
# 开发实例<a name="ZH-CN_TOPIC_0000001061399563"></a>
开发实例可参考[开源项目中的示例](https://gitee.com/openharmony/aafwk_frameworks_kits_ability_lite/tree/master/example)
开发实例可参考[开源项目中的示例](https://gitee.com/openharmony/aafwk_aafwk_lite/tree/master/frameworks/ability_lite/example)
......@@ -67,7 +67,7 @@
当前用户对riscv编译器路径下的文件访问权限不够。
-**解决办法:**
1. 查询hcc\_riscv32所在目录。
1. 查询gcc\_riscv32所在目录。
```
which riscv32-unknown-elf-gcc
......
......@@ -15,7 +15,6 @@ build/lite # 编译构建主目录
│ ├── kernel # 内核的编译配置参数
│ └── subsystem # 子系统模板
├── ndk # NDK相关编译脚本与配置参数
├── product # 产品全量配置表,包括:配置单元、子系统列表、编译器等。
└── toolchain # 编译工具链相关,包括:编译器路径、编译选项、链接选项等。
```
......
......@@ -102,17 +102,16 @@
build a specified product with
{product_name}@{company}, eg: ipcamera@hisilcon
-f, --full full code compilation
-n, --ndk compile ndk
```
- hb build后无参数,会按照设置好的代码路径、产品进行编译,编译选项使用与之前保持一致。
- hb build后无参数,会按照设置好的代码路径、产品进行编译,编译选项使用与之前保持一致。-f 选项将删除当前产品所有编译产品,等同于hb clean + hb build.
- hb build \{component\_name\}:基于设置好的产品对应的单板、内核,单独编译组件(e.g.:hb build kv\_store\)。
- hb build -p ipcamera@hisilicon:免set编译产品,该命令可以跳过set步骤,直接编译产品。
- 在device/device\_company/board下单独执行hb build会进入内核选择界面,选择完成后会根据当前路径的单板、选择的内核编译出仅包含内核、驱动的镜像。
4. **hb clean**
清除out目录对应产品的编译产物,仅剩下args.gn、build.log。清除指定路径可输入路径参数:hb clean xxx/out/xxx,否则将清除hb set的产品对应out路径。
清除out目录对应产品的编译产物,仅保留args.gn、build.log。清除指定路径可输入路径参数:hb clean xxx/out/xxx,否则将清除hb set的产品对应out路径。
```
......
......@@ -101,7 +101,9 @@ startAbility(want); // 按照Want启动指定FA,want参数命名以实际开
## 涉及组件<a name="section176111311166"></a>
[分布式任务调度组件](https://gitee.com/openharmony/docs/blob/master/readme/distributedschedule/dmslite.md)
[dms_fwk_lite](https://gitee.com/openharmony/distributedschedule_dms_fwk_lite/blob/master/README_zh.md)
[系统服务框架组件](https://gitee.com/openharmony/docs/blob/master/readme/distributedschedule/samgrlite.md)
[samgr_lite](https://gitee.com/openharmony/distributedschedule_samgr_lite/blob/master/README_zh.md)
[safwk_lite](https://gitee.com/openharmony/distributedschedule_safwk_lite/blob/master/README_zh.md)
......@@ -230,7 +230,7 @@
**用户程序框架子系统**
[aafwk\_\aafwk\_lite](https://gitee.com/openharmony/aafwk_aafwk_lite/blob/master/README_zh.md)
[aafwk\_aafwk\_lite](https://gitee.com/openharmony/aafwk_aafwk_lite/blob/master/README_zh.md)
[appexecfwk\_appexecfwk\_lite](https://gitee.com/openharmony/appexecfwk_appexecfwk_lite/blob/master/README_zh.md)
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册