同步操作将从 OpenHarmony/docs 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
OpenHarmony provides the following two types of Docker environments for you to quickly get the development environment ready:
Table 1 Docker image
Before using the Docker environment, perform the following operations:
Install Docker. For details, see Install Docker Engine.
Obtain the OpenHarmony source code. For details, see Source Code Acquisition.
NOTE
You do not need to obtain the source code for the HPM-based Docker environment.
The Docker image of OpenHarmony is hosted on HUAWEI CLOUD SWR. Using the Docker image will help simplify environment configurations needed for the building. The following describes the detailed procedure.
Obtain the Docker image.
docker pull swr.cn-south-1.myhuaweicloud.com/openharmony-docker/openharmony-docker:1.0.0
Go to the root directory of OpenHarmony code and run the following command to access the Docker build environment:
Run the following command in Ubuntu:
docker run -it -v $(pwd):/home/openharmony swr.cn-south-1.myhuaweicloud.com/openharmony-docker/openharmony-docker:1.0.0
Run the following command in Windows (assuming that the source code directory is D:\OpenHarmony):
docker run -it -v D:\OpenHarmony:/home/openharmony swr.cn-south-1.myhuaweicloud.com/openharmony-docker/openharmony-docker:1.0.0
The following uses the Hi3516 platform as an example to describe the build procedure.
Set the build path to the current path.
hb set
NOTE
The mapping between the development board and the building GUI:
- Hi3861: wifiiot_hispark_pegasus@hisilicon
- Hi3516: ipcamera_hispark_taurus@hisilicon
- Hi3518: ipcamera_hispark_aries@hisilicon
Select ipcamera_hispark_taurus@hisilicon and press Enter.
Start building.
hb build -f
View the build result.
The files will be generated in the out/hispark_taurus/ipcamera_hispark_taurus directory.
Obtain the Docker image.
docker pull swr.cn-south-1.myhuaweicloud.com/openharmony-docker/openharmony-docker:1.0.0
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:1.0.0
Run the following script to start building for standard-system devices (reference memory ≥ 128 MB).
./build.sh --product-name {product_name} --ccache
product_name indicates the platform supported by the current distribution, for example, hispark_taurus_standard and rk3568.
Files generated during building are stored in the out/{device_name}/ directory, and the generated image is stored in the out/{device_name}/packages/phone/images/ directory.
NOTE
You can exit Docker by simply running the exit command.
docker_dist is a template component in the HPM system. It helps to quickly initialize an HPM project and use the Docker image to quickly build a distribution of OpenHarmony, greatly simplifying environment configurations needed for building. After configuring the Ubuntu and hpm-cli development environments, perform the following steps to access the Docker environment:
Initialize the installation template by running the following command in any of the working directories:
hpm init -t @ohos/docker_dist
Modify the publishAs field.
The obtained bundle is of the template type. Open the bundle.json file in the current directory and change the value of publishAs from template to distribution as needed.
Start building. Docker can be automatically installed only in Ubuntu. If you are using any other operating system, manually install Docker before pulling the image.
Automatically Installing Docker (Ubuntu)
Running the following command will automatically install Docker, pull the Docker image, and start the pulling and building of the corresponding solution in the container.
Method 1:
Add a parameter to specify the solution. For example:
hpm run docker solution={product}
{product} indicates the solution, for example, @ohos/hispark_taurus, @ohos/hispark_aries, and @ohos/hispark_pegasus.
Method 2:
Set an environment variable to specify the solution, and then run the build command.
Select the desired solution.
export solution={product}
{product} indicates the solution, for example, @ohos/hispark_taurus, @ohos/hispark_aries, and @ohos/hispark_pegasus.
Obtain and build the source code.
hpm run docker
This example uses the @ohos/hispark_taurus solution for illustration. If the execution is successful, the output is as follows:
...
ohos ipcamera_hispark_taurus build success!
@ohos/hispark_taurus: distribution building completed.
Manually Installing Docker (Non-Ubuntu)
Perform the following operations to install Docker:
# Pull the image.
docker pull swr.cn-south-1.myhuaweicloud.com/openharmony-docker/openharmony-docker:0.0.3# Compile the Docker image in the Linux environment.
hpm run distWithDocker solution={product}
# When using Windows, make sure to configure the Git Bash.
hpm config set shellPath "Git Bash path"
hpm run distWithDocker solution={product}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。