Mike McGrath c7a89c2
Roland McGrath 11487c5
		Kernel package tips & tricks.
Roland McGrath 11487c5
		~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Roland McGrath 11487c5
Roland McGrath 11487c5
The kernel is one of the more complicated packages in the distro, and
Roland McGrath 11487c5
for the newcomer, some of the voodoo in the spec file can be somewhat scary.
Roland McGrath 11487c5
This file attempts to document some of the magic.
Roland McGrath 11487c5
Roland McGrath 11487c5
Roland McGrath 11487c5
Speeding up make prep
Roland McGrath 11487c5
---------------------
Roland McGrath 11487c5
The kernel is nearly 500MB of source code, and as such, 'make prep'
Roland McGrath 11487c5
takes a while. The spec file employs some trickery so that repeated
Roland McGrath 11487c5
invocations of make prep don't take as long.  Ordinarily the %prep
Roland McGrath 11487c5
phase of a package will delete the tree it is about to untar/patch.
Roland McGrath 11487c5
The kernel %prep keeps around an unpatched version of the tree,
Roland McGrath 11487c5
and makes a symlink tree clone of that clean tree and than applies
Roland McGrath 11487c5
the patches listed in the spec to the symlink tree.
Roland McGrath 11487c5
This makes a huge difference if you're doing multiple make preps a day.
Roland McGrath 11487c5
As an added bonus, doing a diff between the clean tree and the symlink
Roland McGrath 11487c5
tree is slightly faster than it would be doing two proper copies of the tree.
Roland McGrath 11487c5
Roland McGrath 11487c5
Roland McGrath 11487c5
build logs.
Roland McGrath 11487c5
-----------
Roland McGrath 11487c5
There's a convenience helper script in scripts/grab-logs.sh
Roland McGrath 11487c5
that will grab the build logs from koji for the kernel version reported
Roland McGrath 11487c5
by make verrel
Roland McGrath 11487c5
Roland McGrath 11487c5
Roland McGrath 11487c5
config heirarchy.
Roland McGrath 11487c5
-----------------
Roland McGrath 11487c5
Instead of having to maintain a config file for every arch variant we build on,
dd50066
the kernel spec uses a nested system of configs. Each option CONFIG_FOO is
dd50066
represented by a single file named CONFIG_FOO which contains the state (=y, =m,
2bf928d
=n). These options are collected in the folder base-generic. Architecture
2bf928d
specific options are set in nested folders. An option set in a nested folder
2bf928d
will override the same option set in one of the higher levels.
dd50066
dd50066
The individual CONFIG_FOO files only exist in the pkg-git repository. The RPM
dd50066
contains kernel-foo.config files which are the result of combining all the
dd50066
CONFIG_FOO files. The files are combined by running build_configs.sh. This
dd50066
script _must_ be run each time one of the options is changed.
dd50066
dd50066
Example flow:
dd50066
dd50066
# Enable the option CONFIG_ABC123 as a module for all arches
2bf928d
echo "CONFIG_ABC123=m" > configs/base-generic/CONFIG_ABC1234
dd50066
# enable the option CONFIG_XYZ321 for only x86
2bf928d
echo "# CONFIG_XYZ321 is not set" > configs/base-generic/CONFIG_XYZ321
2bf928d
echo "CONFIG_XYZ321=m" > configs/base-generic/x86/CONFIG_XYZ321
dd50066
# regenerate the combined config files
dd50066
./build_configs.sh
dd50066
dd50066
The file config_generation gives a listing of what folders go into each
dd50066
config file generated.
Dave Jones ac34e0a
Roland McGrath 11487c5
debug options.
Roland McGrath 11487c5
--------------
Roland McGrath 11487c5
This is a little complicated, as the purpose & meaning of this changes
Roland McGrath 11487c5
depending on where we are in the release cycle.
Roland McGrath 11487c5
If we are building for a current stable release, 'make release' has
Roland McGrath 11487c5
typically been run already, which sets up the following..
Roland McGrath 11487c5
- Two builds occur, a 'kernel' and a 'kernel-debug' flavor.
Roland McGrath 11487c5
- kernel-debug will get various heavyweight debugging options like
Roland McGrath 11487c5
  lockdep etc turned on.
Roland McGrath 11487c5
Roland McGrath 11487c5
If we are building for rawhide, 'make debug' has been run, which changes
Roland McGrath 11487c5
the status quo to:
Roland McGrath 11487c5
- We only build one kernel 'kernel'
dd50066
- The debug options are always turned on.
Roland McGrath 11487c5
This is done to increase coverage testing, as not many people actually
Roland McGrath 11487c5
run kernel-debug.
Roland McGrath 11487c5
2bf928d
The debug options are managed in a separate heierarchy under base-debug. This
2bf928d
works in a similar manner to base-generic. More deeply nested folders, again,
dd50066
override options. The file config_generation gives a listing of what folders
dd50066
go into each config file generated.