Compiling and Installing the Kernel
The operations vary according to the OS. Unless otherwise specified, the operations are the same on the two OSs.
CentOS 7.6
- Create a directory and go to the directory.
1 2
mkdir -p /home/kernel-bcache cd /home/kernel-bcache
- Obtain the kernel source code.
- Run the following command to check the kernel version:
1uname -aThe queried kernel version is as follows:
Linux ceph3 4.14.0-115.el7a.0.1.aarch64 #1 SMP Sun Nov 25 20:54:21 UTC 2018 aarch64 aarch64 aarch64 GNU/Linux
- Download the kernel source package of the matching version to the /home/kernel-bcache directory.
Package:

- Decompress the source package.
1 2
rpm2cpio kernel-alt-4.14.0-115.10.1.el7a.src.rpm | cpio -divm tar -xvf linux-4.14.0-115.10.1.el7a.tar.xz
- Run the following command to check the kernel version:
- Install the dependencies.
1yum -y install rpm-build m4 gcc xmlto asciidoc openssl-devel hmaccalc python-devel newt-devel perl-ExtUtils-Embed elfutils-devel zlib-devel binutils-devel bison audit-libs-devel java-devel numactl-devel pciutils-devel ncurses-devel createrepo genisoimage net-tools git bc
- Replace the bcache module.
- Obtain the kernel configuration file.
1 2
cd /home/kernel-bcache/linux-4.14.0-115.10.1.el7a cp ../kernel-alt-4.14.0-aarch64.config .config
- Configure the bcache module.
1make menuconfig- Choose .

- Press Enter to access the next-level menu, and then choose .

- Press Enter to access the next-level menu, choose , and press M to select the configuration.

- Click Exit twice to return to the first-level menu.

- Choose .
- Change the kernel page size to 4KB.
- Choose .

- Press Enter to access the next-level menu, and choose .

- Press Enter to access the next-level menu, and press the space button to choose 4KB.

- Click Exit twice to save the setting and exit.


- Choose .
- Modify the configuration file.
- Open the following file:
1vi .config - Find the CONFIG_BCACHE field in the configuration file. If the value is CONFIG_BCACHE=m, the bcache module is enabled.

- Find the CONFIG_ARM64_4K_PAGES field in the configuration file. If the value is CONFIG_ARM64_4K_PAGES=y, the page size is 4 KB.

