Compiling the Kernel
The operations vary according to the OS. Unless otherwise specified, the operations are the same in 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.
- 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
- 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.
- Overwrite the default configuration file.
1cp .config ../kernel-alt-4.14.0-aarch64.config
Type y.
- Obtain the bcache patch and replace the source code.
- Download the patch package.
https://mirrors.huaweicloud.com/kunpeng/archive/kunpeng_solution/storage/Patch/

- Copy the patch package to the /home directory and decompress it.
1 2 3
cd /home mkdir -p /home/bcache_patch tar -zxvf bcache_patch.tar.gz -C /home/bcache_patch
- Replace the bcache source code.
1/bin/cp /home/bcache_patch/* /home/kernel-bcache/linux-4.14.0-115.10.1.el7a/drivers/md/bcache
- Download the patch package.
- Run the following commands to generate an RPM package in /root/rpmbuild/RPMS/aarch64/:
make binrpm-pkg -j48 make rpm-pkg
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.
- Configure the image source.
- Upload the everything image file corresponding to the OS to the server.
Use an SFTP tool to upload the openEuler-***-everything-aarch64-dvd.iso package to the /root directory on the server.
- Create a local directory to mount the image.
1mkdir -p /iso
This section uses the creation of the iso folder in the root directory as an example.
- 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.
1vim /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.
- Upload the everything image file corresponding to the OS to the server.
- 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 mkeuleros createrepo genisoimage
- 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.
- Overwrite the default configuration file.
1cp .config arch/arm64/configs/openeuler_defconfig
Type y.
- Run the following commands to generate an RPM package in /root/rpmbuild/RPMS/aarch64/:
make binrpm-pkg -j48 make rpm-pkg
Parent topic: Bcache User Guide






