kernkit


Copyright (c) 2002-2004 Doug Porter dougporter@fastmail.fm
GPL license
Lastest version: 0.6

Kernkit is a collection of small command line utilities to handle the tedious and error prone parts of playing with the Linux kernel source code. Kernkit will automatically

  • apply any new kernel version patches you have

  • run xconfig

  • make the kernel

  • install it

  • build and install your custom modules

And it handles all the details for you, such as using gpg to verify the patches, setting up the system map and modules info, and running lilo. Of course you can find the instructions on how to do all this by hand if you search through various system documents, and maybe you'll remember it all every time. Kernkit is much easier.

Quick start

  1. kernpatch <patch dir>

  2. kernconfig <new version>

  3. Reboot to try your new kernel.

Requirements

  • Perl

  • Linux kernel source

Installation

  1. Set the "#!/usr/bin/perl" at the top of each file to match the location of perl on your system.

  2. If you're not running Xwindows or prefer a pure command line, in kernconfig set $configUtility to 'menuconfig' or 'config'.

  3. If you don't want to install to /boot/bzImage, in kerninstall change $bootImage and possibly $bootDir. The image file you use must be in your /etc/lilo.conf, but should not be the default .

  4. Any customization, such as building and installing nonstandard modules, goes in kerncustom. Apply any nonstandard patches after kernpatch and before kernconfig.

  5. Copy the kernkit utilities to a directory in your path, such as /usr/local/sbin.

  6. Make the Linux kernel source directory you want to build the current directory.

kernpatch

Checks gpg signature on every patch that has a corresponding signature file. Creates a copy of the kernel source directory and consecutively applies all the version patches you have. Relinks /usr/src/linux to the new kernel. The new source directory is ready for 'kernconfig <version>'.

Don't untar or un-bzip the patch files.

If you have signature files for the patches but don't have gpg installed kernpatch will warn you. If you don't want to see these warnings, don't put the signature files in the patch directory.

If you don't have a "trust path" to the key used to sign the patches, gpg will give you several warnings. That's because without a trust path you may know the patch was signed, but you don't know who really signed it. See the gpg docs for more on trust paths.

usage: kernpatch <patch dir> [<source dir>]

<patch dir>

Contains the patch-X.Y.Z.* files to apply.

<source dir>

Defaults to /usr/src. Must contain at least one linux-X.Y.Z source code subdirectory. The new source subdirectory will be created here.

kernconfig

Configures and installs a kernel from source. Handles details from "make xconfig" through make, installation, and customization. Invokes other kernkit utilities as needed.

If you're not running Xwindows or prefer a pure command line, in kernconfig set $configUtility to 'menuconfig' or 'config'.

It's a good idea to check your configuration whenever you rebuild your kernel, but if you just quit xconfig, kernconfig will continue to build and install your kernel.

usage: kernconfig [<version>]

kernmake

Make clean, dep, bzImage, modules, and modules_install.

usage: kernmake [<version>]

kerninstall

Installs kernel into /boot/bzImage. Configures /boot, system map, and /lib/modules. Runs lilo. Links /usr/src/linux.

If you don't want to install to /boot/bzImage, in kerninstall change $bootImage. The image you use should not be the default in /etc/lilo.conf.

Before running kerninstall, be sure to

  1. run kernconfig or kernmake

  2. have a boot in /etc/lilo.conf with an image of /boot/bzImage

Some kernels and some kernel configurations don't work. Keep a working kernel around. It's always a very good idea to have a boot in /etc/lilo.conf that uses a known working kernel. The System.map will be wrong for your emergency backup kernel, but it will usually run well enough for you to fix things. A boot floppy is also handy.

usage: kerninstall [<version>]

kerncustom

Put your local customization here, such as building and installing nonstandard modules. If you don't need any customization you can just remove kerncustom.

The example provided makes and installs some modules that aren't in the standard kernel. It's almost certainly not what you want, but should be harmless.

If you're customizing a kernel version that's not running, you may need to reboot under the new version, rerun kerncustom, and reboot again.

usage: kerncustom [<version>]