Applying Lustre Patches into the Kernel
Preparing the Kernel Source Code
- Create a directory structure.
1 2 3 4
$ cd $HOME $ mkdir -p kernel/rpmbuild/{BUILD,RPMS,SOURCES,SPECS,SRPMS} $ cd kernel $ echo '%_topdir %(echo $HOME)/kernel/rpmbuild' > ~/.rpmmacros
- Install the kernel source code.
1$ rpm -ivh https://vault.centos.org/8.0.1905/BaseOS/Source/SPackages/kernel-4.18.0-80.11.2.el8_0.src.rpm
- Run the rpmbuild command to prepare the kernel source code.
1 2
$ cd ~/kernel/rpmbuild $ rpmbuild -bp --target=`uname -m` ./SPECS/kernel.spec
The command output is as follows:
1 2 3 4 5 6 7
... Processed config files are in /home/build/kernel/rpmbuild/BUILD/kernel-4.18.0-80.11.2.el8_0/linux-4.18.0-80.11.2.el8.aarch64/configs + cd .. + find . '(' -name '*.orig' -o -name '*~' ')' -exec rm -f '{}' ';' + find . -name .gitignore -exec rm -f '{}' ';' + cd .. + exit 0
- Copy the kernel file to the Lustre tree.
1cp ~/kernel/rpmbuild/BUILD/kernel-4.18.0-80.11.2.el8_0/linux-4.18.0-80.11.2.el8.aarch64/configs/kernel-4.18.0-aarch64.config ~/lustre-release/lustre/kernel_patches/kernel_configs/kernel-4.18.0-4.18-rhel8-aarch64.config
- Edit the kernel file.
1vim ~/lustre-release/lustre/kernel_patches/kernel_configs/kernel-4.18.0-4.18-rhel8-aarch64.config
Find "# IO Schedulers" and insert the following content below it:
1 2
CONFIG_IOSCHED_DEADLINE=y CONFIG_DEFAULT_IOSCHED="deadline"
Applying Lustre Patches
- Integrate all patches into one file.
1 2 3 4 5 6 7
$ cd ~ $ rm -f ~/lustre-kernel-aarch64-lustre.patch #Note: This command is unnecessary if this patch does not exist. $ cd ~/lustre-release/lustre/kernel_patches/series $ for patch in $(<"4.18-rhel8.series"); do \ patch_file="$HOME/lustre-release/lustre/kernel_patches/patches/${patch}"; \ cat "${patch_file}" >> "$HOME/lustre-kernel-aarch64-lustre.patch"; \ done
- Copy the kernel patch build tree.
1cp ~/lustre-kernel-aarch64-lustre.patch ~/kernel/rpmbuild/SOURCES/patch-4.18.0-lustre.patch
- Edit the ~/kernel/rpmbuild/SPECS/kernel.spec file.
1vim ~/kernel/rpmbuild/SPECS/kernel.spec
- Find "find $RPM_BUILD_ROOT/lib/modules/$KernelVer" and insert the following content below it:
1cp -a fs/ext4/* $RPM_BUILD_ROOT/lib/modules/$KernelVer/build/fs/ext4
- Find "# empty final patch to facilitate testing of kernel patches" and insert the following content below it:
1 2
# adds Lustre patches Patch99995: patch-%{version}-lustre.patch
- Find "ApplyOptionalPatch linux-kernel-test.patch" and insert the following content below it:
1 2
# lustre patch ApplyOptionalPatch patch-%{version}-lustre.patch
- Find "find $RPM_BUILD_ROOT/lib/modules/$KernelVer" and insert the following content below it:
- Overwrite the kernel configuration file ~/lustre-release/lustre/kernel_patches/kernel_configs/kernel-4.18.0-4.18-rhel8-aarch64.config.
1 2
$ echo '# arm64' > ~/kernel/rpmbuild/SOURCES/kernel-4.18.0-aarch64.config $ cat ~/lustre-release/lustre/kernel_patches/kernel_configs/kernel-4.18.0-4.18-rhel8-aarch64.config >> ~/kernel/rpmbuild/SOURCES/kernel-4.18.0-aarch64.config
Creating a Kernel RPM Package
Run the rpmbuild command to build the kernel RPM package.
1 2 3 4 5 | $ cd ~/kernel/rpmbuild $ buildid="_lustre" # Note: change to any string that identify your work $ rpmbuild -ba --with firmware --target aarch64 --with baseonly \ --without kabichk --define "buildid ${buildid}" \ ~/kernel/rpmbuild/SPECS/kernel.spec |
If the build is successful, the following information is displayed:
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 | Checking for unpackaged file(s): /usr/lib/rpm/check-files /home/build/kernel/rpmbuild/BUILDROOT/kernel-4.18.0-80.11.2.el8_lustre.aarch64 Wrote: /home/build/kernel/rpmbuild/SRPMS/kernel-4.18.0-80.11.2.el8_lustre.src.rpm Wrote: /home/build/kernel/rpmbuild/RPMS/aarch64/kernel-4.18.0-80.11.2.el8_lustre.aarch64.rpm Wrote: /home/build/kernel/rpmbuild/RPMS/aarch64/kernel-headers-4.18.0-80.11.2.el8_lustre.aarch64.rpm Wrote: /home/build/kernel/rpmbuild/RPMS/aarch64/kernel-cross-headers-4.18.0-80.11.2.el8_lustre.aarch64.rpm Wrote: /home/build/kernel/rpmbuild/RPMS/aarch64/kernel-debuginfo-common-aarch64-4.18.0-80.11.2.el8_lustre.aarch64.rpm Wrote: /home/build/kernel/rpmbuild/RPMS/aarch64/perf-4.18.0-80.11.2.el8_lustre.aarch64.rpm Wrote: /home/build/kernel/rpmbuild/RPMS/aarch64/perf-debuginfo-4.18.0-80.11.2.el8_lustre.aarch64.rpm Wrote: /home/build/kernel/rpmbuild/RPMS/aarch64/python3-perf-4.18.0-80.11.2.el8_lustre.aarch64.rpm Wrote: /home/build/kernel/rpmbuild/RPMS/aarch64/python3-perf-debuginfo-4.18.0-80.11.2.el8_lustre.aarch64.rpm Wrote: /home/build/kernel/rpmbuild/RPMS/aarch64/kernel-tools-4.18.0-80.11.2.el8_lustre.aarch64.rpm Wrote: /home/build/kernel/rpmbuild/RPMS/aarch64/kernel-tools-libs-4.18.0-80.11.2.el8_lustre.aarch64.rpm Wrote: /home/build/kernel/rpmbuild/RPMS/aarch64/kernel-tools-libs-devel-4.18.0-80.11.2.el8_lustre.aarch64.rpm Wrote: /home/build/kernel/rpmbuild/RPMS/aarch64/kernel-tools-debuginfo-4.18.0-80.11.2.el8_lustre.aarch64.rpm Wrote: /home/build/kernel/rpmbuild/RPMS/aarch64/bpftool-4.18.0-80.11.2.el8_lustre.aarch64.rpm Wrote: /home/build/kernel/rpmbuild/RPMS/aarch64/bpftool-debuginfo-4.18.0-80.11.2.el8_lustre.aarch64.rpm Wrote: /home/build/kernel/rpmbuild/RPMS/aarch64/kernel-core-4.18.0-80.11.2.el8_lustre.aarch64.rpm Wrote: /home/build/kernel/rpmbuild/RPMS/aarch64/kernel-devel-4.18.0-80.11.2.el8_lustre.aarch64.rpm Wrote: /home/build/kernel/rpmbuild/RPMS/aarch64/kernel-modules-4.18.0-80.11.2.el8_lustre.aarch64.rpm Wrote: /home/build/kernel/rpmbuild/RPMS/aarch64/kernel-modules-extra-4.18.0-80.11.2.el8_lustre.aarch64.rpm Wrote: /home/build/kernel/rpmbuild/RPMS/aarch64/kernel-debuginfo-4.18.0-80.11.2.el8_lustre.aarch64.rpm Executing(%clean): /bin/sh -e /var/tmp/rpm-tmp.SqV3vr + umask 022 + cd /home/build/kernel/rpmbuild/BUILD + cd kernel-4.18.0-80.11.2.el8_0 + rm -rf /home/build/kernel/rpmbuild/BUILDROOT/kernel-4.18.0-80.11.2.el8_lustre.aarch64 + exit 0 |
Installing the Kernel
- Switch to the root user and install the kernel RPM package.
1 2 3
$ su root # cd ~/kernel/rpmbuild/RPMS/aarch64/ # rpm -Uvh kernel-core-4.18.0-80.11.2.el8_lustre.aarch64.rpm kernel-headers-4.18.0-80.11.2.el8_lustre.aarch64.rpm kernel-modules-4.18.0-80.11.2.el8_lustre.aarch64.rpm kernel-modules-extra-4.18.0-80.11.2.el8_lustre.aarch64.rpm kernel-4.18.0-80.11.2.el8_lustre.aarch64.rpm kernel-devel-4.18.0-80.11.2.el8_lustre.aarch64.rpm kernel-tools-4.18.0-80.11.2.el8_lustre.aarch64.rpm kernel-tools-libs-4.18.0-80.11.2.el8_lustre.aarch64.rpm
- Reboot the system.
1# reboot - View the kernel version.
1# uname -r14.18.0-80.11.2.el8_lustre.aarch64
Parent topic: Installing the Lustre Server