未验证 提交 ddb98e87 编写于 作者: O openharmony_ci 提交者: Gitee

!12820 [翻译完成】#I5XQNE

Merge pull request !12820 from Annie_wang/PR11010
......@@ -9,8 +9,8 @@ The following uses the Hi3516D V300 board and Ubuntu x86 server as an example.
Perform a full build for the project to generate the **uImage** kernel image.
```
./build.sh --product-name hispark_taurus_standard # Build the hispark_taurus_standard image.
--build-target build_kernel # Build the uImage kernel image of hispark_taurus_standard.
--gn-args linux_kernel_version=\"linux-5.10\" # Specify the kernel version.
```bash
./build.sh --product-name hispark_taurus_standard # Build the hispark_taurus_standard image.
--build-target build_kernel # Build the uImage kernel image of hispark_taurus_standard.
--gn-args linux_kernel_version=\"linux-5.10\" # Specify the kernel version.
```
# Linux Kernel Overview
The standard-system devices come with application processors and memory greater than 128 MiB. OpenHarmony uses the Linux kernel as the base kernel so that appropriate OS kernels can be provided for devices with different resource limitations.
OpenHarmony adopts the Linux kernel as the basic kernel for standard-system devices \(reference memory ≥ 128 MiB\) so that appropriate OS kernels can be selected for the devices subject to resource limitations and therefore provide basic capabilities for upper-layer apps.
## Linux Kernel Versions
Linux kernel versions are classified into the stable version and long-term support \(LTS\) version.
- Linux kernel versions are classified into the stable version and long-term support (LTS) version.
The stable version is released approximately every 3 months to support the latest hardware, improve performance, and fix bugs. Its disadvantage is that the overall maintenance lifespan is short, making long-term stable support unavailable for software.
- The stable version is released approximately every 3 months to support the latest hardware, improve performance, and fix bugs. Its disadvantage is that the overall maintenance lifespan is short, making long-term stable support unavailable for software.
The LTS version provides long-term kernel maintenance \(in fixing bugs and security vulnerabilities\). Generally, the maintenance lifespan is six years. By contrast, non-LTS kernel versions whose maintenance lifespan ranges from six months to two years cannot cover the entire lifespan of their products and may leave the products open to security vulnerabilities. In addition, new features are not added in the LTS version update, which ensures the version stability. Therefore, LTS versions are more suitable for commercial products that pursue stability and security.
## OpenHarmony Kernel Version Selection
- The LTS version provides long-term kernel maintenance (in fixing bugs and security vulnerabilities). Generally, the maintenance lifespan is six years. By contrast, non-LTS kernel versions whose maintenance lifespan ranges from six months to two years cannot cover the entire lifespan of their products and may leave the products open to security vulnerabilities. In addition, new features are not added in the LTS version update, which ensures the version stability. Therefore, LTS versions are more suitable for commercial products that pursue stability and security.
The Linux kernel in OpenHarmony selects appropriate LTS versions as its basic versions. Currently, it supports Linux-4.19 and Linux-5.10.
## OpenHarmony Kernel Versions
OpenHarmony uses Linux LTS versions as its base kernel. Currently, it supports Linux-4.19 and Linux-5.10.
# Applying Patches on Development Boards
1. Apply the HDF patches.
Apply the HDF patches based on the kernel version in the **kernel/linux/build** repository. For details, see the method for applying the HDF patch in **kernel.mk**.
```
$(OHOS_BUILD_HOME)/drivers/hdf_core/adapter/khdf/linux/patch_hdf.sh $(OHOS_BUILD_HOME) $(KERNEL_SRC_TMP_PATH) $(KERNEL_PATCH_PATH) $(DEVICE_NAME)
```
2. Apply the chip driver patches.
The following uses Hi3516D V300 as an example:
In the **kernel/linux/build** repository, place the chip module patches in the corresponding path based on the patch path and naming rules for the chip module in **kernel.mk**.
```
DEVICE_PATCH_DIR := $(OHOS_BUILD_HOME)/kernel/linux/patches/${KERNEL_VERSION}/$(DEVICE_NAME)_patch
DEVICE_PATCH_FILE := $(DEVICE_PATCH_DIR)/$(DEVICE_NAME).patch
```
```
```
3. Modify the **config** file to be built.
In the **kernel/linux/build** repository, place the chip module **config** file in the corresponding path based on the file path and naming rules for the chip module in **kernel.mk**.
```
KERNEL_CONFIG_PATH := $(OHOS_BUILD_HOME)/kernel/linux/config/${KERNEL_VERSION}
DEFCONFIG_FILE := $(DEVICE_NAME)_$(BUILD_TYPE)_defconfig
```
>![](../public_sys-resources/icon-notice.gif) **NOTICE**<br/>
>In the OpenHarmony project build process, patches are applied after the code environment of **kernel/linux/linux-\*.\*** is copied. Before running the OpenHarmony version-level build command, ensure that the source code environment of **kernel/linux/linux-\*.\*** is available.
>After the build is complete, the kernel is generated in the kernel directory in the **out** directory. Modify the **config** file based on the kernel generated, and copy the generated **.config** file to the corresponding path in the **config** repository. Then, the configuration takes effect.
1. Apply HDF patches.
Apply the HDF patches based on the kernel version. For details, see [kernel.mk](https://gitee.com/openharmony/kernel_linux_build/blob/master/kernel.mk).
```makefile
$(OHOS_BUILD_HOME)/drivers/hdf_core/adapter/khdf/linux/patch_hdf.sh $(OHOS_BUILD_HOME) $(KERNEL_SRC_TMP_PATH) $(KERNEL_PATCH_PATH) $(DEVICE_NAME)
```
2. Apply the chip driver patch. The following uses Hi3516D V300 as an example.
Place the chip component patches in the related directory. For details about the patch directory and naming rules, see [kernel.mk](https://gitee.com/openharmony/kernel_linux_build/blob/master/kernel.mk).
```makefile
DEVICE_PATCH_DIR := $(OHOS_BUILD_HOME)/kernel/linux/patches/${KERNEL_VERSION}/$(DEVICE_NAME)_patch
DEVICE_PATCH_FILE := $(DEVICE_PATCH_DIR)/$(DEVICE_NAME).patch
```
3. Modify the **config** file to build.
Place the chip component **config** in the related directory. For details about the patch directory and naming rules, see [kernel.mk](https://gitee.com/openharmony/kernel_linux_build/blob/master/kernel.mk).
```makefile
KERNEL_CONFIG_PATH := $(OHOS_BUILD_HOME)/kernel/linux/config/${KERNEL_VERSION}
DEFCONFIG_FILE := $(DEVICE_NAME)_$(BUILD_TYPE)_defconfig
```
> **NOTICE**<br>
> 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.
>
> After the build is complete, the kernel is generated in the kernel directory in the **out** directory. Modify the **config** file for the target platform based on the kernel generated, and copy the generated **.config** file to the corresponding path of the platform in the **config** repository. Then, the configuration takes effect.
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册