NAME

make-kpkg - build Debian kernel packages from Linux kernel sources.

SYNOPSIS

 usage: make-kpkg [options] [target [target ...]]

DESCRIPTION

This manual page explains the Debian make-kpkg utility, which is used to create the kernel related Debian pack­ ages. This utility needs to be run from a top level Linux kernel source directory.

OPTIONS

--help Print out a usage message.
--revision number

Sets the Debian revision number for the packages produced to the argument number. This has certain constraints: It only has an effect during the configure phase. I suggest you run make-kpkg clean unless you know what you are doing. Secondly, it may contain only alphanumerics and the characters + . (full stop, and plus) and must contain a digit. NOTE: No hyphens allowed. (Look at the Debian policy manual for details).

Optionally, you may prepend the revision with a digit followed by a colon (:)

This is because dpkg imposes an ordering on version numbers, so that it can tell whether packages are being up- or downgraded and so that dselect can tell whether a package it finds available is newer than the one installed on the system.

--append-to-version foo
--append_to_version foo

This argument (foo) is appended to the value of the EXTRAVERSION variable present in the kernel Makefile. Since EXTRAVERSION is a component of the kernel version, it is also added to the Debian package name, and, as such must obey the policy governing the package name. That means it may contain only lowercase alphanumerics and the characters - + . (full stop, hyphen, and plus). Uppercase letters are not permitted under the Policy for a new package.

Please note that you must run a make-kpkg clean after configuring the kernel using make (x|menu)?config, since that creates include/linux/version.h without the appended version foo.

--added-modules foo
--added_modules foo

The argument should be a comma or space separated list of additional add-on modules (not in the main kernel tree) that you wish to build when you invoke the modules_blah targets. You may give full path names of the directory the modules reside in, or just the module name if it can be found in MODULE_LOC, which defaults to /usr/src/modules. The default is that all modules in MODULE_LOC are compiled when the modules_blah targets are invoked.

--added-patches foo
--added_patches foo

The argument should be a comma or space separated list of additional patches to the kernel sources. Unlike the treatment of the modules, you may only give the patch name (not the full path name of the patch file). It shall be applied during the configure phase (and removed in the clean phase) if it can be found in the directories ALL_PATCH_DIR/{apply,unpatch}/, which defaults to a subdirectory of /usr/src/kernel-patches/. The default is that all patches are applied if requested (By setting the env variable PATCH_THE_KERNEL to YES)

--arch foo

Sets the architecture. This is mostly useful when cross compiling.

--cross-compile foo
--cross_compile foo

Sets the target string. This is mostly useful when cross compiling.

--subarch foo

Some architectures (the Alpha, and the m68k) require a different kernel for each subarchitecture. This option provides a way of specifying it as an argument to make-kpkg. Please note that additional support for subarchitectures may be required in the kernel sources to actually make this do anything.

--arch-in-name foo
--arch_in_name foo

This option uses an extended name for the kernel image package by embedding the subarchitecture in the image name, so one could write a script to create multiple subarchitectures one after the other. You may also do this by setting the environment variable ARCH_IN_NAME.

--stem foo

This option determines the stem of the name of the packages. This is set to kernel by default. You may also do this by setting the environment variable KPKG_STEM.

--pgpsign name

Set the string used to sign the changes file for any external modules in /usr/src/modules/ using PGP. This option will override the builtin default and the site wide customizations stored in the file /etc/kernel-pkg.conf.

--config target

Change the type of configure done from the default oldconfig. target must be one of oldconfig, config, menuconfig, xconfig, gconfig, or old, menu, g or x.

This option is particularly useful when using PATCH_THE_KERNEL if some of the patches change what configuration options are available.

--targets

Prints out a list of known targets. See the Section Targets below.

--noexec

Pass a -n option to the make so that commands are merely printed to the screen but not actually executed. This is very useful for debugging.

--verbose

Pass a V=1 option to the make so that commands are verbosely printed to the screen while executed. This is very useful for debugging.

--initrd

If make-kpkg is generating a linux-image package, perform any actions necessary for a kernel loaded using initrd. NOTE: in older kernels, this required a non-standard cramfs initrd patch to the kernel, unless the mkinitrd configuration was modified not to use cramfs. The patch usually shipped with Debian. Some architectures still need patches to fix cramfs problems.

This may include extra dependencies, and modifications to maintainer scripts. It has no effect when make-kpkg is not making a linux-image package.(The INITRD_OK variable is now obsolete).

--mkimage foo

