OpenHarmony is an open-source project launched by the OpenAtom Foundation. The purpose of this project is to build an open-source, 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.
NOTE: At present, OpenHarmony source code can only be compiled in the Linux environment.
This document describes how to acquire OpenHarmony source code and provides its directory structure. The OpenHarmony code is open to you as bundles, which can be obtained in any of the following ways:
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 source code of the latest OpenHarmony Master and LTS versions. For details about earlier versions and how to obtain their source code, see the Release Notes.
- The Master 1.0 version is no longer maintained.
Table 1 Sites for acquiring source code from image sites
If OpenHarmony is new to you, sample solutions are helpful to your development. You can obtain an open-source distribution from the HPM website, or customize a distribution by adding or deleting bundles of an open-source distribution. Then use hpm-cli to download and install the bundles and compilation toolchain on your local PC.
You must install Node.js and HPM on your local PC. The installation procedure is as follows:
Download Node.js from its official website and install it on your local PC.
You are advised to install Node.js 12.x (including npm 6.14.4) or a later version (12.13.0 or later 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
Run the following command to upgrade the HPM version:
npm update -g @ohos/hpm-cli
Search for distributions.
Access the HPM page, and click the Distribution tab, as shown in the following figure.
Enter a keyword (for example: camera) in the search box. All matched distributions are found.
Specify filter criteria, such as the bundle type (for example: Board support and Kernel support), to further filter the distributions.
Locate your desired distribution and click it to view details.
Learn more about the distribution.
Access the Custom solution page, as shown in the following figure.
Set the toggle switch next to a specific optional bundle to delete it from the distribution, or click Add bundle to add new bundles.
Enter the basic information about your project, including the bundle name, version, and description, on the right pane.
Click Download. The system then generates the OpenHarmony code structure file (for example, my_cust_dist.zip) and saves it to your local PC.
Download and install bundles.
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 chips, modules, and applications are certified by OpenHarmony.
You need to address OpenHarmony issues.
You want to learn OpenHarmony source code.
Register your account with Gitee.
Register an SSH public key for access to Gitee.
git config --global user.name "yourname" git config --global user.email "your-email-address" git config --global credential.helper store
Run the following commands to install the repo tool:
curl https://gitee.com/oschina/repo/raw/fork_flow/repo-py3 > /usr/local/bin/repo # If you do not have the access permission to this directory, download the tool to any other accessible directory and configure the directory to the environment variable. chmod a+x /usr/local/bin/repo pip3 install -i https://repo.huaweicloud.com/repository/pypi/simple requests
Obtaining the Source Code for Mini and Small Systems
NOTE: You can obtain the latest features from the master code, and develop commercial functionalities based on the release code, which is more stable.
Obtaining OpenHarmony master code
Method 1 (recommended): Use the repo tool to download the master code.
repo init -u https://gitee.com/openharmony/manifest.git -b master --no-repo-verify repo sync -c repo forall -c 'git lfs pull'
Method 2: Run the git clone command to clone a single code repository.
Go to the code repository homepage, select the code repository to be cloned, and run the following command:
git clone https://gitee.com/openharmony/manifest.git -b master
Obtaining OpenHarmony_1.0.1_release code
Use the repo tool to download the release code.
repo init -u https://gitee.com/openharmony/manifest.git -b OpenHarmony_1.0.1_release --no-repo-verify repo sync -c repo forall -c 'git lfs pull'
Obtaining the source code of other OpenHarmony releases
For details about how to obtain the source code of other releases, see the Release Notes.
Obtaining the Source Code for Standard Systems (2.0 Canary)
Create an OpenHarmony working directory.
Go to the OpenHarmony working directory.
Initialize the repository.
repo init -u https://gitee.com/openharmony/manifest.git -b master --no-repo-verify
Update the code.
repo sync -c
Update the binary files.
repo forall -c 'git lfs pull'
The following table describes the OpenHarmony source code directories.
Table 2 Source code directories
：Code submit frequency
：React/respond to issue & PR etc.
：Well-balanced team members and collaboration
：Recent popularity of project
：Star counts, download counts etc.