From f5dedc47ab6a8cc2f90fa2cddd4d92e753aff84b Mon Sep 17 00:00:00 2001 From: "Hehaiqiang (Shawn" Date: Thu, 23 Sep 2021 20:10:32 +0800 Subject: [PATCH] update docs Signed-off-by: Hehaiqiang (Shawn --- en/device-dev/get-code/sourcecode-acquire.md | 206 ++++++++++++++----- 1 file changed, 149 insertions(+), 57 deletions(-) diff --git a/en/device-dev/get-code/sourcecode-acquire.md b/en/device-dev/get-code/sourcecode-acquire.md index 4ae58168db2..9578685d75a 100644 --- a/en/device-dev/get-code/sourcecode-acquire.md +++ b/en/device-dev/get-code/sourcecode-acquire.md @@ -13,21 +13,23 @@ - [How to Use](#section954619433333) - [Method 3: Acquiring Source Code from Image Sites](#section1186691118430) +- [Method 4: Acquiring Source Code from the GitHub Image Repository](#section23448418360) - [Source Code Directories](#section1072115612811) ## About OpenHarmony 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](https://openharmony.gitee.com). +The open-source code repositories are available at [https://openharmony.gitee.com](https://openharmony.gitee.com). ## Overview of Source Code Acquisition -This document describes how to acquire OpenHarmony source code and provides its directory structure. The OpenHarmony code is open to you as [bundles](../bundles/bundles-standard-rules.md), which can be obtained in any of the following ways: +This document describes how to acquire OpenHarmony source code and provides its directory structure. The OpenHarmony code is open to you as [bundles](../bundles/bundles-standard-rules.md), which can be obtained in any of the following ways: -- **Method 1**: Acquire the source code from a code repository. You can use the **repo** or **git** tool to download the latest code from the code repository. -- **Method 2**: Obtain the source code from the HarmonyOS Package Manager \(HPM\). Visit the [HPM](https://hpm.harmonyos.com/#/en/home) website, search for your desired open-source distribution, and download the bundle list \(or customize bundles and download the bundle list\). Then use **hpm-cli** to download and install the bundles and compilation toolchain on your local PC. -- **Method 3**: Download the compressed file of a distribution from an image 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 1**: Acquire the source code from a 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 the HarmonyOS Package Manager \(HPM\). Visit the [HPM](https://hpm.harmonyos.com/#/en/home) website, search for your desired open-source distribution, and download the bundle list \(or customize bundles and download the bundle list\). Then use **hpm-cli** to download and install the bundles 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. ## Method 1: Acquiring Source Code from a Code Repository @@ -48,7 +50,7 @@ This document describes how to acquire OpenHarmony source code and provides its 1. Register your account with Gitee. 2. Register an SSH public key for access to Gitee. -3. Install the [git client](http://git-scm.com/book/en/v2) and [git-lfs](https://gitee.com/vcs-all-in-one/git-lfs?_from=gitee_search#downloading), and configure basic user information. +3. Install the [git client](http://git-scm.com/book/en/v2) and [git-lfs](https://gitee.com/vcs-all-in-one/git-lfs?_from=gitee_search#downloading), and configure basic user information. ``` git config --global user.name "yourname" @@ -56,10 +58,10 @@ This document describes how to acquire OpenHarmony source code and provides its git config --global credential.helper store ``` -4. Run the following commands to install the **repo** tool: +4. Run the following commands to install the **repo** tool: ``` - curl -s 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. + curl -s 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 ``` @@ -74,7 +76,7 @@ This document describes how to acquire OpenHarmony source code and provides its - **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.\) + 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 @@ -82,7 +84,7 @@ This document describes how to acquire OpenHarmony source code and provides its repo forall -c 'git lfs pull' ``` - Method 2 \(recommended\): Use the **repo** tool to download the source code over HTTPS. + 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 @@ -91,12 +93,12 @@ This document describes how to acquire OpenHarmony source code and provides its ``` -- **Obtaining Latest OpenHarmony\_1.0.1\_release code** +- **Obtaining latest OpenHarmony\_1.0.1\_release code** >![](../public_sys-resources/icon-note.gif) **NOTE:** >Currently, only the source code for mini and small systems can be obtained through this release. - Use the **repo** tool to download the 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 @@ -104,28 +106,25 @@ This document describes how to acquire OpenHarmony source code and provides its 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 OpenHarmony releases, see the [Release-Notes](../../release-notes/Readme.md). - +- For details about how to obtain the source code of other OpenHarmony releases, see the [Release-Notes](../../release-notes/Readme.md). ## Method 2: Acquiring Source Code from HPM ### When to Use -If OpenHarmony is new to you, sample solutions are helpful to your development. You can obtain an open-source distribution from the [HPM](https://hpm.harmonyos.com/#/en/home) 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. +If OpenHarmony is new to you, sample solutions are helpful to your development. You can obtain an open-source distribution from the [HPM](https://hpm.harmonyos.com/#/en/home) 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. ### Prerequisites -You must install **Node.js** and HPM on your local PC. The installation procedure is as follows: +You must install **Node.js** and HPM on your local PC. The installation procedure is as follows: -1. Install **Node.js**. +1. Install **Node.js**. - Download **Node.js** from its official website and install it on your local PC. + Download **Node.js** from its official website and install it on your local PC. - You are advised to install [Node.js](https://nodejs.org/) 12.x \(including npm 6.14.4\) or a later version \(12.13.0 or later is recommended\). + You are advised to install [Node.js](https://nodejs.org/) 12.x \(including npm 6.14.4\) or a later version \(12.13.0 or later is recommended\). -2. Install the hpm-cli tool using **npm** delivered with **Node.js**. +2. Install the hpm-cli tool using **npm** delivered with **Node.js**. Open the CMD window and run the following command: @@ -149,56 +148,56 @@ You must install **Node.js** and HPM on your local PC. The installation proced ### How to Use 1. Search for distributions. - 1. Access the [HPM](https://hpm.harmonyos.com/#/en/home) page, and click the **Distribution** tab, as shown in the following figure. - 2. Enter a keyword \(for example: **camera**\) in the search box. All matched distributions are found. - 3. Specify filter criteria, such as the bundle type \(for example: **Board support** and **Kernel support**\), to further filter the distributions. - 4. Locate your desired distribution and click it to view details. + 1. Access the [HPM](https://hpm.harmonyos.com/#/en/home) page, and click the **Distribution** tab, as shown in the following figure. + 2. Enter a keyword \(for example: **camera**\) in the search box. All matched distributions are found. + 3. Specify filter criteria, such as the bundle type \(for example: **Board support** and **Kernel support**\), to further filter the distributions. + 4. Find your desired distribution and click it to view details. - **Figure 1** HPM page + **Figure 1** HPM page ![](figure/hpm-page.png "hpm-page") 2. Learn more about the distribution. 1. Read carefully the information about the distribution to learn its application scenarios, features, bundles, usage, and customization methods, as shown in the following figure. - 2. Click **Download** to download the distribution to your local PC. - 3. Click **Custom** to add or delete bundles of the distribution. + 2. Click **Download** to download the distribution to your local PC. + 3. Click **Custom** to add or delete bundles of the distribution. - **Figure 2** Example distribution + **Figure 2** Example distribution ![](figure/example-distribution.png "example-distribution") 3. Customize bundles. - 1. Access the **Custom solution** page, as shown in the following figure. - 2. Set the toggle switch next to a specific optional bundle to delete it from the distribution, or click **Add bundle** to add new bundles. + 1. Access the **Custom solution** page, as shown in the following figure. + 2. Set the toggle switch next to a specific optional bundle to delete it from the distribution, or click **Add bundle** to add new bundles. 3. Enter the basic information about your project, including the bundle name, version, and description, on the right pane. - 4. Click **Download**. The system then generates the OpenHarmony code structure file \(for example, **my\_cust\_dist.zip**\) and saves it to your local PC. + 4. Click **Download**. The system then generates the OpenHarmony code structure file \(for example, **my\_cust\_dist.zip**\) and saves it to your local PC. - **Figure 3** Customizing bundles + **Figure 3** Customizing bundles ![](figure/customizing-bundles.png "customizing-bundles") 4. Download and install bundles. 1. Decompress the downloaded file using the CLI tool CMD \(shell in Linux\). - 2. In the generated directory, run the **hpm install** command. - 3. The downloaded bundles are stored in the **ohos\_bundles** folder under the project directory. \(The source code of some bundles will be copied to a specified directory after the bundles are installed.\) + 2. In the generated directory, run the **hpm install** command. + 3. The downloaded bundles are stored in the **ohos\_bundles** folder under the project directory. \(The source code of some bundles will be copied to a specified directory after the bundles are installed.\) -## Method 3: Acquiring Source Code from Image Sites +## Method 3: Acquiring Source Code from Mirror Sites 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. ->![](../public_sys-resources/icon-note.gif) **NOTE:** ->- The table below provides only the sites for downloading the latest OpenHarmony master and LTS code. For details about how to obtain the source code of earlier versions, see the [Release-Notes](../../release-notes/Readme.md). +>![](../public_sys-resources/icon-note.gif) **NOTE:** +>- The table below provides only the sites for downloading the latest OpenHarmony master and LTS code. For details about how to obtain the source code of earlier versions, see the [Release-Notes](../../release-notes/Readme.md). >- The Master 1.0 version is no longer maintained. -**Table 1** Sites for acquiring source code from image sites +**Table 1** Sites for acquiring source code -

LTS Code

+ - - - - @@ -246,13 +245,13 @@ To ensure the download performance, you are advised to download the source code - - - - - @@ -309,13 +308,13 @@ To ensure the download performance, you are advised to download the source code - - - -

LTS Code

Version Information

+

Version Information

Site

+

Site

SHA-256 Verification Code

+

SHA-256 Verification Code

Full code (for mini and small systems)

@@ -237,7 +236,7 @@ To ensure the download performance, you are advised to download the source code

Download

RELEASE-NOTES

+

Release notes

1.1.2

-

Master Code

+

Master Code

Version Information

+

Version Information

Site

+

Site

SHA-256 Verification Code

+

SHA-256 Verification Code

Full code (for standard systems)

@@ -300,7 +299,7 @@ To ensure the download performance, you are advised to download the source code

Download

RELEASE-NOTES

+

Release notes

1.0 (no longer maintained)

-

Compiler Toolchain

+

Compiler Toolchain

Version Information

+

Version Information

Site

+

Site

SHA-256 Verification Code

+

SHA-256 Verification Code

Compiler toolchain

@@ -330,89 +329,182 @@ To ensure the download performance, you are advised to download the source code
+ +## Method 4: Acquiring Source Code from the GitHub Image Repository (at 23:00 UTC 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 Gitee.\) + + 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' + ## Source Code Directories The following table describes the OpenHarmony source code directories. -**Table 2** Source code directories +**Table 2** Source code directories + + + + + + + + + + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + -

Name

+

Description

+

applications

+

Application samples, for example, camera

+

base

+

Basic software service subsystem set and hardware service subsystem set

+

build

+

Bundle-based compilation, building, and configuration scripts

+ +

Bundle-based compilation, build, 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

+

Testing subsystem

+

third_party

+

Open-source third-party software

+

utils

+

Commonly used development tools

+

vendor

+

Vendor-provided software

+

build.py

+

Compilation script file

+
+
-- Gitee