608 Star 3.7K Fork 915

OpenHarmony / docs

Create your Gitee Account
Explore and code with more than 6 million developers,Free private repositories !:)
Sign up
Clone or download
source-code-acquisition.md 29.89 KB
Copy Edit Web IDE Raw Blame History

Source Code Acquisition

About OpenHarmony

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.

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, which can be obtained in any of the following ways:

  • Method 1: Download the compressed file of a distribution from an image site. To obtain the source code of an earlier version, you are also advised to use this method.
  • Method 2: Obtain the source code from the HarmonyOS Package Manager (HPM). Visit the HPM 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: Use the repo or git tool to download your desired code from the code repository.

Method 1: Acquiring Source Code from Image 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.

NOTE:

  • 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

LTS Code

Version Information

Site

SHA-256 Verification Code

Full code base

1.1.0

Download

Download

Hi3861 solution (binary)

1.1.0

Download

Download

Hi3518 solution (binary)

1.1.0

Download

Download

Hi3516 solution (binary)

1.1.0

Download

Download

RELEASE-NOTES

1.1.0

Download

-

Master Code

Version Information

Site

SHA-256 Verification Code

Full code base

2.0 Canary

Download (Site 1) Download (Site 2)

Download

Full code base

1.0 (no longer maintained)

Download

Download

Hi3861 solution (binary)

1.0 (no longer maintained)

Download

Download

Hi3518 solution (binary)

1.0 (no longer maintained)

Download

Download

Hi3516 solution (binary)

1.0 (no longer maintained)

Download

Download

RELEASE-NOTES

1.0 (no longer maintained)

Download

-

Compiler Toolchain

Version Information

Site

SHA-256 Verification Code

Compiler toolchain

-

Site

-

Method 2: Acquiring Source Code from the Bundle-specific 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 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:

  1. 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).

  2. 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
  3. 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
  4. Run the following command to upgrade the HPM version:

    npm update -g @ohos/hpm-cli

How to Use

  1. Search for distributions.

    1. Access the HPM 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.

      Figure 1 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.

    Figure 2 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.

    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.

      Figure 3 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.)

Method 3: Acquiring Source Code from a Code Repository

When to Use

  • 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.

Preparations

  1. Register your account with Gitee.

  2. Register an SSH public key for access to Gitee.

  3. 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
  4. 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

Operations

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)

  1. Create an OpenHarmony working directory.

    mkdir OpenHarmony
  2. Go to the OpenHarmony working directory.

    cd OpenHarmony
  3. Initialize the repository.

    repo init -u https://gitee.com/openharmony/manifest.git -b master --no-repo-verify
  4. Update the code.

    repo sync -c
  5. Update the binary files.

    repo forall -c 'git lfs pull'

Source Code Directories

The following table describes the OpenHarmony 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

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

1
https://gitee.com/openharmony/docs.git
git@gitee.com:openharmony/docs.git
openharmony
docs
docs
master

Search