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 Hello World program is ready for use. 17e41f4b71Sopenharmony_ci 18e41f4b71Sopenharmony_ci- The access to the Ubuntu environment is normal. 19e41f4b71Sopenharmony_ci 20e41f4b71Sopenharmony_ci 21e41f4b71Sopenharmony_ci## Procedure 22e41f4b71Sopenharmony_ci 23e41f4b71Sopenharmony_ciGo to the root directory of the source code in the Ubuntu environment and perform the following steps: 24e41f4b71Sopenharmony_ci 25e41f4b71Sopenharmony_ci1. Set the build path. 26e41f4b71Sopenharmony_ci 27e41f4b71Sopenharmony_ci ``` 28e41f4b71Sopenharmony_ci hb set 29e41f4b71Sopenharmony_ci ``` 30e41f4b71Sopenharmony_ci 31e41f4b71Sopenharmony_ci2. Select the current path. 32e41f4b71Sopenharmony_ci 33e41f4b71Sopenharmony_ci ``` 34e41f4b71Sopenharmony_ci . 35e41f4b71Sopenharmony_ci ``` 36e41f4b71Sopenharmony_ci 37e41f4b71Sopenharmony_ci3. Select **rk3568** under **hihope** and press **Enter**. 38e41f4b71Sopenharmony_ci >  **NOTE** 39e41f4b71Sopenharmony_ci > 40e41f4b71Sopenharmony_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). 41e41f4b71Sopenharmony_ci 42e41f4b71Sopenharmony_ci **Figure 1** RK3568 build settings 43e41f4b71Sopenharmony_ci 44e41f4b71Sopenharmony_ci  45e41f4b71Sopenharmony_ci 46e41f4b71Sopenharmony_ci4. If you are building the source code into a 32-bit system, skip this step. 47e41f4b71Sopenharmony_ci 48e41f4b71Sopenharmony_ci If you are building the source code into a 64-bit system, run the following command: 49e41f4b71Sopenharmony_ci 50e41f4b71Sopenharmony_ci 51e41f4b71Sopenharmony_ci ``` 52e41f4b71Sopenharmony_ci hb build --target-cpu arm64 53e41f4b71Sopenharmony_ci ``` 54e41f4b71Sopenharmony_ci 55e41f4b71Sopenharmony_ci5. Start building. 56e41f4b71Sopenharmony_ci >  **NOTE** 57e41f4b71Sopenharmony_ci > - To build a component (for example, **hello**), run the **hb build -T *targetName*** command. 58e41f4b71Sopenharmony_ci > 59e41f4b71Sopenharmony_ci > - To build a product incrementally, run the **hb build** command. 60e41f4b71Sopenharmony_ci > 61e41f4b71Sopenharmony_ci > - To build a product from the scratch, run the **hb build -f** command. 62e41f4b71Sopenharmony_ci > 63e41f4b71Sopenharmony_ci > This example builds a product from the scratch. 64e41f4b71Sopenharmony_ci 65e41f4b71Sopenharmony_ci 66e41f4b71Sopenharmony_ci ``` 67e41f4b71Sopenharmony_ci hb build -f 68e41f4b71Sopenharmony_ci ``` 69e41f4b71Sopenharmony_ci 70e41f4b71Sopenharmony_ci6. Check the build result. If "rk3568 build success" is displayed, the building is successful. 71e41f4b71Sopenharmony_ci >  **NOTICE** 72e41f4b71Sopenharmony_ci > 73e41f4b71Sopenharmony_ci > The build result and log files are stored in **out/rk3568**. 74