• 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 Hello World program is ready for use.
14
15- The access to the Ubuntu environment is normal.
16
17
18## Procedure
19
20Method 1: using hb for compilation (install [compilation tools](quickstart-pkg-install-tool.md) first)
21
22Go to the root directory of the source code in the Ubuntu environment and perform the following steps:
23
241. Set the build path.
25
26   ```
27   hb set
28   ```
29
302. Select the current path.
31
32   ```
33   .
34   ```
35
363. Select **rk3568** under **hihope** and press **Enter**.
37   > ![icon-note.gif](public_sys-resources/icon-note.gif) **NOTE**
38   >
39   > 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).
40
41     **Figure 1** RK3568 build settings
42
43   ![quickstart-standard-rk3568-build](figures/quickstart-standard-rk3568-build.png)
44
454. If you are building the source code into a 32-bit system, skip this step.
46
47   If you are building the source code into a 64-bit system, run the following command:
48
49
50   ```
51   hb build --target-cpu arm64
52   ```
53
545. Start building.
55   > ![icon-note.gif](public_sys-resources/icon-note.gif) **NOTE**
56   > - To build a component (for example, **hello**), run the **hb build -T *targetName*** command.
57   >
58   > - To build a product incrementally, run the **hb build** command.
59   >
60   > - To build a product from the scratch, run the **hb build -f** command.
61   >
62   > This example builds a product from the scratch.
63
64
65   ```
66   hb build -f
67   ```
68
696. Check the build result. If "rk3568 build success" is displayed, the building is successful.
70   > ![icon-notice.gif](public_sys-resources/icon-notice.gif) **NOTICE**
71   >
72   > The build result and log files are stored in **out/rk3568**.
73
74Method 2: using the **build.sh** script for compilation
75
76For details, see [Building Source Code Using the build.sh Script](quickstart-pkg-common-build.md).
77