• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Building Source Code
2
3
4For details about the functions of the OpenHarmony compilation and building module, see [Compilation and Building Guide](../subsystems/subsys-build-all.md).
5
6
7## Prerequisites
8
9- The [required libraries and tools](quickstart-pkg-install-package.md) have been installed.
10
11- The [compilation tools](quickstart-pkg-install-tool.md) have been installed.
12
13- The [tools specially required by Hi3861](quickstart-pkg-3861-tool.md) have been installed.
14
15- The Hello World program is ready for use.
16
17- The access to the Ubuntu environment is normal.
18
19
20## Procedure
21
22Method 1: using hb for compilation (install [compilation tools](quickstart-pkg-install-tool.md) first)
23
24Go to the root directory of the source code in the Ubuntu environment and perform the following steps:
25
261. Set the build path.
27
28   ```
29   hb set
30   ```
31
322. Select the current path.
33
34   ```
35   .
36   ```
37
383. Select **wifiiot_hispark_pegasus** under **hisilicon** and press **Enter**.
39   > ![icon-note.gif](public_sys-resources/icon-note.gif) **NOTE**
40   >
41   > When adapting the development board to a specific use case, select an appropriate build form factor, that is, **product** settings. For details, see [Build Form Factors](quickstart-appendix-compiledform.md).
42
43   **Figure 1** Hi3861 build settings
44
45   ![quickstart-lite-3861-build](figures/quickstart-lite-3861-build.png)
46
474. Start building.
48   > ![icon-note.gif](public_sys-resources/icon-note.gif) **NOTE**
49   > - To build a component (for example, **hello**), run the **hb build -T *targetName*** command.
50   >
51   > - To build a product incrementally, run the **hb build** command.
52   >
53   > - To build a product from the scratch, run the **hb build -f** command.
54   >
55   > This example builds a product from the scratch.
56
57
58   ```
59   hb build -f
60   ```
61
625. Check the build result. If "build success" is displayed, the building is successful.
63   > ![icon-notice.gif](public_sys-resources/icon-notice.gif) **NOTICE**
64   >
65   > The build result and log files are stored in **out/hispark_pegasus/wifiiot_hispark_pegasus**.
66
67Method 2: using the **build.sh** script for compilation
68
69For details, see [Building Source Code Using the build.sh Script](quickstart-pkg-common-build.md).