OpenHarmony is an open source project launched by the OpenAtom Foundation. The purpose of this project is to build an open, distributed operating system (OS) framework for smart IoT devices in the full-scenario, full-connectivity, and full-intelligence era.
The open source code repositories are available at https://openharmony.gitee.com.
This document describes how to acquire OpenHarmony source code and provides its directory structure. The OpenHarmony source code is open to you as HPM parts, which can be obtained in any of the following ways:
Method 1: Acquire the source code from the Gitee code repository. You can use the repo or git tool to download the latest code from the code repository.
Method 2: Acquire the source code from DevEco Marketplace. Visit DevEco Marketplace, search for your desired open source distribution, and download the component list (or customize components and download the component list). Then use the hpm-cli tool to download and install the components and compilation toolchain on your local PC.
Method 3: Download the compressed file of a distribution from a mirror site. This method provides a fast download speed, so you can also use this method for obtaining the source code of an earlier version.
Method 4: Acquire the source code from the GitHub image repository. You can use the repo or git tool to download the latest code from the code repository.
You want to establish a baseline based on stable OpenHarmony releases and distribute the baseline to your customers.
You have interconnected your software with OpenHarmony and need official certification from OpenHarmony.
You want to contribute code to the OpenHarmony community after obtaining official OpenHarmony certification for chips, modules, and applications.
You need to rectify OpenHarmony issues.
You want to learn OpenHarmony source code.
Register your account with Gitee.
Register an SSH public key for access to Gitee.
Install the Git client and git-lfs, and configure basic user information.
git config --global user.name "yourname"
git config --global user.email "your-email-address"
git config --global credential.helper store
Install the repo tool:
In this example, ~/bin is used as an example installation directory. You can change the directory as needed.
mkdir ~/bin
curl https://gitee.com/oschina/repo/raw/fork_flow/repo-py3 -o ~/bin/repo
chmod a+x ~/bin/repo
pip3 install -i https://repo.huaweicloud.com/repository/pypi/simple requests
Add the path of the repo tool to environment variables.
vim ~/.bashrc # Edit environment variables.
export PATH=~/bin:$PATH # Add the path of the **repo** tool to the end of environment variables.
source ~/.bashrc # Apply environment variables.
NOTE
Download the release code, which is more stable, if you want to develop commercial functionalities. Download the master code if you want to get quick access to the latest features for your development.
Obtaining OpenHarmony release code
For details about how to obtain the source code of an OpenHarmony release, see the Release Notes.
Obtaining OpenHarmony master code
Method 1 (recommended): Use the repo tool to download the source code over SSH. (You must have registered an SSH public key for access to Gitee.)
repo init -u git@gitee.com:openharmony/manifest.git -b master --no-repo-verify
repo sync -c
repo forall -c 'git lfs pull'
Method 2: Use the repo tool to download the source code over HTTPS.
repo init -u https://gitee.com/openharmony/manifest.git -b master --no-repo-verify
repo sync -c
repo forall -c 'git lfs pull'
If OpenHarmony is new to you, sample solutions are helpful to your development. You can obtain an open source distribution from DevEco Marketplace, or customize a distribution by adding or deleting components of an open source distribution. Then use the hpm-cli tool to download and install the components and compilation toolchain on your local PC.
You must install Node.js and HPM on your local PC. The installation procedure is as follows:
Install Node.js.
Download Node.js from its official website, and install it on your local PC.
The Node.js version must be 12.x (including npm 6.14.4) or later. An LTS version is recommended.
Install the hpm-cli tool using npm delivered with Node.js.
Open the CMD window, and run the following command:
npm install -g @ohos/hpm-cli
Run the following command to check whether the installation is successful. If the HPM version is displayed, the installation is successful.
hpm -V or hpm --version
Upgrade the HPM version as needed.
npm update -g @ohos/hpm-cli
Search for distributions.
Access DevEco Marketplace, and click Device. Then go to the Open Source Distribution page.
Enter a keyword, for example, camera, in the search box. All matched distributions are displayed.
Specify filter criteria, such as the OS, board, and kernel, to further filter the distributions.
Find your desired distribution, and click it to view details.
Figure 1 HPM page
Learn more about the distribution.
Click Download if you want to download the distribution to your local PC.
Click Device component tailoring if you want to add or delete components of the distribution.
Figure 2 Example distribution
Customize components.
Access the Device Component Tailoring page.
Add or delete components.
Enter the basic information about your project, including the name, version, and description, on the right pane.
Click Download. The system generates the OpenHarmony code structure file (for example, my_cust_dist.zip) and saves it to your local PC.
Figure 3 Customizing components
Install components.
To ensure the download performance, you are advised to download the source code or the corresponding solution from the image library of the respective site listed in the table below.
The table below provides only the sites for downloading the latest OpenHarmony LTS code. For details about how to obtain the source code of earlier versions, see the Release Notes.
Table 1 Sites for acquiring source code
LTS Code | Version | Site | SHA-256 Checksum | Software Package Size |
---|---|---|---|---|
Full code base (for mini, small, and standard systems) | 3.0 | Download | Download | 7.0 GB |
Standard system solution (binary) | 3.0 | Download | Download | 973.7 MB |
Hi3861 solution (binary) | 3.0 | Download | Download | 16.5 MB |
Hi3518 solution (binary) | 3.0 | Download | Download | 158.1 MB |
Hi3516 solution-LiteOS (binary) | 3.0 | Download | Download | 248.9 MB |
Hi3516 solution-Linux (binary) | 3.0 | Download | Download | 418.1 MB |
RELEASE-NOTES | 3.0 | Download | - | - |
Source Code of the Latest Release | Version | Site | SHA-256 Checksum | Software Package Size |
Full code base (for mini, small, and standard systems) | 4.1 Release | Download | Download | 31.6 GB |
Hi3861 solution (binary) | 4.1 Release | Download | Download | 29.2 MB |
Hi3516 solution-LiteOS (binary) | 4.1 Release | Download | Download | 318.7 MB |
Hi3516 solution-Linux (binary) | 4.1 Release | Download | Download | 215.8 MB |
RK3568 standard system solution (binary) | 4.1 Release | Download | Download | 8.4 GB |
RELEASE-NOTES | 4.1 Release | Download | - | - |
Compiler Toolchain | Version | Site | SHA-256 Checksum | Software Package Size |
Compiler toolchain | - | Download | - | - |
NOTE
The image repository is synchronized at 23:00 (UTC +8:00) every day.
Method 1 (recommended): Use the repo tool to download the source code over SSH. (You must have registered an SSH public key for access to GitHub. For details, see Adding a new SSH key to your GitHub account.)
repo init -u git@github.com:openharmony/manifest.git -b master --no-repo-verify
repo sync -c
repo forall -c 'git lfs pull'
Method 2: Use the repo tool to download the source code over HTTPS.
repo init -u https://github.com/openharmony/manifest.git -b master --no-repo-verify
repo sync -c
repo forall -c 'git lfs pull'
The following table describes the OpenHarmony source code directories.
Table 2 Source code directories
Directory | Description |
---|---|
applications | Application samples, for example, camera. |
base | Basic software service subsystem set and hardware service subsystem set. |
build | Component-based compilation, building, and configuration scripts. |
docs | Reference documents. |
domains | Enhanced software service subsystem set. |
drivers | Driver subsystem. |
foundation | Basic system capability subsystem set. |
kernel | Kernel subsystem. |
prebuilts | Compiler and tool chain subsystem. |
test | Test subsystem. |
third_party | Open source third-party software. |
utils | Commonly used development utilities. |
vendor | Vendor-provided software. |
build.py | Build script file. |
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。