1e41f4b71Sopenharmony_ci# Chipset Solution
2e41f4b71Sopenharmony_ci### Configuration Rules
3e41f4b71Sopenharmony_ci
4e41f4b71Sopenharmony_ci- The chipset solution is a special component. It is built based on a development board, including the drivers, device API adaptation, and SDK.
5e41f4b71Sopenharmony_ci- The source code path is named in the **device/{Development_board}/{Chipset_solution_vendor}** format.
6e41f4b71Sopenharmony_ci- The chipset solution component is built by default based on the development board selected.
7e41f4b71Sopenharmony_ci
8e41f4b71Sopenharmony_ciThe chipset solution directory structure is as follows:
9e41f4b71Sopenharmony_ci
10e41f4b71Sopenharmony_ci```shell
11e41f4b71Sopenharmony_ci  device                                      
12e41f4b71Sopenharmony_ci  └── board                                   
13e41f4b71Sopenharmony_ci      └── company                           # Chipset solution vendor
14e41f4b71Sopenharmony_ci           └──  hispark_aries               # Development board name
15e41f4b71Sopenharmony_ci                 ├── BUILD.gn               # Build script
16e41f4b71Sopenharmony_ci                 ├── hals                   # OS device API adaptation
17e41f4b71Sopenharmony_ci                 ├── linux                  # (Optional) Linux kernel version
18e41f4b71Sopenharmony_ci                 │   └── config.gni         # Linux build configuration
19e41f4b71Sopenharmony_ci                 └── liteos_a               # (Optional) LiteOS kernel version
20e41f4b71Sopenharmony_ci                     └── config.gni         # LiteOS_A build configuration
21e41f4b71Sopenharmony_ci```
22e41f4b71Sopenharmony_ci
23e41f4b71Sopenharmony_ci**CAUTION**<br>The **config.gni** file contains the configuration related to the build of the development board. The parameters in this file are used to compile all OS components and are globally visible during the build process.
24e41f4b71Sopenharmony_ci
25e41f4b71Sopenharmony_ci- The **config.gni** file contains the following key parameters:
26e41f4b71Sopenharmony_ci
27e41f4b71Sopenharmony_ci```shell
28e41f4b71Sopenharmony_ci  kernel_type:            Kernel used by the development board, for example, LiteOS_A, LiteOS_M, or Linux.
29e41f4b71Sopenharmony_ci  kernel_version:         Kernel version of the development board, for example, 4.19.
30e41f4b71Sopenharmony_ci  board_cpu:              CPU of the development board, for example, Cortex-A7 or RISCV32.
31e41f4b71Sopenharmony_ci  board_arch:             Chipset architecture of the development board, for example, ARMv7-A or RV32IMAC.
32e41f4b71Sopenharmony_ci  board_toolchain:        Name of the customized build toolchain used by the development board, for example, gcc-arm-none-eabi. If this field is not specified, ohos-clang will be used.
33e41f4b71Sopenharmony_ci  board_toolchain_prefix: Prefix of the toolchain, for example, gcc-arm-none-eabi.
34e41f4b71Sopenharmony_ci  board_toolchain_type:   Toolchain type. Currently, only GCC and clang are supported.
35e41f4b71Sopenharmony_ci  board_cflags:           Build options of the .c file configured for the development board.
36e41f4b71Sopenharmony_ci  board_cxx_flags:        Build options of the .cpp file configured for the development board.
37e41f4b71Sopenharmony_ci  board_ld_flags:         Linking options configured for the development board.
38e41f4b71Sopenharmony_ci```
39e41f4b71Sopenharmony_ci
40e41f4b71Sopenharmony_ci###  Adding and Building a Chipset Solution
41e41f4b71Sopenharmony_ci
42e41f4b71Sopenharmony_ciThe following uses the RTL8720 development board provided by Realtek as an example. The procedure is as follows:
43e41f4b71Sopenharmony_ci
44e41f4b71Sopenharmony_ci1. Create a directory for the chipset solution.
45e41f4b71Sopenharmony_ci
46e41f4b71Sopenharmony_ci   Run the following command in the root code directory:
47e41f4b71Sopenharmony_ci
48e41f4b71Sopenharmony_ci   ```shell
49e41f4b71Sopenharmony_ci   mkdir -p device/board/realtek/rtl8720
50e41f4b71Sopenharmony_ci   ```
51e41f4b71Sopenharmony_ci
52e41f4b71Sopenharmony_ci   
53e41f4b71Sopenharmony_ci
54e41f4b71Sopenharmony_ci2. Create a directory for kernel adaptation and configure the **config.gni** file of the development board.
55e41f4b71Sopenharmony_ci
56e41f4b71Sopenharmony_ci   For example, to adapt the LiteOS-A kernel to the RTL8720 development board, configure the **device/board/realtek/rtl8720/liteos_a/config.gni** file as follows:
57e41f4b71Sopenharmony_ci
58e41f4b71Sopenharmony_ci   ```shell
59e41f4b71Sopenharmony_ci   # Kernel type, e.g. "linux", "liteos_a", "liteos_m".
60e41f4b71Sopenharmony_ci   kernel_type = "liteos_a"
61e41f4b71Sopenharmony_ci   
62e41f4b71Sopenharmony_ci   # Kernel version.
63e41f4b71Sopenharmony_ci   kernel_version = "3.0.0"
64e41f4b71Sopenharmony_ci   
65e41f4b71Sopenharmony_ci   # Board CPU type, e.g. "cortex-a7", "riscv32".
66e41f4b71Sopenharmony_ci   board_cpu = "real-m300"
67e41f4b71Sopenharmony_ci   
68e41f4b71Sopenharmony_ci   # Board arch, e.g. "armv7-a", "rv32imac".
69e41f4b71Sopenharmony_ci   board_arch = ""
70e41f4b71Sopenharmony_ci   
71e41f4b71Sopenharmony_ci   # Toolchain name used for system compiling.
72e41f4b71Sopenharmony_ci   # E.g. gcc-arm-none-eabi, arm-linux-harmonyeabi-gcc, ohos-clang, riscv32-unknown-elf.
73e41f4b71Sopenharmony_ci   # Note: The default toolchain is "ohos-clang". It's not mandatory if you use the default toochain.
74e41f4b71Sopenharmony_ci   board_toolchain = "gcc-arm-none-eabi"
75e41f4b71Sopenharmony_ci   
76e41f4b71Sopenharmony_ci   # The toolchain path instatlled, it's not mandatory if you have added toolchain path to your ~/.bashrc.
77e41f4b71Sopenharmony_ci   board_toolchain_path =
78e41f4b71Sopenharmony_ci       rebase_path("//prebuilts/gcc/linux-x86/arm/gcc-arm-none-eabi/bin",
79e41f4b71Sopenharmony_ci                   root_build_dir)
80e41f4b71Sopenharmony_ci   
81e41f4b71Sopenharmony_ci   # Compiler prefix.
82e41f4b71Sopenharmony_ci   board_toolchain_prefix = "gcc-arm-none-eabi-"
83e41f4b71Sopenharmony_ci   
84e41f4b71Sopenharmony_ci   # Compiler type, "gcc" or "clang".
85e41f4b71Sopenharmony_ci   board_toolchain_type = "gcc"
86e41f4b71Sopenharmony_ci   
87e41f4b71Sopenharmony_ci   # Board related common compile flags.
88e41f4b71Sopenharmony_ci   board_cflags = []
89e41f4b71Sopenharmony_ci   board_cxx_flags = []
90e41f4b71Sopenharmony_ci   board_ld_flags = []
91e41f4b71Sopenharmony_ci   ```
92e41f4b71Sopenharmony_ci
93e41f4b71Sopenharmony_ci3. Write the build script.
94e41f4b71Sopenharmony_ci
95e41f4b71Sopenharmony_ci   Create the **BUILD.gn** file in the development board directory. The target name must be the same as that of the development board. The following is an example of the **device/board/realtek/rtl8720/BUILD.gn** file for the RTL8720 development board:
96e41f4b71Sopenharmony_ci
97e41f4b71Sopenharmony_ci   ```shell
98e41f4b71Sopenharmony_ci   group("rtl8720") { # The build target can be shared_library, static_library, or an executable file.
99e41f4b71Sopenharmony_ci     # Content
100e41f4b71Sopenharmony_ci     ...
101e41f4b71Sopenharmony_ci   }
102e41f4b71Sopenharmony_ci   ```
103e41f4b71Sopenharmony_ci
104e41f4b71Sopenharmony_ci4. Build the chipset solution.
105e41f4b71Sopenharmony_ci
106e41f4b71Sopenharmony_ci   Run the **hb build** command in the development board directory to start the build.
107e41f4b71Sopenharmony_ci
108