/[ddp]/manpages/english/kernel-package/make-kpkg.8
ViewVC logotype

Contents of /manpages/english/kernel-package/make-kpkg.8

Parent Directory Parent Directory | Revision Log Revision Log


Revision 366 - (show annotations) (download)
Mon Aug 4 20:29:43 2003 UTC (9 years, 9 months ago) by barbier
File size: 22907 byte(s)
Sync: kernel-package 8.043
1 .\" Hey, Emacs! This is an -*- nroff -*- source file.
2 .\" Copyright (c) 1997 Manoj Srivastava <srivasta@debian.org>
3 .\"
4 .\" This is free documentation; you can redistribute it and/or
5 .\" modify it under the terms of the GNU General Public License as
6 .\" published by the Free Software Foundation; either version 2 of
7 .\" the License, or (at your option) any later version.
8 .\"
9 .\" The GNU General Public License's references to "object code"
10 .\" and "executables" are to be interpreted as the output of any
11 .\" document formatting or typesetting system, including
12 .\" intermediate and printed output.
13 .\"
14 .\" This manual is distributed in the hope that it will be useful,
15 .\" but WITHOUT ANY WARRANTY; without even the implied warranty of
16 .\" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 .\" GNU General Public License for more details.
18 .\"
19 .\" You should have received a copy of the GNU General Public
20 .\" License along with this manual; if not, write to the Free
21 .\" Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139,
22 .\" USA.
23 .\"
24 .\"
25 .\" $Id: make-kpkg.8,v 1.75 2003/07/30 22:28:52 srivasta Exp $
26 .\"
27 .TH MAKE\-KPKG 1 "Nov 14 2002" "Debian" "Debian GNU/Linux manual"
28 .SH NAME
29 make\-kpkg \- build Debian kernel packages from Linux kernel sources
30 .SH SYNOPSIS
31 .B make\-kpkg
32 .I [options]
33 \&[target [target ...]]
34 .SH DESCRIPTION
35 This manual page explains the Debian
36 .B "make\-kpkg"
37 utility, which is used to create the kernel related
38 Debian
39 packages. This utility needs to be run from a top level
40 Linux
41 kernel source directory,
42 which has been previously configured (unless you are using the
43 configure target). Typycally, you run this command as root, or under
44 .B fakeroot,
45 or tell
46 .B make\-kpkg
47 how to become root, like so:
48 .sp 1
49 .ti +5
50 make\-kpkg --rootcmd fakeroot kernel_image
51 .sp 1
52 The Debian package file is created in the parent directory of the
53 kernel source directory where this command is run.
54 .SH OPTIONS
55 .B \-\-help
56 Print out a usage message.
57 .TP
58 .BR \-\-revision " number"
59 Changes the Debian revision number for the packages produced to the argument
60 .BR number.
61 This has certain constraints: the --revision option only has an effect
62 during the configure phase (in other words, if a file called
63 .I stamp\-configure
64 exists, this option has no effect \-\- run
65 .B make\-kpkg clean
66 or manually remove
67 .I stamp\-configure
68 and
69 .I stamp-debian
70 for it to have an effect -- I strongly suggest you run
71 .B make\-kpkg clean
72 unless you know what you are doing).
73 Additionally, official source package maintainers provide their own
74 version numbers and data for the official uploads, and hence a number
75 of things, including the
76 .B Debian
77 revision, is not modified by
78 .B make-kpkg.
79 If you happen to have an official source, (that would mean that the
80 file
81 .I debian/official
82 exists, and is not empty), and want to use your own revision number,
83 make sure you remove
84 .I debian/official
85 before running
86 .B make\-kpkg clean
87 for this option to have an effect.
88 So, if you want to re\-run
89 .B make\-kpkg
90 with a different revision number, you have to make sure you start with
91 a clean slate. Secondly, the version may contain only
92 alphanumerics and the characters + . (full stop and plus)
93 and must contain a digit. (Look at the Policy manual for
94 details).
95 .I Actually, that is a lie: official kernel and modules maintainers
96 have special dispensation to use hyphens, but it is strongly
97 deprecated for most people, since no sanitization of the version
98 number is done, and dpkg and friends may choke on it at the end of the
99 compile unless one knows what one is doing.
100 Optionally, you may prepend the revision with a digit followed by a
101 colon (:). The default is
102 .B 1.00.Custom
103 unless the environment variable
104 .B DEBIAN_REVISION_MANDATORY
105 is set, in which case an error is generated if the revision is not set
106 on the command line or the configuration file.
107 .TP
108 .BR \-\-append-to-version " foo"
109 .TP
110 .BR \-\-append_to_version " foo"
111 This argument (
112 .B foo
113 ) is appended to the value of the EXTRAVERSION variable present in
114 the kernel Makefile. Since EXTRAVERSION is a component of the kernel
115 version, it is also added to the Debian package name, and, as such
116 must obey the policy governing the package name. That means it may
117 contain only
118 .B lowercase
119 alphanumerics and the characters - + . (full stop, hyphen, and
120 plus). Uppercase letters are not permitted under the Policy for a new
121 package. This over rides the environment variable
122 .B APPEND_TO_VERSION
123 Please note that you \fB\s-1must\s0\fR run a
124 .B make-kpkg
125 .I clean
126 after configuring the kernel using
127 .I make (x|menu)?config,
128 since that creates the file
129 .I include/linux/version.h
130 .B without
131 the
132 .I append_to_version
133 data (foo). This file won't be updated by the make-kpkg run (make-kpkg
134 creates version.h if it doesn't exist, but doesn't touch if exists),
135 so the final kernel will _not_ have the append_to_version data in its
136 version number it shall look for the modules and symbols in all the
137 wrong places. The simplest solution is either to remove
138 include/linux/version.h after configuring and before compiling, or
139 running
140 .B make-kpkg clean
141 after configuring, before compiling.
142 .B Note
143 also that once you use
144 .BR \-\-append_to_version " foo"
145 for configuring, or building the kernel-image, you need to also use
146 the same option in any later invocation of make-kpkg (say, for
147 building stand alone modules, or something).
148 .B make\-kpkg
149 does not remember the argument foo in between invocations (this is
150 different from the behavior of --revision, which we do remember in
151 between invocations). If you are annoyed by make-kpkg whining about
152 using
153 .BR \-\-append_to_version
154 and there already being a
155 .T version.h
156 file from before, you can set the environment variable
157 .B VERSION_H_OK
158 which shall shut off the warning.
159 .TP
160 .BR \-\-flavour\ foo
161 This option is now deprecated in favor of
162 .BR \-\-append_to_version.
163 Sets the kernel flavour to the argument \fBfoo\fR. The flavour is
164 also appended to the package name. You need a patched Makefile to make
165 this work properly (see /usr/share/doc/kernel-package/\s-1Flavours\s0.gz).
166 It may contain only
167 .B lowercase
168 alphanumerics and the characters \- + . (full stop, hyphen, and
169 plus). Uppercase letter are not permitted under the Policy for a new
170 package. \fB\s-1NOTE\s0\fR: Hyphens are discouraged. (Look at
171 Chapters 4 of the Policy manual for details). Please note that you
172 shall need to
173 .B make-kpkg
174 .I clean
175 .B FIRST
176 if you wish to recompile the kernel-image using a flavour.
177 .TP
178 .BR \-\-added-modules\ foo
179 .TP
180 .BR \-\-added_modules\ foo
181 The argument should be a comma separated list of additional
182 add-on modules (not in the main kernel tree) that you wish to
183 build when you invoke the modules_blah targets. You may give full path
184 names of the directory the modules
185 reside in, or just the module name if it can be found in
186 .B MODULE_LOC,
187 which defaults to
188 .I /usr/src/modules.
189 The default is that all modules in
190 .B MODULE_LOC,
191 are compiled when the modules_blah targets are invoked.
192 .TP
193 .BR \-\-added-patches\ foo
194 .TP
195 .BR \-\-added_patches\ foo
196 The argument should be a comma separated list of additional
197 patches to the kernel sources. This automatically sets the
198 .I patch_the_kernel
199 configuration option to YES.
200 .IP
201 Unlike the treatment of the modules, you may only give the patch file
202 basename (not the full path name of the patch file). For each file
203 <patch_name> in the list, the following process is followed: If
204 the file can be found in the directories
205 .B ALL_PATCH_DIR/{apply,unpatch}/,
206 then the file
207 .B ALL_PATCH_DIR/apply/<patch_name>
208 shall be executed in turn during the configure phase (and presumably
209 this applies the patch). Correspondingly, the file
210 .B ALL_PATCH_DIR/unpatch/<patch_name>
211 shall be executed in the clean phase.
212 The default is that all patches are applied by running all the
213 executable files in
214 .B ALL_PATCH_DIR/apply/
215 if requested (Either by setting the configuration option
216 .B patch_the_kernel
217 or the environment variable
218 .B PATCH_THE_KERNEL
219 to YES). Please note that the patches are UN-installed from the source
220 when you run the clean target. This cleanup can be prevented by
221 setting the environment variable
222 .B NO_UNPATCH_BY_DEFAULT
223 .IP
224 In the above,
225 .B ALL_PATCH_DIR
226 defaults to a subdirectory of
227 .I /usr/src/kernel-patches/.
228 .IP
229 Some times it would be convenient to have the patches applied when
230 one asks for specific patches using this option, without also having
231 to explicitly set the environment variable. Since setting the
232 environment variable
233 .B PATCH_THE_KERNEL
234 to YES could be dangerous, (for in that case all patches may be
235 installed when you want none, and did not specify the added_patches
236 option), You may also set the variable PATCH_THE_KERNEL to
237 .I AUTO,
238 in which case PATCH_THE_KERNEL shall be set to YES for you when you
239 invoke
240 .BR \-\-added-patches\ foo,
241 but not otherwise.
242 Also, please note that if any patch installs a script in
243 .I ./debian/image.d/
244 directory,
245 .B run-parts
246 shall be called on that directory just before the kernel image package is
247 built. The location of the root of the image package being built shall
248 be passed in the environment variable
249 .B IMAGE_TOP,
250 and the kernel versions is passed in through the environment variable
251 .B version.
252 This is a way for the patch to insert any additional files into
253 the image, for example.
254 .TP
255 .BR \-\-arch\ foo
256 This is useful for setting the architecture when you are cross
257 compiling. If you are not cross compiling, the architecture is
258 determined automatically. The same effect can be achieved by setting
259 the environment variable
260 .B KPKG_ARCH
261 .TP
262 .BR \-\-cross-compile\ foo
263 .TP
264 .BR \-\-cross_compile\ foo
265 This is useful for setting the target string when you are cross
266 compiling. The same effect can be achieved by setting the environment variable
267 .B CROSS_COMPILE
268 .TP
269 .BR \-\-subarch\ foo
270 Some architectures (the Alpha, and the m68k) require a different
271 kernel for each sub-architecture. This option provides a way of
272 specifying it as an argument to \fBmake-kpkg\fR. \fBPlease note\fR
273 that additional support for sub-architectures may be required in the
274 kernel sources to actually make this do anything. The same effect can
275 be achieved by setting the environment variable
276 .B KPKG_SUBARCH
277 .TP
278 .BR \-\-arch-in-name
279 .TP
280 .BR \-\-arch_in_name
281 This option uses an extended name for the kernel image package by
282 embedding the sub-architecture in the image name, so one could write a
283 script to create multiple sub-architectures one after the other. You
284 may also do this by setting the environment variable
285 .B ARCH_IN_NAME.
286 \fBPlease note\fR that only the package
287 .I name
288 is affected, not modules locations etc.
289 .TP
290 .BR \-\-pgpsign " name"
291 Set the string used to sign the
292 .B changes
293 file for any external modules in
294 .IR /usr/src/modules/
295 using PGP. This option will override the builtin default and the site
296 wide customizations stored in the file
297 .IR /etc/kernel-pkg.conf
298 or
299 .IR ~/.kernel-pkg.conf.
300 .TP
301 .BR \-\-config " target"
302 Change the type of configure done from the default \f(CWoldconfig\fR.
303 \fItarget\fR must be one of \f(CWoldconfig\fR, \f(CWconfig\fR, \f(CWmenuconfig\fR,
304 \f(CWxconfig\fR; or \f(CWold\fR, \f(CWmenu\fR, or \f(CWx\fR.
305 .Sp
306 This option is particularly useful when using \s-1PATCH_THE_KERNEL\s0 if some
307 of the patches change what configuration options are available.
308 .B Note
309 however that
310 .BR make\-kpkg
311 scans the config file at startup for some options, notably the fact
312 that modules are enabled or not, so toggling the status during the
313 delayed configuration results in an error. If needed, created the
314 configuration file as close to the desired one before calling
315 make\-kpkg with this switch.
316 .TP
317 .B \-\-targets
318 Prints out a list of known targets. See the Section
319 .B Targets
320 below.
321 .TP
322 .B \-\-noexec
323 Pass a
324 .B \-n
325 option to the
326 .I make
327 process so that commands are merely printed to the screen but not actually
328 executed. This is very useful for debugging.
329 .TP
330 .B \-\-initrd
331 If
332 .B make\-kpkg
333 is generating a
334 .I kernel-image
335 package, perform any actions
336 necessary for a kernel loaded using
337 .B initrd.
338 .B NOTE:
339 this requires a non-standard cramfs initrd patch to the kernel
340 sources, (unless the mkintrd configuration has been modified not to
341 use cramfs) or may result in a unbootable kernel. The patch is
342 generally present in the kernel sources shipped by Debian, but is not
343 present in pristine kernel sources. This option may include extra
344 dependencies, and modifications to maintainer scripts. It has no
345 effect when
346 .B make\-kpkg is not making a
347 .I kernel-image
348 package. The same effect can be achieved by setting the environment
349 variable
350 .B INITRD
351 to any non empty value.
352 To avoid a warning at install time, please read kernel-img.conf(5),
353 and add a
354 .I warn_initrd
355 directive in that file. To avoid the warning ar compile time, please
356 set the environment variable
357 .B INITRD_OK.
358 .TP
359 .B \-\-zimage
360 Makes a zImage kernel rather than a bzImage kernel (the default).
361 Useful for people having problems with bzImage kernels.
362 .TP
363 .B \-\-bzimage
364 Makes a bzImage kernel. Useful for people who want a bzImage kernel on
365 sites where the default is zImage kernels.
366 .TP
367 .B \-\-rootcmd foo
368 The command that provides a means of gaining super user access (for
369 example, `sudo' or `fakeroot') as needed by dpkg-buildpackage's -r
370 option.
371 .TP
372 .B \-\-us
373 This option is passed to dpkg-buildpackage, and directs that package
374 not to sign the source. This is only relevant for the buildpackage
375 target.
376 .TP
377 .B \-\-uc
378 This option is passed to dpkg-buildpackage, and directs that package
379 not to sign the changelog. This is only relevant for the buildpackage
380 target.
381 .PP
382 The options maybe shortened to the smallest unique string, and may
383 be entered with either a \- or a \-\- prefix, and you may use a space
384 or an = symbol between an option string and a value. You may also use
385 the form option=value; for details these and other variant forms
386 supported, please read man Getopt::Long (3perl).
387 .SH TARGETS
388 .TP
389 .B clean
390 Cleans the kernel source directory of all files created by target
391 .B build,
392 and runs a make distclean. (Please look at a Linux kernel Makefile for
393 details). Please note that although we take care of the list of
394 current kernel configuration contained in the file
395 .I .config,
396 the file
397 .I include/linux/autoconf.h
398 is not preserved.
399 .TP
400 .B buildpackage
401 This target runs the targets
402 .B clean,
403 and
404 .B binary,
405 and produces the complete package using
406 .B dpkg-buildpackage
407 .TP
408 .B binary
409 This target produces all four Debian kernel packages by running the
410 targets
411 .B kernel_source, kernel_headers, kernel_doc
412 and
413 .B kernel_image.
414 .TP
415 .B kernel_source
416 This target produces a debianised package of the Linux kernel sources.
417 If the environment variable
418 .B SOURCE_CLEAN_HOOK
419 points to an executable, then that executable shall be run from the
420 temporary (top) directory of the kernel sources just before packaging it,
421 .I ./debian/tmp-source/usr/src/kernel-source-X.X.XX,
422 so people may take any action they see fit (remove arch trees, prune
423 version control directories,
424 .I find . \-type d \-name CVS \-prune \-exec rm \-rf {} \\;
425 etc). This has no effect on anything
426 other than the kernel sources that are being packaged -- if the script
427 operates on the current directory and its children, the original
428 source tree should remain intact. The environment variables
429 .B HEADER_CLEAN_HOOK
430 and
431 .B DOC_CLEAN_HOOK
432 are similiar. The should point tp executables, then that executable
433 shall be run from the temporary (top) directory of the kernel headers
434 and coumentation just before packaging respectively, so people may
435 take any action they see fit. This also has no effect on anything
436 other than the sources that are being packaged.
437 .TP
438 .B kernel_headers
439 This target produces a Debian package containing the header files
440 included in the Linux kernel.
441 .TP
442 .B kernel_doc
443 This target produces a Debian package containing the documentation
444 included in the Linux kernel.
445 .TP
446 .B kernel_image
447 This target produces a Debian package of the Linux kernel source
448 image, and any modules configured in the kernel configuration file
449 .I .config.
450 If there is no
451 .I .config
452 file in the kernel source directory, a default configuration is
453 provided similar to the one used to create the
454 .B Debian
455 boot\-floppies.
456 .IP
457 If the file
458 .I ./debian/post-install
459 exists, and is an executable, it is run just before the kernel image
460 package is created. Also, please note that if there are any scripts in
461 .I ./debian/image.d/
462 directory,
463 .B run-parts
464 shall be called on that directory just before the kernel image package is
465 built. The location of the root of the image package being built shall
466 be passed in the environment variable
467 .B IMAGE_TOP,
468 and the kernel versions is passed in through the environment variable
469 .B version
470 for all these scripts.
471 .IP
472 On initial installation, the image package updates symbolic links in
473 the symbolic link destination directory (the root directory by
474 default) to point to the new kernel image in the image directory,
475 which is nominally
476 .I /boot.
477 If the symbolic link already points to the current kernel image, no
478 action is taken. If a prior symbolic link exists, it is rotated out
479 with a suffix.old, and a new symbolic link, properly updated is
480 installed in its place (the variable minimal_swap in
481 .I /etc/kernel-img.conf
482 further modifies this behaviour). No action is taken on upgrades.
483 .IP
484 On installation, it also offers to run the Linux loader,
485 .I LILO
486 (or alternates like
487 .I loadlin, SILO, QUIK, VMELILO, ZIPL, yaboot, PALO
488 or
489 .I GRUB
490 ), creating a configuration file for supported boot loaders
491 if needed. At that time it also offers to put the new kernel on a
492 floppy, formatting the floppy if needed. On deletion, the package
493 checks the version of the kernel running, and refuses to delete a
494 running kernel.
495 .I grub
496 rates a special mention here, since grub may not need to be rerun
497 after installing a kernel image, though an automated change to the
498 menu list would be nice on install and removal of kernel image
499 packages.
500 .IP
501 Please see the documentation about hooks in
502 .B kernel-img.conf(5).
503 These hooks are variables that can be pointed to scripts that add or
504 remove a line from the grub menu list at kernel image install and
505 remove times. A sample script to add lines to a grub menu file is
506 included in the directory
507 .TT /usr/share/doc/kernel-package/.
508 .TP
509 .B build
510 This target, used by target
511 .B kernel_image
512 above, compiles the
513 Linux
514 kernel image.
515 .TP
516 .B modules
517 This target allows you to build all add-on modules and packages that are
518 very dependent on the precise kernel version they are compiled for at the
519 same time you build your kernel image. This target expects to find the
520 modules or packages under /usr/src/modules, and, for all such directories,
521 changes to /usr/src/modules/x, and runs the
522 .B kdist
523 rule in the local
524 .I debian.rules
525 file. This target should create the
526 .B Debian
527 module package(s), and may also produce a compressed tar file, and a
528 compressed diff file, with
529 .I md5sums
530 recorded in a changes file using
531 .B dpkg-genchanges.
532 The file is signed by the same identity that would be used to sign the
533 kernel packages. This option is used by maintainers uploading the
534 package to the Debian archives.
535 .TP
536 .B modules_config
537 This target allows you to configure all packages under
538 .B /usr/src/modules.
539 This is useful if you need to manually modify some aspects of the
540 configuration, or if you want to manually compile the add on modules.
541 .TP
542 .B modules_image
543 This target allows you to build all packages under
544 .B /usr/src/modules,
545 but does not create the source or diff files, and does not create and sign
546 a changes file. This is the only modules related option you need if
547 you just want to compile the add on modules image files for
548 installation on one or more machines. Generally called in conjunction
549 with
550 .B kernel_image,
551 especially if also using the option
552 .B append_to_version
553 (prevents spurious warnings).
554 .TP
555 .B modules_clean
556 This target allows you to clean all packages under
557 .B /usr/src/modules,
558 and this should be all that is needed to undo the effect of any of the
559 other modules_ targets.
560 .TP
561 .B configure
562 This target runs configure (actually,
563 .B config_target,
564 set by
565 .B --config
566 which defaults to
567 .I oldconfig
568 ) early, so you may edit files generated by
569 .B make config
570 in the kernel source directory and not have them stomped by
571 .B make\-kpkg
572 later.
573 .TP
574 .B debian
575 This target creates the
576 .I ./debian
577 directory, and optionally patches the source. This is called by the
578 .B configure
579 target. You may use this target to have the sources patched, and then
580 manually run the configuration step.
581 .TP
582 .B libc\-kheaders
583 This is a special target for the libc-dev maintainer, who can use it
584 to create the headers package that libc needs. Please note that it is
585 dangerous to create a libc-kheaders package that is different from the
586 headers libc was compiled with; it is
587 .B known
588 to subtly break systems. Please look at
589 .I /usr/share/kernel-package/README.headers
590 for details. Creating and installing a self created libc-kheaders
591 package may break your system unless you know what you are doing. You
592 have been warned.
593 .SH "ENVIRONMENT VARIABLES"
594 The following variables (documented above) affect
595 .B make-kpkg:
596 .I DEBIAN_REVISION_MANDATORY
597 .I APPEND_TO_VERSION
598 .I VERSION_H_OK
599 .I PATCH_THE_KERNEL
600 .I NO_UNPATCH_BY_DEFAULT
601 .I KPKG_ARCH
602 .I CROSS_COMPILE
603 .I KPKG_SUBARCH
604 .I ARCH_IN_NAME
605 .I INITRD
606 .I SOURCE_CLEAN_HOOK
607 .I MODULE_LOC
608 .I INITRD_OK
609 .SH FILES
610 Apart from the runtime options, the
611 .I debian.rules
612 file run by
613 .B make\-kpkg
614 also looks for a per user configuration file
615 .I ~/.kernel-pkg.conf.
616 Failing that, it looks for site\-wide defaults in the file
617 .I /etc/kernel-pkg.conf.
618 The default configuration allows there to be a site wide override for
619 the full name and email address of the person responsible for maintaining
620 the kernel packages on the site, but the
621 .I /etc/kernel-pkg.conf
622 (or
623 .I ~/.kernel-pkg.conf.
624 ) file is actually a Makefile snippet, and any legal make directives
625 may be included in there.
626 .B Note:
627 Caution is urged with this file, since you can totally change the way that the
628 make is run by suitably editing this file. Please look at
629 .I /usr/share/doc/kernel-package/Problems.gz
630 for a list of known problems while compiling kernel images. Extensive
631 tutorial like documentation is also available in
632 .I /usr/share/doc/kernel-package/README.gz
633 and it is recommended that one read that before using this utility.
634 .SH "SEE ALSO"
635 .BR kernel-pkg.conf (5),
636 .BR kernel-img.conf (5),
637 .BR Getopt::Long (3perl),
638 .BR dpkg-deb (1),
639 .BR dpkg-source (1),
640 .BR make (1),
641 .BR The\ Programmers\ manual,
642 .BR The\ GNU\ Make\ manual,
643 and the extensive documentation in the directory
644 .B /usr/share/doc/kernel-package
645 .SH AUTHOR
646 This manual page was written by Manoj Srivastava <srivasta@debian.org>,
647 for the Debian GNU/Linux system.

  ViewVC Help
Powered by ViewVC 1.1.5