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