Skip to content

Stock kernel

Contributing to the CentOS Stream / Red Hat Enterprise Linux kernel

It may be necessary to contribute to the upstream RHEL kernel sources as part of enabling capabilities in CentOS Stream for Hyperscale usage. For situations like this, this guide documents how to contribute to the RHEL kernel. A benefit in doing so is that this allows us to leverage the testing and maintenance by the RHEL kernel team and share efforts with the broader CentOS community that also contribute to the kernel.

The kernel for CentOS Stream/RHEL 9 is hosted at redhat/centos-stream/src/kernel/centos-stream-9, which is the GitLab repo where the RHEL kernel is developed and maintained.

This guide follows the practices documented by the RHEL kernel team.

Contributing to the RHEL 9 and RHEL 10 kernel sources

  • Get a Fedora account if you don't have one already.
    • Make sure to follow this part and set up your ~/.fedora.upn to tell our tooling your FAS username if it differs from your Unix name.
  • Get a GitLab.com account if you don't have one already.
    • Make sure your display name matches your actual name used in Git commits.
    • Make sure the email address you use for Git commits is attached to your GitLab.com account.
  • Set your GitLab.com account username in your Fedora account.
  • Set your Red Hat Bugzilla account and make sure your Fedora account email address matches your Bugzilla account email address.
  • Install git-backport into ~/.local/bin.
  • Fork redhat/centos-stream/src/kernel/centos-stream-9.
  • In your local clone of your fork, add redhat/centos-stream/src/kernel/centos-stream-9 as a remote by the name upstream.
  • In your local clone of your fork, add torvalds/linux as a remote by the name mainline.
  • Run git fetch --all to fetch all the refs from all the remotes.
  • Create a new branch based on upstream/main for the patches to be applied: git checkout --no-track -b <branchname> upstream/main
  • Generate a list of commits to backport and save it to a file to use with git-backport.
    • For example, for backporting zstd from v5.16, do: git log --pretty=oneline v5.14..v5.16 lib/zstd | tac > git-backport-zstd-v5.16-patchset
  • Create a bug for the RHEL kernel for your backport.
  • Use git-backport to generate the patch set to apply as commits: git-backport -a -j <RHJIRA> -d $PWD/backport-stage-diffs/ -f <git-backport-file>
  • Use git am to apply the patch set: git am $PWD/backport-stage-diffs/
  • Push your branch to your fork on GitLab.com
  • Open a merge request (MR) against redhat/centos-stream/src/kernel/centos-stream-9 with your change.

Contributing to the RHEL 8 kernel sources

The same contribution process applies to the RHEL 8 kernel, with a few differences:

  • you will want to fork redhat/centos-stream/src/kernel/centos-stream-8 and use it as your upstream
  • you will want to file a bug against the kernel component for RHEL 8
  • to build the kernel locally, the easiest way is to use Packit
    • run packit srpm to generate a source RPM
    • run mock -r centos-stream-8-x86_64 /path/to/the/src.rpm to build the kernel from the generated source RPM

Note that changes contributed to the stock RHEL kernel do not directly impact Hyperscale images, as they use our own kernel. They are however relevant for packages built in our main repository, as those are designed to run on a stock system.