setting-up-the-environment-3.md 6.5 KB
Newer Older
M
mamingshuai 已提交
1
# Setting Up the Environment<a name="EN-US_TOPIC_0000001152389293"></a>
N
NEEN 已提交
2

M
mamingshuai 已提交
3 4
-   [Environment Requirements](#section1724111409282)
    -   [Hardware](#section487353718276)
N
NEEN 已提交
5 6
    -   [Software Requirements](#section17315193935817)

M
mamingshuai 已提交
7
-   [Installing Linux Build Tools](#section8831868501)
N
NEEN 已提交
8 9
    -   [Changing Linux Shell to Bash](#section1715027152617)
    -   [Installing Basic Software Used for Compilation and Building \(Required Only for Ubuntu 20+\)](#section45512412251)
M
mamingshuai 已提交
10 11
    -   [Installing a File Packing Tool](#section1686964015274)
    -   [Installing hc-gen](#section18706403274)
N
NEEN 已提交
12 13


M
mamingshuai 已提交
14
## Environment Requirements<a name="section1724111409282"></a>
N
NEEN 已提交
15

M
mamingshuai 已提交
16
### Hardware<a name="section487353718276"></a>
N
NEEN 已提交
17 18 19 20 21 22 23 24

-   Hi3518E V300 IoT camera development board
-   USB-to-serial cable and network cable \(The Windows workstation is connected to the Hi3518E V300 development board through the USB-to-serial cable and network cable.\)

    The following figure shows the hardware connections.


**Figure  1**  Hardware connections<a name="fig8211468392"></a>  
M
mamingshuai 已提交
25
![](figures/hardware-connections-3.png "hardware-connections-3")
N
NEEN 已提交
26 27 28 29

### Software Requirements<a name="section17315193935817"></a>

>![](public_sys-resources/icon-notice.gif) **NOTICE:** 
M
mamingshuai 已提交
30
>This section describes how to use an installation package to set up the compilation and development environment. If you are going to use Docker to set up the environment, skip this section and  [Installing Linux Build Tools](#section8831868501).
N
NEEN 已提交
31 32 33 34 35 36

The following table describes the tools required for setting up the general environment for a Linux server of the Hi3518 development board and how to obtain these tools.

**Table  1**  Development tools and obtaining methods

<a name="table15485545145811"></a>
M
mamingshuai 已提交
37
<table><thead align="left"><tr id="row1748610451588"><th class="cellrowborder" valign="top" width="23.332333233323332%" id="mcps1.2.4.1.1"><p id="p13486154545816"><a name="p13486154545816"></a><a name="p13486154545816"></a>Development Tool</p>
N
NEEN 已提交
38
</th>
M
mamingshuai 已提交
39
<th class="cellrowborder" valign="top" width="14.65146514651465%" id="mcps1.2.4.1.2"><p id="p44867452589"><a name="p44867452589"></a><a name="p44867452589"></a>Description</p>
N
NEEN 已提交
40
</th>
M
mamingshuai 已提交
41
<th class="cellrowborder" valign="top" width="62.016201620162015%" id="mcps1.2.4.1.3"><p id="p1748619458583"><a name="p1748619458583"></a><a name="p1748619458583"></a>How to Obtain</p>
N
NEEN 已提交
42 43 44
</th>
</tr>
</thead>
M
mamingshuai 已提交
45
<tbody><tr id="row18630134151917"><td class="cellrowborder" valign="top" width="23.332333233323332%" headers="mcps1.2.4.1.1 "><p id="p1563113417199"><a name="p1563113417199"></a><a name="p1563113417199"></a>bash</p>
N
NEEN 已提交
46
</td>
M
mamingshuai 已提交
47
<td class="cellrowborder" valign="top" width="14.65146514651465%" headers="mcps1.2.4.1.2 "><p id="p463193418190"><a name="p463193418190"></a><a name="p463193418190"></a>Processes CLI commands.</p>
N
NEEN 已提交
48
</td>
M
mamingshuai 已提交
49
<td class="cellrowborder" valign="top" width="62.016201620162015%" headers="mcps1.2.4.1.3 "><p id="p1063118344191"><a name="p1063118344191"></a><a name="p1063118344191"></a>System configuration</p>
N
NEEN 已提交
50 51
</td>
</tr>
M
mamingshuai 已提交
52
<tr id="row7598468212"><td class="cellrowborder" valign="top" width="23.332333233323332%" headers="mcps1.2.4.1.1 "><p id="p659815642111"><a name="p659815642111"></a><a name="p659815642111"></a>Basic software package for compilation and building (required only for Ubuntu 20+)</p>
N
NEEN 已提交
53
</td>
M
mamingshuai 已提交
54
<td class="cellrowborder" valign="top" width="14.65146514651465%" headers="mcps1.2.4.1.2 "><p id="p137174662119"><a name="p137174662119"></a><a name="p137174662119"></a>Provides a basic software package for compilation and building.</p>
N
NEEN 已提交
55
</td>
M
mamingshuai 已提交
56
<td class="cellrowborder" valign="top" width="62.016201620162015%" headers="mcps1.2.4.1.3 "><p id="p125983652118"><a name="p125983652118"></a><a name="p125983652118"></a>Internet</p>
N
NEEN 已提交
57 58
</td>
</tr>
M
mamingshuai 已提交
59
<tr id="row08231641105420"><td class="cellrowborder" valign="top" width="23.332333233323332%" headers="mcps1.2.4.1.1 "><p id="p1682494111548"><a name="p1682494111548"></a><a name="p1682494111548"></a>dosfstools, mtools, and mtd-utils</p>
N
NEEN 已提交
60
</td>
M
mamingshuai 已提交
61
<td class="cellrowborder" valign="top" width="14.65146514651465%" headers="mcps1.2.4.1.2 "><p id="p1362445934918"><a name="p1362445934918"></a><a name="p1362445934918"></a>Pack files.</p>
N
NEEN 已提交
62
</td>
M
mamingshuai 已提交
63
<td class="cellrowborder" valign="top" width="62.016201620162015%" headers="mcps1.2.4.1.3 "><p id="p1262475944916"><a name="p1262475944916"></a><a name="p1262475944916"></a>apt-get install</p>
N
NEEN 已提交
64 65 66 67 68
</td>
</tr>
</tbody>
</table>

M
mamingshuai 已提交
69
## Installing Linux Build Tools<a name="section8831868501"></a>
N
NEEN 已提交
70 71

>![](public_sys-resources/icon-notice.gif) **NOTICE:** 
M
mamingshuai 已提交
72 73
>-   If you acquire the source code using an HPM component or HPM CLI tool, you do not need to install  **hc-gen**.
>-   \(Recommended\) If you obtain the source code through an image site or a code repository, you should install the compilation tool  **hc-gen**. When installing the compilation tool, ensure that its environment variable path is unique.
N
NEEN 已提交
74

N
NEEN 已提交
75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105
### Changing Linux Shell to Bash<a name="section1715027152617"></a>

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 first command to delete  **sh**  and then run the second command to create a new soft link.

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

### Installing Basic Software Used for Compilation and Building \(Required Only for Ubuntu 20+\)<a name="section45512412251"></a>

Install the software.

```
sudo apt-get install build-essential && 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
```

M
mamingshuai 已提交
106
### Installing a File Packing Tool<a name="section1686964015274"></a>
N
NEEN 已提交
107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127

1.  Start a Linux server.
2.  Install  **dosfstools**.

    ```
    sudo apt-get install dosfstools
    ```

3.  Install  **mtools**.

    ```
    sudo apt-get install mtools
    ```

4.  Install  **mtd-utils**.

    ```
    sudo apt-get install mtd-utils
    ```


M
mamingshuai 已提交
128
### Installing hc-gen<a name="section18706403274"></a>
N
NEEN 已提交
129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156

1.  Start a Linux server.
2.  Download  [hc-gen](https://repo.huaweicloud.com/harmonyos/compiler/hc-gen/0.65/linux/hc-gen-0.65-linux.tar).
3.  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.

    ```
    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.  Validate the environment variable.

    ```
    source ~/.bashrc
    ```