1 Star 0 Fork 5.3K

OpenHarmony_EU incubator / docs

forked from OpenHarmony / docs 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
setting-up-a-development-environment-1.md 22.45 KB
一键复制 编辑 原始数据 按行查看 历史
NEEN 提交于 2020-09-25 09:48 . !134 Docs Update 0924

Setting Up a Development Environment

Environment Requirements

Hardware

  • Linux server

  • Windows workstation (host computer)

  • Hi3518EV300 IoT camera development board

  • USB cable and network cable (The Windows workstation is connected to Hi3518EV300 development board through the USB cable and network cable.)

    Figure 1 shows the hardware connections.

Figure 1 Hardware connections

Software

Table 1 Platforms required for the Hi3518EV300 development board

Hardware

Software

Description

Remarks

Linux compile server

Operating system

Ubuntu 16.04 64-bit or later is used for the Linux OS, and bash is used as the shell.

NOTE:

Common software such as samba and vim is installed in the OS by default. Adaptation is required to support Linux file sharing.

You can develop programs on the Windows workstation or on the Linux server through remote login.

Windows workstation

Operating system

Windows XP/Windows7/Windows10

Build Tools for Linux

The following table describes the common tools required for Linux and how to obtain them.

Table 2 Development tools and obtaining methods

Development Tool

Description

How to Obtain

Python3.7+

Runs the compilation scripts.

https://www.python.org/ftp/python/3.8.5/Python-3.8.5.tgz

bash

Executes commands.

Internet

gn

Generates ninja compilation scripts.

https://repo.huaweicloud.com/harmonyos/compiler/gn/1523/linux/gn.1523.tar

ninja

Executes ninja compilation scripts.

https://repo.huaweicloud.com/harmonyos/compiler/ninja/1.9.0/linux/ninja.1.9.0.tar

LLVM

Functions as the compiler toolchain.

https://repo.huaweicloud.com/harmonyos/compiler/clang/9.0.0-34042/linux/llvm-linux-9.0.0-34042.tar

hc-gen

Configures and compiles files.

https://repo.huaweicloud.com/harmonyos/compiler/hc-gen/0.65/linux/hc-gen-0.65-linux.tar

IPOP, PuTTY, or other HyperTerminal software

Connects to the Linux server (choose one of the terminals).

