• Home
Name Date Size #Lines LOC

..--

linux-4.19/arch/arm/configs/07-Sep-2024-12,90812,184

linux-5.10/07-Sep-2024-94,38089,205

.gitattributesD07-Sep-2024631 1615

LICENSED07-Sep-202417.6 KiB341281

OAT.xmlD07-Sep-20244.4 KiB7519

README.mdD07-Sep-20245 KiB10372

README_zh.mdD07-Sep-20245.3 KiB10068

README.md

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

README_zh.md

1# Config组件<a name="ZH-CN_TOPIC_0000001102487950"></a>
2
3-   [简介](#section11660541593)
4-   [内核的Config组成模块](#section28381947133910)
5-   [目录](#section161941989596)
6-   [使用说明](#section1393789267)
7-   [构建说明](#section19369206113115)
8-   [相关仓](#section1371113476307)
9
10## 简介<a name="section11660541593"></a>
11
12OpenHarmony的Linux内核基于开源Linux内核LTS **4.19.y / 5.10.y** 分支演进,在此基线基础上,回合CVE补丁及OpenHarmony特性,作为OpenHarmony Common Kernel基线。针对不同的芯片,各厂商合入对应的板级驱动补丁,完成对OpenHarmony的基线适配。
13
14Linux社区LTS 4.19.y分支信息请查看[kernel官网](https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/log/?h=linux-4.19.y)15
16Linux社区LTS 5.10.y分支信息请查看[kernel官网](https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/log/?h=linux-5.10.y)17
18## 目录<a name="section161941989596"></a>
19
20针对标准系统开源开发板rk3568,给出对应的config分层配置目录结构、文件示例:
21```
22kernel/linux/config
23└── linux-5.10
24    ├── base_defconfig                                # 内核必选模块或安全红线特性配置
25    ├── type                                          # 形态配置目录
26    │   ├── small_defconfig                           # 小型系统常用配置文件
27    │   └── standard_defconfig                        # 标准系统常用配置文件
28    ├── form                                          # 版本配置目录
29    │   └── debug_defconfig                           # 调试版本配置文件(示例目前无配置需求)
30    ├── rk3568                                        # 厂商平台配置目录
31    │   └── arch
32    │       └── arm64_defconfig                       # 芯片单板64位版本相关配置文件
33    └── product                                       # 相关产品类型配置目录
34        └── phone_defconfig                           # 手机类型产品相关配置文件
35```
36
37## 内核的Config组成模块<a name="section28381947133910"></a>
38
391. 基础通用配置文件(base):其中包含OpenHarmony特性依赖的内核必选模块以及安全红线特性等必须开启的配置项,其中配置不可被覆盖。如需新增、调整其中配置需上内核-sig例会进行评审。默认必选配置文件。
40
412. 系统形态配置文件(type):针对不同的内核版本,config将给出不同内核版本的对应不同的系统的参考通用配置文件。必选配置文件,通过build\_type编译参数确定文件。
42
433. 版本形态配置文件(form):用于区分版本类型的可选配置文件,通过build\_variant编译参数确定文件,如果文件不存在,则忽略该层配置文件。
44
454. 芯片平台配置文件(chip):由具体厂商提供的和芯片、单板相关的内核模块、驱动等配置,为必选配置文件,通过target\_cpu编译参数确定文件。
46
475. 产品类型配置文件(product):如同一芯片平台同时又多种产品形态时候,需要做区分配置可以配置使用该层配置。为可选配置层,通过device\_type编译参数确定文件
48
49
50## 使用说明<a name="section1393789267"></a>
51
521. 合入HDF补丁
53
54kernel/linux/build仓中,按照kernel.mk中HDF的补丁合入方法,合入不同内核版本对应的HDF内核补丁:
55
56	```
57	$(OHOS_BUILD_HOME)/drivers/hdf_core/adapter/khdf/linux/patch_hdf.sh $(OHOS_BUILD_HOME) $(KERNEL_SRC_TMP_PATH) $(KERNEL_PATCH_PATH) $(DEVICE_NAME)
58	```
59
602. 合入芯片平台驱动补丁
61
62	以Hi3516DV300为例:
63
64kernel/linux/build仓中,按照kernel.mk中的芯片组件所对应的patch路径规则及命名规则,将对应的芯片组件patch放到对应路径下:
65
66	```
67	DEVICE_PATCH_DIR := $(OHOS_BUILD_HOME)/kernel/linux/patches/${KERNEL_VERSION}/$(DEVICE_NAME)_patch
68	DEVICE_PATCH_FILE := $(DEVICE_PATCH_DIR)/$(DEVICE_NAME).patch
69	```
70
713. 修改自己所需要编译的config
72
73kernel/linux/build仓中,按照kernel.mk中的芯片组件所对应的patch路径规则及命名规则,将对应的芯片组件config放到对应路径下:
74
75	```
76	KERNEL_CONFIG_PATH := $(OHOS_BUILD_HOME)/kernel/linux/config/${KERNEL_VERSION}
77	DEFCONFIG_FILE := $(DEVICE_NAME)_$(BUILD_TYPE)_defconfig
78	```
79
80	> **须知:**
81	>
82	>由于OpenHarmony工程的编译构建流程中会拷贝kernel/linux/linux-\*\.\*的代码环境后进行打补丁动作,在使用OpenHarmony的版本级编译命令前,需要kernel/linux/linux-\*\.\*原代码环境。
83	>
84	>根据不同系统工程,编译完成后会在out目录下的kernel目录中生成对应实际编译的内核,基于此目录的内核,进行对应的config修改,将最后生成的\.config文件cp到config仓对应的路径文件里,即可生效。
85
86## 构建说明<a name="section19369206113115"></a>
87以hi3516dv300开源开发板+ubuntu x86主机开发环境为例
88
89使用工程的全量编译命令,编译生成uImage内核镜像
90
91```
92./build.sh --product-name Hi3516DV300              # 编译hi3516dv300镜像
93    --build-target build_kernel                    # 编译hi3516dv300的uImage内核镜像
94    --gn-args linux_kernel_version=\"linux-5.10\"  # 编译指定内核版本
95```
96
97## 相关仓<a name="section1371113476307"></a>
98<u>kernel\_linux\_config</u>
99
100