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