On Fri, 2021-08-06 at 04:49 +0000, Sampson Fung wrote:
I am new to kernel building - I just managed to finishing building
my
first kernel with the help I can got here.
I want to build with rpmbuild, Fedora's kernel source RPMs, and the
contained kernel.spec under Fedora.
I want to learn reading the kernel.spec file.
Please help by pointing me where I can start reading!
_______________________________________________
There are a couple of things that changed over recent years and also
different ways of building (different people, different goals,
different preferences). There is plenty of information out there but
you need to be a bit careful and considerate because some things are
just outdated or way easier nowadays.
- A good way to start is the Wiki maybe [1]. It seems more complete and
up-to-date. Another good thing is you can always change or update
sections that are not current or correct anymore. It covers the fedpkg-
way of building the complete kernel package.
- You already found this in the Fedora Docs: [2]. First thing that
jumps into my eye is that it fails to mention that it is much easier to
disable Secure Boot rather than enroll your own keys in the firmware.
Nice thing about Fedora Docs: You can also update, review, and
contribute there: [3]. Maybe I do that just because of that Secure Boot
thing :-)
- The excellent Fedora Magazine has some articles about building and
testing kernels: [4]
- There's also the $HOME/rpmbuild tree way (rpmdev-setuptree creates
one for you). You already seen that here on the list. It is essentially
the same what fedpkg and mock do, just not in a chroot'ed environment,
and thus might not be the "cleanest" way to test if a build is actually
working.
- You asked for something to read. However, there are a couple of
Fedora community videos online that explain some internals and show
where people want to go with Fedora kernel work. Tremendously helpful
to get a wider picture.
* One from 2017, Laura Abbott hosted a discussion with a lot of
insights: [5]
* Something from last year: [6]. Explains what is Fedora ARK and more
recent developments
- If you are interested in contributing config changes, continuous
testing, integrating patches, take a look at Fedora ARK (Always Ready
Kernels) at [7] and esp. [8]. There's a contributors guide, too. It
also shows how to use Koji to build packages (e.g., not on your local
machine, for other arches). I think these links are the most useful
things to read when you are interested to work with others and get
changes into Fedora.
In the end, the kernel is an RPM package like any other (uh, a more
complicated package, though). There are a couple of resources on RPM
spec files and packaging in general: [9] [10]. If you are not
interested in the packaging or in the Fedora-way you have the option to
go full vanilla.
BK
[1]:
https://fedoraproject.org/wiki/Building_a_custom_kernel
[2]:
https://docs.fedoraproject.org/en-US/quick-docs/kernel/build-custom-kernel/
[3]:
https://pagure.io/fedora-docs/quick-docs/blob/master/f/README.md
[4]:
https://fedoramagazine.org/?s=fedora+kernel
[5]: Video from Flock 2017
https://youtu.be/j4gBrz2uEbA
[6]: In the Fedora Project channel, Justin Forbes with newest changes
in kernel packaging
https://youtu.be/urUktTIP0Fs
[7]:
https://gitlab.com/cki-project
[8]:
https://cki-project.gitlab.io/kernel-ark/
[9]:
https://rpm-guide.readthedocs.io/en/latest/rpm-guide.html#what-is-a-spec-...
[10]:
https://rpm-guide.readthedocs.io/en/latest/index.html