• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Config<a name="EN-US_TOPIC_0000001102487950"></a>
2
3-   [Introduction](#section11660541593)
4-   [Composition of Config](#section28381947133910)
5-   [Directory Structure](#section161941989596)
6-   [Usage](#section1393789267)
7-   [Build](#section19369206113115)
8-   [Repositories Involved](#section1371113476307)
9
10## Introduction<a name="section11660541593"></a>
11
12Evolved from the open-source Linux kernel LTS 4.19.y and 5.10.y, the OpenHarmony Linux kernel has incorporated CVE patches and OpenHarmony features as the OpenHarmony common kernel baseline. Vendors can complete the kernel adaptation by applying the driver patches for boards.
13
14For more information about Linux LTS 4.19.y, visit the [official kernel website](https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/log/?h=linux-4.19.y).
15
16For more information about Linux LTS 5.10.y, visit the [official kernel website](https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/log/?h=linux-5.10.y).
17
18## Composition of Config<a name="section28381947133910"></a>
19
201. Common configuration file
21
22	Config provides common configuration files for different systems:
23
24	Standard system: **standard\_common\_defconfig**
25
26	Small system: **small\_common\_defconfig**
27
282. Configuration files for open-source development boards
29
30	Configuration file for the open-source development board Hi3516D V300 used in the standard system
31
32## Directory Structure<a name="section161941989596"></a>
33
34```
35kernel/linux/config
36├── linux-4.19
37│   └── arch
38│       └── arm
39│           └── configs
40│               ├── hi3516dv300_small_defconfig       # Small-system defconfig of the open-source Hi3516D V300 development board from HiSilicon
41│               ├── hi3516dv300_standard_defconfig    # Standard-system defconfig of the open-source Hi3516D V300 development board from HiSilicon
42│               ├── small_common_defconfig            # Common defconfig of the small-system kernel
43│               └── standard_common_defconfig         # Common defconfig of the standard-system kernel
44└── linux-5.10
45    └── arch
46        └── arm
47            └── configs
48                ├── hi3516dv300_small_defconfig       # Small-system defconfig of the open-source Hi3516D V300 development board from HiSilicon
49                ├── hi3516dv300_standard_defconfig    # Standard-system defconfig of the open-source Hi3516D V300 development board from HiSilicon
50                ├── small_common_defconfig            # Common defconfig of the small-system kernel
51                └── standard_common_defconfig         # Common defconfig of the standard-system kernel
52```
53
54## Usage<a name="section1393789267"></a>
55
561. Apply HDF patches.
57
58	Apply the HDF kernel patches matching your kernel version. For details, see the method in **kernel.mk** in the **kernel/linux/build** repository.
59
60	```
61	$(OHOS_BUILD_HOME)/drivers/hdf_core/adapter/khdf/linux/patch_hdf.sh $(OHOS_BUILD_HOME) $(KERNEL_SRC_TMP_PATH) $(KERNEL_PATCH_PATH) $(DEVICE_NAME)
62	```
63
642. Apply the chip driver patches.
65
66	The following uses Hi3516D V300 as an example.
67
68	Place the patches for the chip component in the corresponding path based on the path and naming rules for the patches of the chip component in **kernel.mk** in the **kernel/linux/build** repository.
69
70	```
71	DEVICE_PATCH_DIR := $(OHOS_BUILD_HOME)/kernel/linux/patches/${KERNEL_VERSION}/$(DEVICE_NAME)_patch
72	DEVICE_PATCH_FILE := $(DEVICE_PATCH_DIR)/$(DEVICE_NAME).patch
73	```
74
753. Modify the **config** file to build.
76
77	Place the **config** file for the chip component in the corresponding path based on the path and naming rules of the chip component in **kernel.mk** in the **kernel/linux/build** repository.
78
79	```
80	KERNEL_CONFIG_PATH := $(OHOS_BUILD_HOME)/kernel/linux/config/${KERNEL_VERSION}
81	DEFCONFIG_FILE := $(DEVICE_NAME)_$(BUILD_TYPE)_defconfig
82	```
83
84	> **Note**:
85	>
86	>In the OpenHarmony project build process, patches are installed after **kernel/linux/linux-\*\.\*** is copied. Before using the version-level build command of OpenHarmony, ensure that the **kernel/linux/linux-\*\.\*** source code is available.
87	>
88	>The kernel built is generated in the **kernel** directory under the **out** directory. Modify the **config** file based on the kernel built, and copy the generated **.config** file to the corresponding path in the **config** repository. Then, the configuration takes effect.
89
90## Build<a name="section19369206113115"></a>
91The following uses the Hi3516D V300 development board and Ubuntu x86 server as an example.
92
93Perform a full build for the project to generate the **uImage** kernel image.
94
95```
96./build.sh --product-name Hi3516DV300              # Build the Hi3516D V300 image.
97    --build-target build_kernel                    # Build the uImage kernel image of Hi3516D V300.
98    --gn-args linux_kernel_version=\"linux-5.10\"  # Build the specified kernel version.
99```
100
101## Repositories Involved<a name="section1371113476307"></a>
102<u>kernel\_linux\_config</u>
103