Skip to content

whitehara/kernel-patch-fedora

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Linux kernel patches (compilable with the fedora kernel)

Latest Build Status

Copr Project Name Copr Build Status
kernel-tkg Status
kernel-tkg-preempt Status
kernel-tkg-zen2 Status
kernel-tkg-zen2-preempt Status
kernel-tkg-icelake-preempt Status
kernel-tkg-alderlake-preempt Status
kernel-tkg-ivybridge-pds Status Not supported since 6.6

Overview

How to install patched kernel RPM

Quick start.

sudo dnf copr whitehara/kernel-tkg
sudo dnf install kernel-6.4.14-200_tkg.fc38

See Copr for details.

If you want to try other custom kernels, you may also check my other projects.

Files in the kernel-local folder are used in these custom kernel projects.

Tested version (Newest versions only)

BEWARE: "tested" means just "compilable", it does not mean "It completely works for your environment". Please use it at your own risk.

How to build your custom kernel

There are 2 ways. One is build with the script in "build-script" dir, another is without the script.

Build with the script

In build-script dir, you see "kernel-mock.sh". This script is used for building my projects, you can use and modify as you like.

Preparation

  • Install mock, copr-cli, koji.

    dnf install mock copr-cli koji
    
  • Modify "support-vers". It contains Original fedora project kernel versions for building. If you want to build new versions, you need to add it to this file.

  • Modify "support-features". It contains Project ID for copr, Custom tag for the package name, Features like bmq,pds,cpu-arch which are used in spec-mod.sh

Each features are built with all versions. E.g. If you have 3 features and 2 versions, Results wll be 3 projects and each projects have 2 versions.

If you want to add CPU-arch, you also need to add kernel-local.CPU-arch files.

Run script

In build-script dir, you can run like below:

 ./kernel-mock.sh

It builds rpms on your local machine's mock environment, then copy results from the mock environment to "../results" dir.

If you want to see detail messages and run rpmbuild commands by yourself in the mock environment,

 ./kernel-moch.sh -d

This will extract your package and stop when patches are applied, then open the mock's shell. So you can check the patches are applied correctly or not, modify patches if you need, then run "rpmbuild" manually. In this mode, only first line of support-vers, support-features are used. And Your results are not moved to reults dir. Please move it manually before you exit this mode's shell.

If you want to build on Copr,

./kernel-mock.sh -c

You must setup your copr account and make projects before you run.

Build without the script

Setup rpm build tree

If you aleady have one, you can skip this step.

  dnf install rpmdevtools
  rpmdev-setuptree

The rpmdev-setuptree command creates build tree automaticaly. You can check where it is like this.

  rpmbuild --showrc | grep _topdir

In this document, the _topdir is just "rpm".

Download source kernel-.fc.srpm

  dnf download --source kernel

If you want to use the newest developing kernel, you can use koji.

  koji download-build -a src kernel-*

Extract source to rpm build tree

  rpm -Uvh kernel-*.fc*.srpm

Clone repository to local folder

  mkdir kernel-patch-fedora && cd kernel-patch-fedora
  git clone https://github.com/whitehara/kernel-patch-fedora.git .

Copy files to SOURCES directory

  cp kernel-patch-fedora/5.16/* rpm/SOURCES/

Modify kernel config

The config-path.sh adds minimal config into .config files. If you want to custom your kernel, you can add kerne-local file in SOURCES directory.

  cd rpm/SOURCES &&  ./config-patch.sh

Modify kernel.spec(add these patch lines like below)

The _custom_kernel_tag is suffix for kernel package name. It looks like "kernel-version_custom_kernel_tag.fc35.x86_64.rpm"

  cd rpm/SOURCES && ./spec-mod.sh _custom_kernel_tag

You can use other options like below:

  ./spec-mod.sh <CUSTOM TAG> [cfs|pds|bmq]
  CUSTOMTAG: Add CUSTOM TAG for the package
  cfs|pds|bmq: Select scheduler for Project-C patch

Check if paches are appliciable.

  rpmbuild -bp kernel.spec

"-bp" option means doing until applying patches(does not doing compile).

Compile

  rpmbild -bb kernel.spec

"-bb" is just compile binary only. If you want the srpm, use "-ba"(with binary) or "-bs"(without binary) option. See manpages of rpmbuild to find the other rpmbuild option.

You can also use options like "--without debug --without debuginfo". Creating debug rpms needs the longer time to compile. So if you don't need them, I recommend to set these options. See kernel.spec file to find the other "--without" option. You may need to add "--without configchecks" to avoid config check errors since 6.0.

Install

  cd rpm/RPMS/
  dnf install kernel-*