1e41f4b71Sopenharmony_ci# Building Source Code
2e41f4b71Sopenharmony_ci
3e41f4b71Sopenharmony_ci
4e41f4b71Sopenharmony_ciYou can build source code with hb or the **build.sh** script. This topic describes how to build source code with hb. For details about how to use the **build.sh** script, see [Building Source Code Using the build.sh Script](quickstart-pkg-common-build.md).
5e41f4b71Sopenharmony_ci
6e41f4b71Sopenharmony_ci
7e41f4b71Sopenharmony_ciFor details about the functions of the OpenHarmony compilation and building module, see [Compilation and Building Guide](../subsystems/subsys-build-all.md).
8e41f4b71Sopenharmony_ci
9e41f4b71Sopenharmony_ci
10e41f4b71Sopenharmony_ci## Prerequisites
11e41f4b71Sopenharmony_ci
12e41f4b71Sopenharmony_ci- The [required libraries and tools](quickstart-pkg-install-package.md) have been installed.
13e41f4b71Sopenharmony_ci
14e41f4b71Sopenharmony_ci- The [compilation tools](quickstart-pkg-install-tool.md) have been installed.
15e41f4b71Sopenharmony_ci
16e41f4b71Sopenharmony_ci- The [tools specially required by Hi3861](quickstart-pkg-3861-tool.md) have been installed.
17e41f4b71Sopenharmony_ci
18e41f4b71Sopenharmony_ci- The Hello World program is ready for use.
19e41f4b71Sopenharmony_ci
20e41f4b71Sopenharmony_ci- The access to the Ubuntu environment is normal.
21e41f4b71Sopenharmony_ci
22e41f4b71Sopenharmony_ci
23e41f4b71Sopenharmony_ci## Procedure
24e41f4b71Sopenharmony_ci
25e41f4b71Sopenharmony_ciGo to the root directory of the source code in the Ubuntu environment and perform the following steps:
26e41f4b71Sopenharmony_ci
27e41f4b71Sopenharmony_ci1. Set the build path.
28e41f4b71Sopenharmony_ci   
29e41f4b71Sopenharmony_ci   ```
30e41f4b71Sopenharmony_ci   hb set
31e41f4b71Sopenharmony_ci   ```
32e41f4b71Sopenharmony_ci
33e41f4b71Sopenharmony_ci2. Select the current path.
34e41f4b71Sopenharmony_ci   
35e41f4b71Sopenharmony_ci   ```
36e41f4b71Sopenharmony_ci   .
37e41f4b71Sopenharmony_ci   ```
38e41f4b71Sopenharmony_ci
39e41f4b71Sopenharmony_ci3. Select **wifiiot_hispark_pegasus** under **hisilicon** and press **Enter**.
40e41f4b71Sopenharmony_ci   > ![icon-note.gif](public_sys-resources/icon-note.gif) **NOTE**
41e41f4b71Sopenharmony_ci   >
42e41f4b71Sopenharmony_ci   > 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).
43e41f4b71Sopenharmony_ci
44e41f4b71Sopenharmony_ci   **Figure 1** Hi3861 build settings 
45e41f4b71Sopenharmony_ci
46e41f4b71Sopenharmony_ci   ![quickstart-lite-3861-build](figures/quickstart-lite-3861-build.png)
47e41f4b71Sopenharmony_ci
48e41f4b71Sopenharmony_ci4. Start building.
49e41f4b71Sopenharmony_ci   > ![icon-note.gif](public_sys-resources/icon-note.gif) **NOTE**
50e41f4b71Sopenharmony_ci   > - To build a component (for example, **hello**), run the **hb build -T *targetName*** command.
51e41f4b71Sopenharmony_ci   > 
52e41f4b71Sopenharmony_ci   > - To build a product incrementally, run the **hb build** command.
53e41f4b71Sopenharmony_ci   > 
54e41f4b71Sopenharmony_ci   > - To build a product from the scratch, run the **hb build -f** command.
55e41f4b71Sopenharmony_ci   > 
56e41f4b71Sopenharmony_ci   > This example builds a product from the scratch.
57e41f4b71Sopenharmony_ci
58e41f4b71Sopenharmony_ci   
59e41f4b71Sopenharmony_ci   ```
60e41f4b71Sopenharmony_ci   hb build -f
61e41f4b71Sopenharmony_ci   ```
62e41f4b71Sopenharmony_ci
63e41f4b71Sopenharmony_ci5. Check the build result. If "build success" is displayed, the building is successful.
64e41f4b71Sopenharmony_ci   > ![icon-notice.gif](public_sys-resources/icon-notice.gif) **NOTICE**
65e41f4b71Sopenharmony_ci   >
66e41f4b71Sopenharmony_ci   > The build result and log files are stored in **out/hispark_pegasus/wifiiot_hispark_pegasus**.
67e41f4b71Sopenharmony_ci
68