Internet (for example, https://www.putty.org/)

Development Tools for Windows

Table 3 Development tools for the Windows workstation

Development Tool

Description

How to Obtain

Visual Studio Code

Edits code.

https://code.visualstudio.com/

HiTool

Burns the images and the U-boot.

http://www.hihope.org/download/AllDocuments

Tool package: Hi3516-Hitool.zip

Installing the Basic Compilation Environment

Connecting to a Linux Server

Using PuTTY to log in to a Linux server from a PC running Windows

  1. Open PuTTY, enter the IP address of the Linux server, and click Open.

    Figure 2 PuTTY configuration

  2. Click Yes in the PuTTY Security Alert dialog box.

  3. Enter the account and password.

    Figure 3 Login

  4. The login is successful.

    Figure 4 Successful login

Changing Linux Shell to Bash

Run the following command to check whether bash is used as the shell:

ls -l /bin/sh

If /bin/sh -> bash is not displayed, do as follows to change shell to bash.

Method 1: Run the following command on the device and then click No.

sudo dpkg-reconfigure dash

Method 2: Run the rm -rf /bin/sh command to delete sh and then run the sudo ln -s /bin/bash /bin/sh command to create a new soft link.

sudo rm -rf /bin/sh
sudo ln -s /bin/bash /bin/sh

Installing a Python Environment

  1. Start a Linux server.

  2. Run the following command to check the Python version (Python 3.7 or later is required):

    python3 --version

    Do as follows to install Python, for example, Python 3.8.

    1. Run the following command to check the Ubuntu version:
    cat /etc/issue
    1. Install Python based on the Ubuntu version.
      • If the Ubuntu version is 18 or later, run the following command:

        sudo apt-get install python3.8
      • If the Ubuntu version is 16, download the installation package and install Python.

        1. Run the following command to install Python environment dependencies (gcc, g++, make, zlib, libffi):
        sudo apt-get install gcc && sudo apt-get install g++ && sudo apt-get install make && sudo apt-get install zlib* && sudo apt-get install libffi-dev
        1. Obtain the Python3.8.5 installation package, save it to the Linux server, and run the following command:
        tar -xvzf Python-3.8.5.tgz && cd Python-3.8.5 && sudo ./configure && sudo make && sudo make install
  3. After Python is installed, run the following command to link the Python path to /usr/bin/python:

    which python3.8
    cd /usr/bin && sudo rm python && sudo ln -s /usr/local/bin/python3.8 python && python --version
  4. Install and upgrade the Python package management tool (pip3) using either of the following methods:

    • Command line:

      sudo apt-get install python3-setuptools python3-pip -y
      sudo pip3 install --upgrade pip
    • Installation package:

      curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
      python get-pip.py
  5. Run the following command to install setuptools:

    pip3 install setuptools
  6. Install the GUI menuconfig tool (Kconfiglib). You are advised to install Kconfiglib 13.2.0 or later.

    • Command line:

      sudo pip3 install kconfiglib
    • Installation package:

      1. Download the .whl file (for example, kconfiglib-13.2.0-py2.py3-none-any.whl).

        Download path: https://pypi.org/project/kconfiglib#files

      2. Run the following command to install the .whl file:

        sudo pip3 install kconfiglib-13.2.0-py2.py3-none-any.whl

Installing a File Packing Tool

  1. Start a Linux server.

  2. Run the following command to install dosfstools.

    sudo apt-get install dosfstools
  3. Run the following command to install mtools.

    sudo apt-get install mtools

Installing Compilation Tools

NOTICE:

  • If you obtain the source code using an HPM component or HPM CLI tool, compilation tools like gn, ninja, LLVM, and hc-gen are not required.
  • (Recommended) If you obtain the source code through an image site or a code repository, compilation tools like gn, ninja, LLVM, and hc-gen need to be installed. When installing gn, ninja, LLVM, and hc-gen, ensure that the environment variable paths of the compilation tools are unique.

Installing gn

  1. Start a Linux server.

  2. Download gn.

  3. Run the following command to decompress the gn installation package to ~/gn.

    tar -xvf gn.1523.tar -C ~/
  4. Set an environment variable by performing the following steps. Open the ~/.bashrc file in Vim first.

    vim ~/.bashrc

    Copy the following command to the last line of the .bashrc file, save the file, and exit.

    export PATH=~/gn:$PATH
  5. Run the following command to validate the environment variable.

    source ~/.bashrc

Installing ninjah

  1. Start a Linux server.

  2. Download ninja.

  3. Run the following command to decompress the ninja installation package to ~/ninja.

    tar -xvf ninja.1.9.0.tar -C ~/
  4. Set an environment variable by performing the following steps. Open the ~/.bashrc file in Vim first.

    vim ~/.bashrc

    Copy the following command to the last line of the .bashrc file, save the file, and exit.

    export PATH=~/ninja:$PATH
  5. Run the following command to validate the environment variable.

    source ~/.bashrc

Installing the LLVM Toolchain

  1. Start a Linux server.

  2. Download LLVM.

  3. Run the following command to decompress the LLVM installation package to ~/llvm.

    tar -xvf llvm-linux-9.0.0-34042.tar -C ~/
  4. Set an environment variable by performing the following steps. Open the ~/.bashrc file in Vim first.

    vim ~/.bashrc

    Copy the following command to the last line of the .bashrc file, save the file, and exit.

    export PATH=~/llvm/bin:$PATH
  5. Run the following command to validate the environment variable.

    source ~/.bashrc

Installing hc-gen

  1. Start a Linux server.

  2. Download hc-gen.

  3. Run the following command to decompress the hc-gen installation package to ~/hc-gen on the Linux server.

    tar -xvf hc-gen-0.65-linux.tar -C ~/
  4. Set an environment variable by performing the following steps. Open the ~/.bashrc file in Vim first.

    vim ~/.bashrc

    Copy the following command to the last line of the .bashrc file, save the file, and exit.

    export PATH=~/hc-gen:$PATH
  5. Run the following command to validate the environment variable.

    source ~/.bashrc
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/open-harmony-eu-incubator/docs.git
git@gitee.com:open-harmony-eu-incubator/docs.git
open-harmony-eu-incubator
docs
docs
master

搜索帮助

344bd9b3 5694891 D2dac590 5694891