Roland McGrath 13cbc19
Roland McGrath 13cbc19
		Kernel package tips & tricks.
Roland McGrath 13cbc19
		~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Roland McGrath 13cbc19
Roland McGrath 13cbc19
The kernel is one of the more complicated packages in the distro, and
Roland McGrath 13cbc19
for the newcomer, some of the voodoo in the spec file can be somewhat scary.
Roland McGrath 13cbc19
This file attempts to document some of the magic.
Roland McGrath 13cbc19
Roland McGrath 13cbc19
Roland McGrath 13cbc19
Speeding up make prep
Roland McGrath 13cbc19
---------------------
Roland McGrath 13cbc19
The kernel is nearly 500MB of source code, and as such, 'make prep'
Roland McGrath 13cbc19
takes a while. The spec file employs some trickery so that repeated
Roland McGrath 13cbc19
invocations of make prep don't take as long.  Ordinarily the %prep
Roland McGrath 13cbc19
phase of a package will delete the tree it is about to untar/patch.
Roland McGrath 13cbc19
The kernel %prep keeps around an unpatched version of the tree,
Roland McGrath 13cbc19
and makes a symlink tree clone of that clean tree and than applies
Roland McGrath 13cbc19
the patches listed in the spec to the symlink tree.
Roland McGrath 13cbc19
This makes a huge difference if you're doing multiple make preps a day.
Roland McGrath 13cbc19
As an added bonus, doing a diff between the clean tree and the symlink
Roland McGrath 13cbc19
tree is slightly faster than it would be doing two proper copies of the tree.
Roland McGrath 13cbc19
Roland McGrath 13cbc19
Roland McGrath 13cbc19
build logs.
Roland McGrath 13cbc19
-----------
Roland McGrath 13cbc19
There's a convenience helper script in scripts/grab-logs.sh
Roland McGrath 13cbc19
that will grab the build logs from koji for the kernel version reported
Roland McGrath 13cbc19
by make verrel
Roland McGrath 13cbc19
Roland McGrath 13cbc19
Roland McGrath 13cbc19
config heirarchy.
Roland McGrath 13cbc19
-----------------
Roland McGrath 13cbc19
Instead of having to maintain a config file for every arch variant we build on,
Roland McGrath 13cbc19
the kernel spec uses a nested system of configs.  At the top level, is
Roland McGrath 13cbc19
config-generic. Add options here that should be present in every possible
Roland McGrath 13cbc19
config on all architectures.
Roland McGrath 13cbc19
Beneath this are per-arch overrides. For example config-x86-generic add
Roland McGrath 13cbc19
additional x86 specific options, and also _override_ any options that were
Roland McGrath 13cbc19
set in config-generic.
Roland McGrath 13cbc19
There exist two additional overrides, config-debug, and config-nodebug,
Roland McGrath 13cbc19
which override -generic, and the per-arch overrides. It is documented
Roland McGrath 13cbc19
further below.
Roland McGrath 13cbc19
Roland McGrath 13cbc19
debug options.
Roland McGrath 13cbc19
--------------
Roland McGrath 13cbc19
This is a little complicated, as the purpose & meaning of this changes
Roland McGrath 13cbc19
depending on where we are in the release cycle.
Roland McGrath 13cbc19
If we are building for a current stable release, 'make release' has
Roland McGrath 13cbc19
typically been run already, which sets up the following..
Roland McGrath 13cbc19
- Two builds occur, a 'kernel' and a 'kernel-debug' flavor.
Roland McGrath 13cbc19
- kernel-debug will get various heavyweight debugging options like
Roland McGrath 13cbc19
  lockdep etc turned on.
Roland McGrath 13cbc19
Roland McGrath 13cbc19
If we are building for rawhide, 'make debug' has been run, which changes
Roland McGrath 13cbc19
the status quo to:
Roland McGrath 13cbc19
- We only build one kernel 'kernel'
Roland McGrath 13cbc19
- The debug options from 'config-debug' are always turned on.
Roland McGrath 13cbc19
This is done to increase coverage testing, as not many people actually
Roland McGrath 13cbc19
run kernel-debug.
Roland McGrath 13cbc19
Roland McGrath 13cbc19
To add new debug options, add an option to _both_ config-debug and config-nodebug,
Roland McGrath 13cbc19
and also new stanzas to the Makefile 'debug' and 'release' targets.
Roland McGrath 13cbc19
Roland McGrath 13cbc19
Sometimes debug options get added to config-generic, or per-arch overrides
Roland McGrath 13cbc19
instead of config-[no]debug. In this instance, the options should have no
Roland McGrath 13cbc19
discernable performance impact, otherwise they belong in the debug files.
Roland McGrath 13cbc19