---
name: "make-kpkg"
section: "8"
platform: "linux"
package: "kernel-package"
version: "6.05"
release: "Debian 2.1 (Slink)"
platforms: ["linux"]
url: "https://new.carta.tech/make-kpkg/8"
---

# make-kpkg(8)

build Debian kernel packages from Linux kernel sources

## NAME

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

## SYNOPSIS

**make-kpkg** *\[options\]* \[target \[target ...\]\]

## DESCRIPTION

This manual page explains the Debian **make-kpkg** utility, which is used to create the kernel related  Debian  packages. 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 (in other words, if a file called  *stamp-configure* exists, this option has no effect -- run  **make-kpkg clean** or manually remove  *stamp-configure* for it to have an effect). So, if you re-run  **make-kpkg** with a different revision number,  you have to reconfigure the kernel. Secondly, it may contain only alphanumerics and the characters + . (full stop, and plus) and must contain a digit. **NOTE:** No hyphens allowed. (Look at Chapter 5 of the Programmers manual for details). Optionally, you may prepend the revision with a digit followed by a colon (:)

- **--flavour foo**

  Sets the kernel flavour to the argument **number**. The flavour is also appended to the package name. You need a patched Makefile to make this work propperly (see /usr/doc/kernel-package/FLAVOURS.gz). It may contain only alphanumerics and the characters - + . (full stop, hyphen, and plus). Uppercase letter are also not permitted under the Policy for a new package. **NOTE**: Hyphens are discouraged.  (Look at Chapters 4 and 5 of the Programmers manual for details).

- **--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 sub architectures may be required in the kernel sources to actually make this do anything.

- **--arch\_in\_name**

  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.** **Please note** that only the package *name* is affected, not modules locations etc.

- **--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.*

- **--targets**

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

- **--noexec**

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

- **--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 super user access (for example, \`sudo' or \`fakeroot') as needed by dpkg-buildpackages's -r option. This is only relevant for the buildpackage target.

The options maybe 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.

## 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,** and **binary,** and produces the complete package using  **dpkg-buildpackage**

- **binary**

  This target produces all four  Debian kernel packages by running the targets **kernel\_source, kernel\_headers, 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\_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  */boot/psdatabase* file at install time, it also update symbolic links in the root directory to point to the new kernel image in */boot.* It also offers to run the  Linux loader,  *LILO,* creating a configuration file for  *LILO* 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.

- **configure**

  This target runs configure (actually, **oldconfig)** early, so you may edit files generated by **make config** in the kernel source directory and not have them stomped by  **make-kpkg** later.

- **libc-kheaders**

  This is a special target for the libc-dev maintainer, who can use ot to create the headers package that libc needs. Please note that it is dangerous to create a libc-kheaders package that is different fomr the headers libc was compiled with; it is **known** to subtly break systems. Please look at  */usr/lib/kernel-package/README.headers* for details.  Creating and installing a self created libc-kheaders package may break your system unless you know what you are doing. You have been warned.

## 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 suitable editing this file. Please look at */usr/doc/kernel-package/Problems.gz* for a list of known problems while compiling kernel images. Extensive tutorial like documentation is also available in */usr/doc/kernel-package/README.gz* and it is recommended that one read that before using this utility.

## SEE ALSO

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

## AUTHOR

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