同步操作将从 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:
You can download the source code or the corresponding solutions from the image library at the sites listed below.
Table 1 Acquiring source code from image sites
If OpenHarmony is new to you, sample solutions are helpful to your development. The HPM platform provides a recommended solution. You can add or exclude bundles to quickly customize your system.
Search for a proper solution.
Access the HPM page, and click the Solution tab, as shown in the following figure.
Enter a keyword ("camera" as an example) in the search box. All matched solutions are found.
Specify filter criteria, such as the bundle type (example: Board support and Kernel support), to further filter the solutions.
Click the solution you need to view its details.
Customize the solution.
Customize bundles.
The downloaded compressed package does not contain the original file of source code. You can import the package to the IDE, decompress it, and run the hpm install command to download all required bundles.
The downloaded bundles are stored in the ohos_bundles folder in the project directory.
You need to install the Node.js and hpm-cli tool 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
Add the bundle (@ohos/demo as an example) to your project as follows:
Go to the development directory and run the following command to create a development project using the default template:
hpm init -t default
Run the following command to install the bundle (@ohos/demo as an example):
hpm install @ohos/demo
Verify that the hpm-cli tool automatically downloads all dependent bundles from the server. If the download is successful, the message "Install successfully!" is displayed.
$ hpm install @ohos/demo
Requesting: https://url.foo.bar/hpm/registry/api/bundles/@ohos/demo
downloading @ohos/demo
Requesting: https://lfcontentcenterdev....../bMAlLrYISLqdUTFFFCdgzA.tgz
extract D:\demo\ohos_bundles\@ohos\demo\@ohos-demo-1.0.7.tgz
Install successfully!
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.
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
Method 1 (recommended): Use the repo tool to download 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 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
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 |
|
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。