- Type :wq! and press Enter to save and exit the file.
- Open the following file:
- Overwrite the default configuration file with the configuration file modified in step 8.
1cp .config ../kernel-alt-4.14.0-aarch64.config
- Type y.
- Run the following commands to generate an RPM package. After that, the RPM package is generated in /root/rpmbuild/RPMS/aarch64/.
1 2
make binrpm-pkg -j48 make rpm-pkg -j
- Upload the kernel RPM package generated in step 11 to the /home/kernel-rpm directory of each server that requires the smart write cache service.
1 2
mkdir -p /home/kernel-rpm cp /root/rpmbuild/RPMS/aarch64/* /home/kernel-rpm
- Install the kernel RPM package.
1 2
cd /home/kernel-rpm yum -y install kernel-4.14.0-1.aarch64.rpm kernel-devel-4.14.0-1.aarch64.rpm kernel-headers-4.14.0-1.aarch64.rpm
- Check the versions of all kernels installed in the system.
1cat /etc/grub2-efi.cfg | grep CentOS

- Check the default kernel startup item.
1grub2-editenv list - Modify the default kernel startup item. In the command, CentOS Linux (4.14.0-115.10.1.el7a.aarch64) 7 (AltArch) indicates the version of the newly installed kernel.
grub2-set-default "CentOS Linux (4.14.0-115.10.1.el7a.aarch64) 7 (AltArch)"
- Reboot the system.
1reboot
openEuler 20.03
- Create a directory and go to the directory.
1 2
mkdir -p /home/kernel-bcache cd /home/kernel-bcache
- Obtain the kernel source code.
- Check the system kernel version.
1uname -aThe queried kernel version is as follows:
Linux localhost.localdomain 4.19.90-2109.1.0.0108.oe1.aarch64 #1 SMP Mon Sep 6 03:51:48 UTC 2021 aarch64 aarch64 aarch64 GNU/Linux
- Download the kernel source package of the matching version to the /home/kernel-bcache directory.

- Decompress the source package.
1 2
rpm2cpio kernel-4.19.90-2109.1.0.0108.oe1.src.rpm | cpio -divm tar -zxvf kernel.tar.gz
- Check the system kernel version.
- Configure the image source.
- Use the SFTP tool to upload the openEuler-***-everything-aarch64-dvd.iso image source file of the corresponding OS to the /root directory on the server.
- Create a local directory to mount the image.
In this example, an iso directory is created in the root directory for mounting the local image.
1mkdir -p /iso
- Mount the ISO file to the local directory.
1mount /root/openEuler-***-everything-aarch64-dvd.iso /iso
- Create a Yum source for the image and configure the source.
- Create a .repo file.
1vi /etc/yum.repos.d/openEuler.repo - Press i to enter the insert mode and add the following content to the file to mount the Yum source:
1 2 3 4 5 6
[Base] name=Base baseurl=file:///iso enabled=1 gpgcheck=0 priority=1
- Add the following content to configure the openEuler network source:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32
[openEuler-source] name=openEuler-source baseurl=http://repo.openeuler.org/openEuler-20.03-LTS/source/ enabled=1 gpgcheck=1 gpgkey=http://repo.openeuler.org/openEuler-20.03-LTS/source/RPM-GPG-KEY-openEuler [openEuler-os] name=openEuler-os baseurl=http://repo.openeuler.org/openEuler-20.03-LTS/OS/aarch64/ enabled=0 gpgcheck=1 gpgkey=http://repo.openeuler.org/openEuler-20.03-LTS/OS/aarch64/RPM-GPG-KEY-openEuler [openEuler-everything] name=openEuler-everything baseurl=http://repo.openeuler.org/openEuler-20.03-LTS/everything/aarch64/ enabled=0 gpgcheck=1 gpgkey=http://repo.openeuler.org/openEuler-20.03-LTS/everything/aarch64/RPM-GPG-KEY-openEuler [openEuler-EPOL] name=openEuler-epol baseurl=http://repo.openeuler.org/openEuler-20.03-LTS/EPOL/aarch64/ enabled=1 gpgcheck=0 [openEuler-update] name=openEuler-update baseurl=http://repo.openeuler.org/openEuler-20.03-LTS/update/aarch64/ enabled=1 gpgcheck=0
- Press Esc to exit the insert mode. Type :wq! and press Enter to save and exit the file.
- Create a .repo file.
- Install the dependencies.
1dnf -y install ncurses-devel bison m4 flex rpm-build rpmdevtools asciidoc audit-libs-devel binutils-devel elfutils-devel elfutils-libelf-devel gtk2-devel java-1.8.0-openjdk-devel xz-devel libbabeltrace-devel libunwind-devel newt-devel numactl-devel openssl-devel pciutils-devel perl-generators python3-devel python3-docutils xmlto zlib-devel createrepo genisoimage
- Replace the bcache module.
- Obtain the kernel configuration file.
1 2
cd /home/kernel-bcache/kernel cp arch/arm64/configs/openeuler_defconfig .config
- Configure the bcache module.
1make menuconfig- Choose .

- Press Enter to access the next-level menu, and then choose .

- Press Enter to access the next-level menu, choose , and press M to select the configuration.

- Click Exit twice to return to the first-level menu.

- Choose .
- Change the kernel page size to 4KB.
- Choose .

- Press Enter to access the next-level menu, and choose .

- Press Enter to access the next-level menu, and press the space button to choose 4KB.

- Click Exit twice to save the setting and exit.


- Choose .
- Verify the configuration file.
- Open the following file:
1vi .config - Find the CONFIG_BCACHE field in the configuration file. If the value is CONFIG_BCACHE=m, the bcache module is enabled.

- Find the CONFIG_ARM64_4K_PAGES field in the configuration file. If the value is CONFIG_ARM64_4K_PAGES=y, the page size is 4 KB.

- Press Esc, type :wq!, and press Enter to exit the file.
- Open the following file:
- Overwrite the default configuration file.
1cp .config arch/arm64/configs/openeuler_defconfig
- Type y.
- Run the following commands to generate an RPM package in the /root/rpmbuild/RPMS/aarch64/ directory:
yum install bc -y make binrpm-pkg -j48 make rpm-pkg -j48
- Upload the kernel RPM package generated in step 12 to the /home/kernel-rpm directory of each server that requires the smart write cache service.
1 2
mkdir -p /home/kernel-rpm cp /root/rpmbuild/RPMS/aarch64/* /home/kernel-rpm
- Install the kernel RPM package.
1 2
cd /home/kernel-rpm dnf -y install kernel-*.rpm
- Check the default kernel startup item.
1grub2-editenv listCheck the default kernel version.
- Modify the default kernel startup item.
1cat /etc/grub2-efi.cfg | grep openEuler

In the preceding figure, openEuler (4.19.90-2109.1.0.0108.oe1.aarch64) 20.03 (LTS-SP1) indicates the newly installed kernel version.
grub2-set-default "openEuler (4.19.90-2109.1.0.0108.oe1.aarch64) 20.03 (LTS-SP1)"
- Reboot the system.
1reboot
Parent topic: Installing the Bcache