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
This commit is contained in:
Brandon Nielsen 2023-12-18 15:07:20 -06:00
parent c11f6f70a7
commit 938bd22747

View file

@ -107,13 +107,19 @@ sudo dnf install ccache
== Building a Kernel from the Fedora dist-git == 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. 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 `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 `f<version>`.
to check out that branch with:
. Check out the branch for which you would like to build a kernel (`rawhide` . For example, to build a Fedora 28 kernel, you would first need
corresponds to Rawhide): to switch to that branch with:
+ +
[source,bash] [source,bash]
---- ----
@ -124,7 +130,22 @@ git switch f28
changing `# define buildid .local` to `%define buildid .<your_custom_id_here>` changing `# define buildid .local` to `%define buildid .<your_custom_id_here>`
in `kernel.spec`. 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: . 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 == Building a vanilla upstream kernel
Sometimes a Fedora developer may ask you to try building and installing an Sometimes a Fedora developer may ask you to try building and installing an