From 938bd22747de561e5e5de524fbf1ace0b49f36d7 Mon Sep 17 00:00:00 2001 From: Brandon Nielsen Date: Mon, 18 Dec 2023 15:07:20 -0600 Subject: [PATCH] Improve documentation for building kernel from dist-git Note how to checkout from dist-git, and how to retrieve the appropriate kernel sources for a given dist-git version. Add notes for different ways to customize the built kernel. Remove section on using `make release`, make is only invoked directly when building straight from kernel sources, not when building with fedpkg and dist-git. This is an attempt to clean up issues identified in quick-docs:666[0]. https://pagure.io/fedora-docs/quick-docs/issue/666 --- modules/ROOT/pages/kernel-build-custom.adoc | 49 +++++++++++---------- 1 file changed, 26 insertions(+), 23 deletions(-) diff --git a/modules/ROOT/pages/kernel-build-custom.adoc b/modules/ROOT/pages/kernel-build-custom.adoc index 2e751bf..b18ff33 100644 --- a/modules/ROOT/pages/kernel-build-custom.adoc +++ b/modules/ROOT/pages/kernel-build-custom.adoc @@ -107,13 +107,19 @@ sudo dnf install ccache == Building a Kernel from the Fedora dist-git +First, a checkout from the https://src.fedoraproject.org/rpms/kernel[Fedora kernel dist-git] is required: + +[source,bash] +---- +git clone https://src.fedoraproject.org/rpms/kernel.git +---- + The kernel, like any other Fedora package, has a branch per Fedora release. `rawhide` corresponds to Rawhide and each version of Fedora has a branch called -`f`. For example, to build a Fedora 28 kernel, you would first need -to check out that branch with: +`f`. -. Check out the branch for which you would like to build a kernel (`rawhide` - corresponds to Rawhide): +. For example, to build a Fedora 28 kernel, you would first need +to switch to that branch with: + [source,bash] ---- @@ -124,7 +130,22 @@ git switch f28 changing `# define buildid .local` to `%define buildid .` in `kernel.spec`. -. Make whatever changes or customizations you need. +. Make whatever changes or customizations you need: + +.. Kernel configuration options can be overriden by modifying the `kernel-local` file. + +.. Existing patches can be added to `linux-kernel-test.patch`, they will be +picked up during the build automatically. + +.. Patches can also be kept in seperate files and added to `kernel.spec` with +`Patch2: foo.patch`, `Patch3: bar.patch`, etc. They should be applied +automatically during the build process. + +.. To make your own modifications to the kernel source, retrieve the kernel +sources for your current dist-git branch with `fedpkg sources`, then make +your desired changes to the kernel source and generate a patch, e.g. with +`diff -rupN kernel_src_folder kernel_src_folder_patched > mypatch.patch`. +The patch can then be added to `linux-kernel-test.patch` or the specfile. . Build the RPMs: + @@ -141,24 +162,6 @@ sudo dnf install --nogpgcheck ./x86_64/kernel-$version.rpm ---- -=== Building a non-debugging kernel - -Most Rawhide kernels are built with debugging enabled by default. To make a -kernel with debugging options disabled, you can follow the above instructions, -but before you run `fedpkg local`, disable the debugging options with: - -[source,bash] ----- -make release ----- - -=== Enabling configuration options - -If there are configuration options that need to be adjusted for your build, you -can add changes in the kernel-local file. These changes will get picked up when -you build. - - == Building a vanilla upstream kernel Sometimes a Fedora developer may ask you to try building and installing an