• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Setting Up the Ubuntu Environment
2
3In embedded development, Windows-based tools, such as Visual Studio Code, are widely used in code editing. Yet, because the source code of most development boards, such as Hi3861 and Hi3516, cannot be built in Windows, these development boards require the Ubuntu build environment.
4
5In the Windows+Ubuntu hybrid build environment, you can enjoy the benefits of both DevEco Device Tool for Windows and DevEco Device Tool for Ubuntu (where Visual Studio Code is optional).
6
7The following describes how to set up the Ubuntu environment.
8
9> ![icon-note.gif](public_sys-resources/icon-note.gif) **NOTE**
10>
11> If the Ubuntu system has not been set up yet, set it up on a virtual machine running Windows. For details, see [Ubuntu Installation Guide](https://developer.huawei.com/consumer/cn/training/course/video/C101639987816176315). Then, [configure the Ubuntu basic environment](https://developer.huawei.com/consumer/cn/training/course/video/C101639988048536240).
12
13
14## System Requirements
15
16- Ubuntu: Ubuntu 18.04 to 21.10; version 20.04 with 16 GB or larger memory and a 100 GB or larger hard disk is recommended
17
18- User name (Ubuntu): cannot contain Chinese characters
19
20- DevEco Device Tool: latest and same version installed on both Ubuntu and Windows
21
22
23## Procedure
24
251. Make sure the Ubuntu shell environment is **bash**.
26   1. Run the following command and check whether the command output is **bash**. If the command output is not **bash**, go to step 2.
27
28       ```shell
29       ls -l /bin/sh
30       ```
31
32       ![en-us_image_0000001226764302](figures/en-us_image_0000001226764302.png)
33
34   2. Start the command-line tool, run the following command, enter your password, and select **No** to set **Ubuntu shell** to **bash**.
35
36       ```shell
37       sudo dpkg-reconfigure dash
38       ```
39
40       ![ubuntu-dash-to-bash](figures/ubuntu-dash-to-bash.png)
41
422. Download the latest version of [DevEco Device Tool](https://device.harmonyos.com/cn/ide#download) for Linux.
43
443. Decompress the DevEco Device Tool software package and assign permission on the folder obtained from the decompression.
45   1. Go to the directory where the DevEco Device Tool software package is stored and run the following command to decompress the software package. In the command, **devicetool-linux-tool-{Version}.zip** indicates the software package name.
46
47       ```shell
48       unzip devicetool-linux-tool-{Version}.zip
49       ```
50   2. Open the folder of the decompressed software package and run the following command to grant the execute permission on the installation file. In the command, **devicetool-linux-tool-{Version}.sh** indicates the installation file name.
51
52       ```shell
53       chmod u+x devicetool-linux-tool-{Version}.sh
54       ```
55
564. Run the following command to install DevEco Device Tool, where **devicetool-linux-tool-{Version}.sh** indicates the installation file name.
57
58   ```shell
59   sudo ./devicetool-linux-tool-{Version}.sh
60   ```
61
625. On the page for agreeing to the user agreement and privacy statement, read and agree to the user agreement and privacy statement. You can scroll through the options by pressing the up and down arrow keys on the keyboard.
63
64   ![en-us_image_0000001340557741](figures/en-us_image_0000001340557741.png)
65
66   Wait until the "DevEco Device Tool successfully installed." message is displayed.
67
68   ![en-us_image_0000001338201457](figures/en-us_image_0000001338201457.png)
69
70
716. Run the following **apt-get** command:
72
73   ```shell
74   sudo apt-get update && sudo apt-get install binutils binutils-dev git git-lfs gnupg flex bison gperf build-essential zip curl zlib1g-dev gcc-multilib g++-multilib gcc-arm-linux-gnueabi libc6-dev-i386 libc6-dev-amd64 lib32ncurses5-dev x11proto-core-dev libx11-dev lib32z1-dev ccache libgl1-mesa-dev libxml2-utils xsltproc unzip m4 bc gnutls-bin python3.8 python3-pip ruby genext2fs device-tree-compiler make libffi-dev e2fsprogs pkg-config perl openssl libssl-dev libelf-dev libdwarf-dev u-boot-tools mtd-utils cpio doxygen liblz4-tool openjdk-8-jre gcc g++ texinfo dosfstools mtools default-jre default-jdk libncurses5 apt-utils wget scons python3.8-distutils tar rsync git-core libxml2-dev lib32z-dev grsync xxd libglib2.0-dev libpixman-1-dev kmod jfsutils reiserfsprogs xfsprogs squashfs-tools pcmciautils quota ppp libtinfo-dev libtinfo5 libncurses5-dev libncursesw5 libstdc++6 gcc-arm-none-eabi vim ssh locales libxinerama-dev libxcursor-dev libxrandr-dev libxi-dev
75   ```
76
77   > ![icon-note.gif](public_sys-resources/icon-note.gif) **NOTE**
78   >
79   > The preceding command is applicable to Ubuntu 18.04. For other Ubuntu versions, modify the preceding installation command based on the installation package name.
80   >
81   > - Python 3.8 or a later version is required. In this example, Python 3.8 is used.
82   >
83   > - Java 8 or later is required. In this example, Java 8 is used.
84