Build a fedora kernel: Updated

The primary source of information on building a custom kernel in fedora is here. This post will step you through that with an additional step to add the patches you may need.

Get the source

First, where-ever you feel like, clone the kernel packaging source, for example:

cd ~ && mkdir projects && cd ~/projects
fedpkg clone -a kernel

Then cd in to the new directory and checkout the required branch matching the fedora release number you need:

cd ~/projects/kernel
git checkout origin/f36

To save work with git (not a compulsory step, but will help with updating), do:

git checkout -b patch-f36
git branch -u origin/f36

Prepare for build

Install deps


sudo dnf install fedpkg fedora-packager rpmdevtools ncurses-devel pesign grubby
sudo dnf builddep kernel.spec

Edit kernel.spec

In kernel.spec is where you will do most of the work, so open up that file in your favourite text editor which is vim and search for this line:

# define buildid .local

and replace it with:

%define buildid .local

then a few hundred or so lines further down the file you will find a block like this:

%if !%{nopatches}

Patch1: patch-%{patchversion}-redhat.patch

This is where you will need to add patches, an example is adding the asus-hid driver patch required for ASUS laptops with the 0x1866 device (N-Key Keyboard). So below the line above add:

%if !%{nopatches}

Patch1: patch-%{patchversion}-redhat.patch

# ROG Laptops
Patch500: 0001-WMI-asus-Reduce-G14-and-G15-match-to-min-product-nam.patch
Patch501: 0001-HID-asus-Filter-keyboard-EC-for-old-ROG-keyboard.patch
Patch502: 0001-HID-asus-Add-support-for-2021-ASUS-N-Key-keyboard.patch

and lastly, the patches must be in the same directory as kernel.spec

You need to also add them before the # END OF PATCH APPLICATIONS line in the existing block like-so:

%if !%{nopatches}

ApplyOptionalPatch patch-%{patchversion}-redhat.patch

ApplyOptionalPatch 0001-WMI-asus-Reduce-G14-and-G15-match-to-min-product-nam.patch
ApplyOptionalPatch 0001-HID-asus-Filter-keyboard-EC-for-old-ROG-keyboard.patch
ApplyOptionalPatch 0001-HID-asus-Add-support-for-2021-ASUS-N-Key-keyboard.patch

and then build using fedpkg --release f36 local --without debug --without debuginfo --with release (remember to replace f36 with the branch you checked out).

To customize a kernel, edit kernel-local for example:

If building from a third-party repo you may require --name kernel --namespace rpms (after fedpkg).

# This file is intentionally left empty in the stock kernel. Its a nicety
# added for those wanting to do custom rebuilds with altered config opts.


All the rpm packages will be located in ~/projects/kernel/x86_64/, it's likely that you will need to install all except the debug packages.


If you have any work to save, git commit it, or git stash.

git pull

then git stash pop if you stashed work.

Legal Matters

ASUS and ROG Trademark is either a US registered trademark or trademark of ASUSTeK Computer Inc. in the United States and/or other countries.

Reference to any ASUS products, services, processes, or other information and/or use of ASUS Trademarks does not constitute or imply endorsement, sponsorship, or recommendation thereof by ASUS.

The use of ROG and ASUS trademarks within this website and associated tools and libraries is only to provide a recognisable identifier to users to enable them to associate that these tools will work with ASUS ROG laptops.

Privacy Policy

We use Matomo

Matomo is an open source web analytics platform. A web analytics platform is used by a website owner in order to measure, collect, analyse and report visitor data for purposes of understanding and optimizing their website.

Purpose of the processing

Matomo is used to get an idea how our website is used by our users so we can optimize things further so that the user may find the most relevant information more quickly.

Data Matomo is processing

  • User IP address
  • Optional User ID
  • Date and time of the request
  • Title of the page being viewed
  • URL of the page being viewed
  • Referrer URL
  • Screen resolution being used
  • Time in local user’s timezone
  • Files that were clicked and downloaded
  • Links to an outside domain that were clicked
  • Page generation time
  • User location: country, region, city, approximate latitude and longitude
  • Main Language of the browser being used
  • User Agent of the browser being used

Pick up the one you are using:

  • Cookies
  • IP address
  • User ID
  • Custom Dimensions
  • Custom Variables
  • Location of the user

And also:

  • Date and time
  • Title of the page being viewed
  • URL of the page being viewed
  • URL of the page that was viewed prior to the current page
  • Screen resolution
  • Time in local timezone
  • Files that were clicked and downloaded
  • Link clicks to an outside domain
  • Pages generation time
  • Country, region, city
  • Main Language of the browser
  • User Agent of the browser

This list can be completed with additional features such as:

  • Form interactions
  • Media interactions
  • A/B Tests

The processing of personal data with Matomo is based on legitimate interests

If you wish us to not process any personal data with Matomo, you can opt-out from it at any time. There will be no consequences at all regarding the use of our website.

You can withdraw at any time your consent by clicking here

The right to lodge a complaint with a supervisory authority

If you think that the way we process your personal data with Matomo analytics is infringing the law, you have the right to lodge a complaint with a supervisory authority.

We are not doing any profiling.