同步操作将从 OpenHarmony/docs 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
OpenHarmony is an open-source version of HarmonyOS. It is donated by Huawei to OpenAtom Foundation. The first open-source version can run on 128 KB to 128 MB devices. You are welcomed to join the open-source community for continuous improvement.
Access code repositories at https://openharmony.gitee.com.
NOTE: Currently, OpenHarmony source code can be compiled only in a Linux environment. You may encounter exceptions in a Windows environment. For example, while downloading and installing some bundles, you need to run Linux commands to set environment variables. However, if you do so in a Windows environment, an error may occur. To address this issue, change the shell of HPM to a third-party shell. For example, you can run the following command to change the shell to sh.exe of git: hpm config set shellPath 'C:\Program Files\Git\bin\sh.exe'
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.
NOTE:
- The table below provides only the sites for downloading the source code of the latest OpenHarmony Master and LTS versions. For details about how to obtain the source code of other versions, see the Release Notes.
- Currently, Master 1.0 is no longer maintained. You are advised to use the LTS version.
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 platform, 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:
Install Node.js.
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 ("camera" as an example) in the search box. All matched distributions are found.
Specify filter criteria, such as the bundle type (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.
Customize bundles.
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 ecosystem 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 details, visit https://gitee.com/help/articles/4181.
Install the git client and configure basic information.
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
chmod a+x /usr/local/bin/repo
pip install -i https://pypi.tuna.tsinghua.edu.cn/simple requests
NOTE: You can obtain the latest features from the master code, and develop commercial functionalities based on the release code.
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
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
Obtaining the source code of other OpenHarmony releases
For details about how to obtain the source code of other releases, see the Release Notes.
The following table describes the OpenHarmony source code directories.
Table 2 Directory description
Basic software service subsystem set and hardware service subsystem set |
|
Bundle-based compilation, building, and configuration scripts |
|
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。