• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 Hello World program is ready for use.
17
18- The access to the Ubuntu environment is normal.
19
20
21## Procedure
22
23Go to the root directory of the source code in the Ubuntu environment and perform the following steps:
24
251. Set the build path.
26
27   ```
28   hb set
29   ```
30
312. Select the current path.
32
33   ```
34   .
35   ```
36
373. Select **rk3568** under **hihope** and press **Enter**.
38   > ![icon-note.gif](public_sys-resources/icon-note.gif) **NOTE**
39   >
40   > 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).
41
42     **Figure 1** RK3568 build settings
43
44   ![quickstart-standard-rk3568-build](figures/quickstart-standard-rk3568-build.png)
45
464. If you are building the source code into a 32-bit system, skip this step.
47
48   If you are building the source code into a 64-bit system, run the following command:
49
50
51   ```
52   hb build --target-cpu arm64
53   ```
54
555. Start building.
56   > ![icon-note.gif](public_sys-resources/icon-note.gif) **NOTE**
57   > - To build a component (for example, **hello**), run the **hb build -T *targetName*** command.
58   >
59   > - To build a product incrementally, run the **hb build** command.
60   >
61   > - To build a product from the scratch, run the **hb build -f** command.
62   >
63   > This example builds a product from the scratch.
64
65
66   ```
67   hb build -f
68   ```
69
706. Check the build result. If "rk3568 build success" is displayed, the building is successful.
71   > ![icon-notice.gif](public_sys-resources/icon-notice.gif) **NOTICE**
72   >
73   > The build result and log files are stored in **out/rk3568**.
74