#674 Improve documentation for building kernel from dist-git
Merged 4 months ago by pboy. Opened 4 months ago by nielsenb.
fedora-docs/ nielsenb/quick-docs kernel-distgit-cleanup  into  main

@@ -107,13 +107,19 @@ 


  == 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<version>`. For example, to build a Fedora 28 kernel, you would first need

- to check out that branch with:

+ `f<version>`.


- . 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:



@@ -124,7 +130,22 @@ 

     changing `# define buildid .local` to `%define buildid .<your_custom_id_here>`

     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 @@ 




- === 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

The rough outline of changes is:

  • 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. It would be great if someone a bit more knowledgeable in kernel builds could take a look .

I merged this patch. I may not be perfect yet and may need further improvements. But in any case, it is a significant improvement.

Pull-Request has been merged by pboy

4 months ago