Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

  • A newly installed RHEL/Rocky linux 8 x86_64 or aarch64 machine connected to the internet.
  • NOTE It is suggested that you have at least 1GB of memory on the machine you are using for the build.
  • NOTE Verify that SElinux is disabled.
  • This manual uses the Rocky linux 8 distribution available at the link x86_64 or aarch64.
  • It is assumed that Rocky linux 8 was installed as is, and nothing else was installed on it.

...

  1. First create the directory structure, then get the source from the RPM. Create a .rpmmacros file to install the kernel source in our user directory:

    Code Block
    languagebash
    themeEclipse
    cd $HOME && mkdir -p kernel/rpmbuild/{BUILD,RPMS,SOURCES,SPECS,SRPMS}
    cd kernel && echo '%_topdir %(echo $HOME)/kernel/rpmbuild' > ~/.rpmmacros
  2. Install the kernel source:

    Code Block
    languagebash
    themeEclipse
    rpm -ivh https://downloaddl.rockylinux.org/pubvault/rocky/8.7/BaseOS/source/tree/Packages/k/kernel-4.18.0-425.19.2.el8_7.src.rpm
  3. Prepare the source using rpmbuild:

    Code Block
    languagebash
    themeEclipse
    cd ~/kernel/rpmbuild && rpmbuild -bp --target=`uname -m` ./SPECS/kernel.spec
  4. Copy the kernel config file into lustre tree:

    Code Block
    languagebash
    themeEclipse
    cp ~/kernel/rpmbuild/BUILD/kernel-4.18.0-425.19.2.el8_7/linux-4.18.0-425.19.2.el8.`uname -m`/configs/kernel-4.18.0-`uname -m`.config ~/lustre-release/lustre/kernel_patches/kernel_configs/kernel-4.18.0-4.18-rhel8.7-`uname -m`.config
  5. Edit the kernel config file ~/lustre-release/lustre/kernel_patches/kernel_configs/kernel-4.18.0-4.18-rhel8.7-`uname -m`.config::

    Find the line with '# IO Schedulers' and insert following two lines below it:

    CONFIG_IOSCHED_DEADLINE=y
    CONFIG_DEFAULT_IOSCHED="deadline"

    Or use cmd:

    Code Block
    languagebash
    themeEclipse
    sed -i '/# IO Schedulers/a CONFIG_IOSCHED_DEADLINE=y\nCONFIG_DEFAULT_IOSCHED="deadline"' ~/lustre-release/lustre/kernel_patches/kernel_configs/kernel-4.18.0-4.18-rhel8.7-`uname -m`.config
  6. Gather all the patches from lustre tree into a single file:

    Code Block
    enableddltrue
    languagebash
    themeEclipse
    langBash
    globaltitle7. Copy the kernel patch into RPM build tree:
    cd ~/lustre-release/lustre/kernel_patches/series && \
    for patch in $(<"4.18-rhel8.7.series"); do \
         patch_file="$HOME/lustre-release/lustre/kernel_patches/patches/${patch}"; \
         cat "${patch_file}" >> "$HOME/lustre-kernel-`uname -m`-lustre.patch"; \
    done
  7. Copy the kernel patch into RPM build tree:

    Code Block
    languagebash
    themeEclipse
    cp ~/lustre-kernel-`uname -m`-lustre.patch ~/kernel/rpmbuild/SOURCES/patch-4.18.0-lustre.patch
  8. Edit the kernel spec file ~/kernel/rpmbuild/SPECS/kernel.spec:

    Code Block
    languagebash
    themeEclipse
    sed -i.inst -e '/^    find $RPM_BUILD_ROOT\/lib\/modules\/$KernelVer/a\
        cp -a fs/ext4/* $RPM_BUILD_ROOT/lib/modules/$KernelVer/build/fs/ext4\
        rm -f $RPM_BUILD_ROOT/lib/modules/$KernelVer/build/fs/ext4/ext4-inode-test*' \
    -e '/^# empty final patch to facilitate testing of kernel patches/i\
    Patch99995: patch-%{version}-lustre.patch' \
    -e '/^ApplyOptionalPatch linux-kernel-test.patch/i\
    ApplyOptionalPatch patch-%{version}-lustre.patch' \
    ~/kernel/rpmbuild/SPECS/kernel.spec
  9. Overwrite the kernel config file with ~/lustre-release/lustre/kernel_patches/kernel_configs/kernel-4.18.0-4.18-rhel8.7-`uname -m`.config. Change x86_64 with arm64 in the first command for aarch64 architecture.

    Code Block
    languagebash
    themeEclipse
    echo '# x86_64' > ~/kernel/rpmbuild/SOURCES/kernel-4.18.0-x86_64.config
    cat ~/lustre-release/lustre/kernel_patches/kernel_configs/kernel-4.18.0-4.18-rhel8.7-`uname -m`.config >> ~/kernel/rpmbuild/SOURCES/kernel-4.18.0-`uname -m`.config
  10. Start building the kernel with rpmbuild:

    Code Block
    languagebash
    themeEclipse
    cd ~/kernel/rpmbuild && buildid="_lustre" && \
    rpmbuild -ba --with firmware --target `uname -m` --with baseonly \
               --without kabichk --define "buildid ${buildid}" \
               ~/kernel/rpmbuild/SPECS/kernel.spec
  11. Install the kernel packages:

    Code Block
    languagebash
    themeEclipse
    cd ~/kernel/rpmbuild/RPMS/`uname -m`/
    sudo rpm -Uvh --replacepkgs --force kernel-*.rpm
    sudo reboot
  12. Login system after reboot, run name -r and see:

    # uname -r
    4.18.0-425.19.2.el8_lustre.x86_64

    or

    4.18.0-425.19.2.el8_lustre.aarch64

...