This should be a command that produces an initrd image given a directory. It is passed to the mkinitrd as -m option.

--zimage

Makes a zImage kernel rather than a bzImage kernel (the default). Useful for people having problems with bzImage kernels.

--bzimage

Makes a bzImage kernel. Useful for people who want a bzImage kernel on sites where the default is zImage kernels.

--rootcmd

The command that provides a means of gaining superuser access (for example, `sudo' or `fakeroot') as needed by dpkg-buildpackages' -r option.

--us

This option is passed to dpkg-buildpackage, and directs that package not to sign the source. This is only relevant to the buildpackage target.

--uc

This option is passed to dpkg-buildpackage, and directs that package not to sign the changelog. This is only relevant to the buildpackage target.

The options may be shortened to the smallest unique string, and may be entered with either a - or a -- prefix, and you may use a space or an = symbol between an option string and a value. Please refer to man Getopt::Long for details on how the options may be entered.

TARGETS

clean

Cleans the kernel source directory of all files created by target build, and runs a make distclean. (Please look at a Linux kernel Makefile for details). Please note that although we take care of the list of current kernel configuration contained in the file .config, the file include/linux/autoconf.h is not preserved.

buildpackage

This target runs the targets clean, build, and binary, and produces the complete package using dpkg-buildpackage.

binary

This target produces all five Debian kernel packages by running the targets kernel_source, kernel_headers, kernel_manual, kernel_doc and kernel_image.

kernel_source

This target produces a debianised package of the Linux kernel sources. The package produced also has scripts called at install and delete times that manage the symbolic link /usr/src/linux and ensure that the link is pointed at the latest source/header package on the system.

kernel_headers

This target produces a Debian package containing the header files included in the Linux kernel. The package produced also has scripts called at install and delete times that manage the symbolic link /usr/src/linux and ensure that the link is pointed at the latest source/header package on the system.

kernel_doc

This target produces a Debian package containing the documentation included in the Linux kernel.

kernel_manual

This target produces a Debian package containing the section 9 manual pages included in the Linux kernel.

kernel_image

This target produces a Debian package of the Linux kernel source image, and any modules configured in the kernel configuration file .config. If there is no .config file in the kernel source directory, a default configuration is provided similar to the one used to create the Debian boot-floppies. The package produced updates the symbolic links in the root directory to point to the new kernel image in /boot. It also offers to run the Linux loader, LILO (or alternates like loadlin, SILO, QUIK, VMELILO, ZIPL, yaboot, PALO or GRUB ), creating a configuration file for the supported boot loaders if needed. It also offers to put the new kernel on a floppy, formatting the floppy if needed. On deletion, the package checks the version of the kernel running, and refuses to delete a running kernel.

build

This target, used by target kernel_image above, compiles the Linux kernel image.

modules

This target allows you to build all add-on modules and packages that are very dependent on the precise kernel version they are compiled for at the same time you build your kernel image. This target expects to find the modules or packages under /usr/src/modules, and, for all such directories, changes to /usr/src/modules/x, and runs the kdist rule in the local debian.rules file. This target should create the Debian module package(s), and may also produce a compressed tar file, and a compressed diff file, with md5sums recorded in a changes file using dpkg-genchanges. The file is signed by the same identity that would be used to sign the kernel packages.

modules_config

This target allows you to configure all packages under /usr/src/modules.

modules_image

This target allows you to build all packages under /usr/src/modules, but does not create the source or diff files, and does not create and sign a changes file.

modules_clean

This target allows you to clean the modules directories.

configure

This target allows people to create the debian directory and create a configuration timestamp, so that any special edits to configuration-generated files are not stomped over later.

FILES

Apart from the runtime options, the debian.rules file run by make-kpkg also looks for site-wide defaults in the file /etc/kernel-pkg.conf. The default configuration allows there to be a site wide override for the full name and email address of the person responsible for maintaining the kernel packages on the site, but the /etc/kernel-pkg.conf file is actually a Makefile snippet, and any legal make directives may be included in there. Note: Caution is urged with this file, since you can totally change the way that the make is run by suitably editing this file. Please look at /usr/share/doc/kernel-package/Problems.gz for a list of known problems while compiling kernel images.

SEE ALSO

kernel-pkg.conf(5), dpkg-deb(1), dpkg-source(1), make(1), The GNU Make manual, and the extensive documentation in the directory /usr/share/doc/kernel-package/

BUGS

None known so far.

AUTHOR

This was written by Manoj Srivastava <srivasta@debian.org>, for the Debian GNU/Linux system.