Name |
Date |
Size |
#Lines |
LOC |
||
---|---|---|---|---|---|---|
.. | - | - | ||||
linux-4.19/ | 12-May-2024 | - | 457,165 | 448,591 | ||
linux-5.10/ | 12-May-2024 | - | 171,190 | 151,236 | ||
.gitattributes | D | 12-May-2024 | 631 | 16 | 15 | |
LICENSE | D | 12-May-2024 | 17.6 KiB | 341 | 281 | |
OAT.xml | D | 12-May-2024 | 3.9 KiB | 67 | 11 | |
README.md | D | 12-May-2024 | 5.3 KiB | 107 | 79 | |
README_zh.md | D | 12-May-2024 | 5 KiB | 108 | 79 |
README.md
1# Patch<a name="EN-US_TOPIC_0000001078264110"></a> 2 3- [Introduction](#section11660541593) 4- [Directory Structure](#section21571344112) 5- [Usage](#section1393789267) 6- [Build](#section19369206113115) 7- [Repositories Involved](#section27639463106) 8 9## Introduction<a name="section11660541593"></a> 10 11Evolved 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. 12 13For 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). 14 15For 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). 16 17During the build process, you can merge the driver code based on the chip platform and build the kernel image. All patches are licensed under GNU General Public License (GPL) 2.0. 18 19## Directory Structure<a name="section21571344112"></a> 20 21``` 22kernel/linux 23├── build 24│ ├── BUILD.gn # GN file of the build framework 25│ ├── kernel.mk # Kernel build file 26│ └── ohos.build # Kernel build component file 27├── patches 28│ ├── linux-4.19 # linux-4.19 patches 29│ │ └── hi3516dv300_patch 30│ │ ├── hi3516dv300.patch # linux-4.19 Hi3516D V300 SOC patches 31│ │ └── hdf.patch # linux-4.19 Hi3516D V300 HDF patches 32│ └── linux-5.10 33│ └── hi3516dv300_patch 34│ ├── hi3516dv300.patch # linux-5.10 Hi3516D V300 SOC patches 35│ └── hdf.patch # linux-5.10 Hi3516D V300 HDF patches 36└── config 37 ├── linux-4.19 38 │ └── arch 39 │ └── arm 40 │ └── configs 41 │ ├── hi3516dv300_small_defconfig # Small-system defconfig of the open-source Hi3516D V300 development board from HiSilicon 42 │ ├── hi3516dv300_standard_defconfig # Standard-system defconfig of the open-source Hi3516D V300 development board from HiSilicon 43 │ ├── small_common_defconfig # Common defconfig of the small-system kernel 44 │ └── standard_common_defconfig # Common defconfig of the standard-system kernel 45 └── linux-5.10 46 └── arch 47 └── arm 48 └── configs 49 ├── hi3516dv300_small_defconfig # Small-system defconfig of the open-source Hi3516D V300 development board from HiSilicon 50 ├── hi3516dv300_standard_defconfig # Standard-system defconfig of the open-source Hi3516D V300 development board from HiSilicon 51 ├── small_common_defconfig # Common defconfig of the small-system kernel 52 └── standard_common_defconfig # Common defconfig of the standard-system kernel 53``` 54 55## Usage<a name="section1393789267"></a> 56 571. Apply HDF patches. 58 59 Apply the HDF kernel patches matching your kernel version. For details, see the method in **kernel.mk** in the **kernel/linux/build** repository. 60 61 ``` 62 $(OHOS_BUILD_HOME)/drivers/adapter/khdf/linux/patch_hdf.sh $(OHOS_BUILD_HOME) $(KERNEL_SRC_TMP_PATH) $(HDF_PATCH_FILE) 63 ``` 64 652. Apply the chip driver patches. 66 67 The following uses Hi3516D V300 as an example. 68 69 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. 70 71 ``` 72 DEVICE_PATCH_DIR := $(OHOS_BUILD_HOME)/kernel/linux/patches/${KERNEL_VERSION}/$(DEVICE_NAME)_patch 73 DEVICE_PATCH_FILE := $(DEVICE_PATCH_DIR)/$(DEVICE_NAME).patch 74 ``` 75 763. Modify the **config** file to build. 77 78 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. 79 80 ``` 81 KERNEL_CONFIG_PATH := $(OHOS_BUILD_HOME)/kernel/linux/config/${KERNEL_VERSION} 82 DEFCONFIG_FILE := $(DEVICE_NAME)_$(BUILD_TYPE)_defconfig 83 ``` 84 85 > **Note**: 86 > 87 >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. 88 > 89 >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. 90 91 92## Build<a name="section19369206113115"></a> 93 94The following uses the Hi3516D V300 development board and Ubuntu x86 server as an example. 95 96Perform a full build for the project to generate the **uImage** kernel image. 97 98``` 99./build.sh --product-name Hi3516DV300 # Build the Hi3516D V300 image. 100 --build-target build_kernel # Build the uImage kernel image of Hi3516D V300. 101 --gn-args linux_kernel_version=\"linux-5.10\" # Build the specified kernel version. 102``` 103 104## Repositories Involved<a name="section27639463106"></a> 105 106<u>kernel\_linux\_patches</u> 107
README_zh.md
1# Patch组件<a name="ZH-CN_TOPIC_0000001078264110"></a> 2 3- [简介](#section11660541593) 4- [目录](#section21571344112) 5- [使用说明](#section1393789267) 6- [构建说明](#section19369206113115) 7- [相关仓](#section27639463106) 8 9## 简介<a name="section11660541593"></a> 10 11OpenHarmony的Linux内核基于开源Linux内核LTS **4.19.y / 5.10.y** 分支演进,在此基线基础上,回合CVE补丁及OpenHarmony特性,作为OpenHarmony Common Kernel基线。针对不同的芯片,各厂商合入对应的板级驱动补丁,完成对OpenHarmony的基线适配。 12 13Linux社区LTS 4.19.y分支信息请查看[kernel官网](https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/log/?h=linux-4.19.y); 14 15Linux社区LTS 5.10.y分支信息请查看[kernel官网](https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/log/?h=linux-5.10.y)。 16 17内核的Patch组成模块,在编译构建流程中,针对具体芯片平台,合入对应的架构驱动代码,进行编译对应的内核镜像。所有补丁来源均遵守GPL-2.0协议。 18 19## 目录<a name="section21571344112"></a> 20 21``` 22kernel/linux 23├── build 24│ ├── BUILD.gn # 编译框架GN文件 25│ ├── kernel.mk # 内核编译文件 26│ └── ohos.build # 内核编译组件文件 27├── patches 28│ ├── linux-4.19 # linux-4.19 相关patch 29│ │ └── hi3516dv300_patch 30│ │ ├── hi3516dv300.patch # linux-4.19 hi3516dv300 SOC patch 31│ │ └── hdf.patch # linux-4.19 hi3516dv300 hdf patch 32│ └── linux-5.10 33│ └── hi3516dv300_patch 34│ ├── hi3516dv300.patch # linux-5.10 hi3516dv300 SOC patch 35│ └── hdf.patch # linux-5.10 hi3516dv300 hdf patch 36└── config 37 ├── linux-4.19 38 │ └── arch 39 │ └── arm 40 │ └── configs 41 │ ├── hi3516dv300_small_defconfig # 厂商Hisilicon对应的开源开发板Hi3516dv300小型系统的defconfig 42 │ ├── hi3516dv300_standard_defconfig # 厂商Hisilicon对应的开源开发板Hi3516dv300标准系统的defconfig 43 │ ├── small_common_defconfig # 小型系统的内核的common defconfig 44 │ └── standard_common_defconfig # 标准系统的内核的common defconfig 45 └── linux-5.10 46 └── arch 47 └── arm 48 └── configs 49 ├── hi3516dv300_small_defconfig # 厂商Hisilicon对应的开源开发板Hi3516dv300小型系统的defconfig 50 ├── hi3516dv300_standard_defconfig # 厂商Hisilicon对应的开源开发板Hi3516dv300标准系统的defconfig 51 ├── small_common_defconfig # 小型系统的内核的common defconfig 52 └── standard_common_defconfig # 标准系统的内核的common defconfig 53``` 54 55## 使用说明<a name="section1393789267"></a> 56 571. 合入HDF补丁 58 59 在kernel/linux/build仓中,按照kernel.mk中HDF的补丁合入方法,合入不同内核版本对应的HDF内核补丁: 60 61 ``` 62 $(OHOS_BUILD_HOME)/drivers/adapter/khdf/linux/patch_hdf.sh $(OHOS_BUILD_HOME) $(KERNEL_SRC_TMP_PATH) $(HDF_PATCH_FILE) 63 ``` 64 652. 合入芯片平台驱动补丁 66 67 以Hi3516DV300为例: 68 69 在kernel/linux/build仓中,按照kernel.mk中的芯片组件所对应的patch路径规则及命名规则,将对应的芯片组件patch放到对应路径下: 70 71 ``` 72 DEVICE_PATCH_DIR := $(OHOS_BUILD_HOME)/kernel/linux/patches/${KERNEL_VERSION}/$(DEVICE_NAME)_patch 73 DEVICE_PATCH_FILE := $(DEVICE_PATCH_DIR)/$(DEVICE_NAME).patch 74 ``` 75 763. 修改自己所需要编译的config 77 78 在kernel/linux/build仓中,按照kernel.mk中的芯片组件所对应的patch路径规则及命名规则,将对应的芯片组件config放到对应路径下: 79 80 ``` 81 KERNEL_CONFIG_PATH := $(OHOS_BUILD_HOME)/kernel/linux/config/${KERNEL_VERSION} 82 DEFCONFIG_FILE := $(DEVICE_NAME)_$(BUILD_TYPE)_defconfig 83 ``` 84 85 > **须知:** 86 > 87 >由于OpenHarmony工程的编译构建流程中会拷贝kernel/linux/linux-\*\.\*的代码环境后进行打补丁动作,在使用OpenHarmony的版本级编译命令前,需要kernel/linux/linux-\*\.\*原代码环境。 88 > 89 >根据不同系统工程,编译完成后会在out目录下的kernel目录中生成对应实际编译的内核,基于此目录的内核,进行对应的config修改,将最后生成的\.config文件cp到config仓对应的路径文件里,即可生效。 90 91 92## 构建说明<a name="section19369206113115"></a> 93 94以hi3516dv300开源开发板+ubuntu x86主机开发环境为例 95 96使用工程的全量编译命令,编译生成uImage内核镜像 97 98``` 99./build.sh --product-name Hi3516DV300 # 编译hi3516dv300镜像 100 --build-target build_kernel # 编译hi3516dv300的uImage内核镜像 101 --gn-args linux_kernel_version=\"linux-5.10\" # 编译指定内核版本 102``` 103 104## 相关仓<a name="section27639463106"></a> 105 106<u>kernel\_linux\_patches</u> 107 108