Hongmeng Hi3861 learning eighteen-DevEco Device Tool environment construction

1. Introduction

        In the previous article, we developed by burning under windows and compiling under ubuntu . Today we also use the windows+ubuntu mixed environment for development . Why do you want to use this method? Because for now, most development boards do not support compiling in the Windows environment , such as Hi3861 and Hi3516 series development boards.

        The task this time is to use the DevEco Device Tool visual interface of the windows platform to perform related operations, connect to the DevEco Device Tool under ubuntu through a remote connection (Visual Studio Code may not be installed), and then develop, compile, and compile the source code under ubuntu. burning etc.

        ubuntu version: 20.04

        windows version: win10

2. Build the ubuntu environment

      1. Change the ubuntu shell environment to bash

        1). Use the following command to check the shell type . If it is not bash , you need to modify it. If it is bash , skip the current step directly .

ls -l /bin/sh

         Here is a brief explanation of why you want to change from dash to bash.

        bash (GNU Bourne-Again Shell) is the default shell of many Linux platforms, but because bash is too complicated , someone ported bash from NetBSD to Linux and renamed it dash (Debian Almquist shell), and suggested /bin/sh point to it, for faster script execution . dash is much smaller than bash and is POSIX compliant. It appears primarily for script execution , not interaction. However, the functions are much less than that of bash , so some scripts cannot be run with dash , and the type of shell needs to be modified.

        2). Enter the following command in the terminal, and then select No to change the ubuntu shell to bash .

sudo dpkg-reconfigure dash

 

         Then use ls -l /bin/sh to view the shell version, which has been modified to bash

      2. Install DevEco Device Tool Linux version

        Click Huawei Integrated Development Environment IDE DevEco Device Tool Download | HarmonyOS Device Development to enter the download page, and select the Linux version to download. Here we take the 3.1 Release version as an example.

        After the download is complete, decompress the zip package .

unzip devicetool-linux-tool-3.1.0.500.zip 

         After the decompression is complete, give executable permission to the installation file .

 chmod u+x devicetool-linux-tool-3.1.0.500.sh

         Execute the installation command

sudo ./devicetool-linux-tool-3.1.0.500.sh 

Choose to agree to          the Privacy Agreement and User Agreement . Select by keyboard and press Enter directly to select.

         After the installation is successful, the display is as follows.

         Note: The installation here requires python version 3.8 or above .

3. Build a Windows environment

         1. Install the Windows version of DevEco Device Tool

        Download the windows version and unzip it

         Double-click the .exe to install it. Note: If an old version has been installed before, the old version will be automatically uninstalled during installation .

        Because the installation requires python version 3.8~3.9 , if the version is not enough, it will prompt to install, just click to install .

 

         After Python is installed successfully, continue to install DevEco.

 

        2. Open VSCode, you can see DevEco in the left toolbar .

 

 Fourth, configure Windows to remotely access the Ubuntu environment

1. Install SSH service         under ubuntu

        In ubuntu, open the terminal and enter the following command to install the SSH service.

sudo apt-get install openssh-server

         Note: If it is prompted that openssh-servert and openssh-client depend on different versions, please install the corresponding version of openssh-client according to the prompt information on the CLI interface (for example: sudo apt-get install openssh-client=1:8.2p1-4), and then restart Execute this command to install openssh-server.

        Start the SSH service

sudo systemctl start ssh

        View current SSH status

sudo service ssh status

         Obtain the IP address under ubuntu

ifconfig

         Note: If command-not-found is prompted , use the following command to install

sudo apt-get install net-tools

        2. Install Remote SSH under Windows

        Open VSCode, search for " remote-ssh " in " Extensions " , and install

         After the installation is successful, it can be found in the " Installed " list.

Select " Remote "          in " Remote Explorer ", and click " + " in SSH

         In the pop-up SSH connection command input window, enter " ssh username@ip_address ", where ip_address is the IP address of the remote computer to be connected , and username is the account for logging in to the remote computer .

         In the pop-up input box, select the SSH configuration file and select the default first option .

Select " connect "          in the prompt box that pops up . After clicking, a new VSCode window will open .

         Select the host to connect to, choose linux

         Enter login password

         Look at the " Remote Resource Manager " at this time, and the added remote server has appeared.

         If you want to open the added server later, just click here to connect.

         At this point, you can perform source code development, compilation, and burning operations through the DevEco Device Tool interface under Windows .

 5. Register the public key to access the Ubuntu environment

        After completing the above operations, you can remotely connect to the Ubuntu environment through Windows for development, but every time you open VSCode, you always need to re-enter the password , which is troublesome. It can be solved by environment public key setting .

        1. Generate an SSH public key in the Windows environment.

Open the Git bash command line window         under Windows , and enter the following command to generate an SSH public key .

ssh-keygen -t rsa
ssh-copy-id -i ~/.ssh/id_rsa.pub username@ip

        Note: username is the login account of the remote ubuntu, and ip is the IP address of the remote ubuntu .

        After executing the command ssh-keygen, there will be several places that need to be confirmed. Here, the default is to press Enter .

         After executing ssh-copy-id, enter the login password .

      2. Configure SSK Key

Open VSCode, and set the connection config file         in "Remote Explorer" .

 

Add SSK Key file information          in the config file

         This file path is printed when ssh-keygen is installed .

         At this time, open the remote connection again and find that there is no need to enter the password .

Guess you like

Origin blog.csdn.net/qq_26226375/article/details/130821414