1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971
|
#! /usr/bin/perl
# -*- Mode: Perl -*-
# make-kpkg ---
# Author : root ( root@melkor.pilgrim.umass.edu )
# Created On : Mon Jun 17 01:10:11 1996
# Created On Node : melkor.pilgrim.umass.edu
# Last Modified By : Manoj Srivastava
# Last Modified On : Wed Feb 6 10:33:28 2002
# Last Machine Used: glaurung.green-gryphon.com
# Update Count : 180
# Status : Unknown, Use with caution!
# HISTORY :
# Description :
#
#
#
# $Id: make-kpkg,v 1.72 2002/04/12 20:03:33 srivasta Exp $
#
require 5.002;
use strict;
use Getopt::Long;
=head1 NAME
make-kpkg - build Debian kernel packages from Linux kernel sources.
=cut
($main::MYNAME = $main::0) =~ s|.*/||;
$main::Author = "Manoj Srivastava";
$main::AuthorMail = "srivasta\@debian.org";
$main::Version = '$Revision: 1.72 $ ';
my $added_modules='';
my $added_patches='';
my $append_to_version='';
my $arch='';
my $arch_in_name=0;
my $bzimage;
my $config_target='oldconfig';
my $cross_compile='';
my $flavour='';
my $key_id='';
my $help_opt=0;
my $noexec;
my $initrd=0;
my $revision=0;
my $root_cmd;
my $signature="" ;
my $subarch='';
my $targ_opt=0;
my $unsign_changelog='';
my $unsign_source='';
my $zimage;
my %option_ctl = ("help" => \$help_opt,
"noexec" => \$noexec,
"initrd" => \$initrd,
"revision=s" => \$revision,
"flavour=s" => \$flavour,
"added_modules=s" => \$added_modules,
"added-modules=s" => \$added_modules,
"added-patches=s" => \$added_patches,
"added_patches=s" => \$added_patches,
"append-to-version=s" => \$append_to_version,
"append_to_version=s" => \$append_to_version,
"arch=s" => \$arch,
"config=s" => \$config_target,
"cross_compile=s" => \$cross_compile,
"cross-compile=s" => \$cross_compile,
"subarch=s" => \$subarch,
"arch_in_name" => \$arch_in_name,
"arch-in-name" => \$arch_in_name,
"pgpsign=s" => \$signature,
"key_id=s" => \$key_id,
"targets" => \$targ_opt,
"zimage" => \$zimage,
"rootcmd=s" => \$root_cmd,
"us" => \$unsign_source,
"uc" => \$unsign_changelog,
"bzimage" => \$bzimage
);
=head1 SYNOPSIS
usage: make-kpkg [options] [target [target ...]]
=cut
=head1 DESCRIPTION
This manual page explains the Debian B<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.
=cut
=head1 OPTIONS
=over 3
=item B<--help> Print out a usage message.
=item B<--revision> number
=over 2
Sets the Debian revision number for the packages produced to the
argument B<number>. This has certain constraints: It only has an
effect during the configure phase (in other words, if a file called
stamp-configure or both debian/changelog and debian/official exists,
this option has no effect -- run make-kpkg clean or manually remove
stamp-configure, and stamp-debian (and debian/official, if that
exists) for it to have an effect). 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. B<NOTE>: No hyphens allowed. (Look at the
Debian policy manual for details). I<Actually, that is a lie: official
kernel and modules maintainers have special dispensation to use hyphens,
but it is strongly deprecated for most people, since we do no sanitization
of the version number, and dpkg and friends may choke on it at the end
of the compile unless one knows what one is doing.>
Optionally, you may prepend the revision with a digit followed by a colon (:)
This is because B<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.
=back
=item B<--append-to-version> foo
=item B<--append_to_version> foo
This argument (B<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 B<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 B<make-kpkg clean> after configuring
the kernel using make (x|menu)?config, since that creates
include/linux/version.h without the appended version I<foo>.
=back
=item B<--flavour> foo
=over 2
This option is now deprecaetd in favour of B<--append_to_version>.
Sets the kernel flavour to the argument B<foo>. The flavour is also
appended to the package name. You need a patched Makefile to make this
work properly (see /usr/share/doc/kernel-package/Flavours.gz). It may
contain only B<lowercase> alphanumerics and the characters - + . (full
stop, hyphen, and plus). Uppercase letters are not permitted under the
Policy for a new package. B<NOTE>: Hyphens are discouraged. (Look at
Chapters 4 of the Policy manual for details).
=back
=item B<--added-modules> foo
=item B<--added_modules> foo
=over 2
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 C<MODULE_LOC>, which defaults to /usr/src/modules.
The default is that all modules in C<MODULE_LOC> are compiled when
the modules_blah targets are invoked.
=back
=item B<--added-patches> foo
=item B<--added_patches> foo
=over 2
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
C<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 C<PATCH_THE_KERNEL> to YES)
=back
=item B<--arch> foo
=over 2
Sets the architecture. This is mostly useful when cross compiling.
=back
=item B<--cross-compile> foo
=item B<--cross_compile> foo
=over 2
Sets the target string. This is mostly useful when cross compiling.
=back
=item B<--subarch> foo
=over 2
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.
=back
=item B<--arch-in-name> foo
=item B<--arch_in_name> foo
=over 2
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.
=back
=item B<--pgpsign> name
=over 2
Set the string used to sign the B<changes> file for any external modules
in I</usr/src/modules/> using PGP. This option will override the builtin
default and the site wide customizations stored in the file
I</etc/kernel-pkg.conf>.
=back
=item B<--config> I<target>
=over 2
Change the type of configure done from the default C<oldconfig>.
I<target> must be one of C<oldconfig>, C<config>, C<menuconfig>,
C<xconfig>, or C<old>, C<menu> or C<x>.
This option is particularly useful when using PATCH_THE_KERNEL if some
of the patches change what configuration options are available.
=back
=item B<--targets>
=over 2
Prints out a list of known targets. See the Section B<Targets> below.
=back
=item B<--noexec>
=over 2
Pass a B<-n> option to the I<make> so that commands are merely
printed to the screen but not actually executed. This is very
useful for debugging.
=back
=item B<--initrd>
=over 2
If make-kpkg is generating a kernel-image package, perform any actions
necessary for a kernel loaded using initrd. This may include extra
dependencies, and modifications to maintainer scripts. It has no
effect when make-kpkg is not making a kernel-image package.
=back
=item B<--zimage>
=over 2
Makes a zImage kernel rather than a bzImage kernel (the default).
Useful for people having problems with bzImage kernels.
=back
=item B<--bzimage>
=over 2
Makes a bzImage kernel. Useful for people who want a bzImage kernel
on sites where the default is zImage kernels.
=back
=item B<--rootcmd>
=over 2
The command that provides a means of gaining superuser access (for
example, `sudo' or `fakeroot') as needed by dpkg-buildpackages' C<-r>
option.
=back
=item B<--us>
=over 2
This option is passed to dpkg-buildpackage, and directs that package
not to sign the source. This is only relevant to the buildpackage
target.
=back
=item B<--uc>
=over 2
This option is passed to dpkg-buildpackage, and directs that package
not to sign the changelog. This is only relevant to the buildpackage
target.
=back
=back
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. Please refer to man
Getopt::Long for details on how the options may be entered.
=cut
my $usage = <<"EOUSAGE";
This program should be run in a linux kernel source top level directory.
/usr/share/doc/kernel-package/Problems.gz contains a list of known problems.
usage: $main::MYNAME [options] target [target ...]
where options are:
--help This message.
--revision number The debian revision number. ([a-zA-Z.+0-9]) (Must
have digit, no hyphen allowed)
--flavour foo an additional kernel sub-version. ([-a-z.+0-9])
OBSOLETE
--append-to-version foo
--append_to_version foo an additional kernel sub-version. ([-a-z.+0-9])
Does not require editing the kernel Makefile
over rides env var APPEND_TO_VERSION.
requires a make-kpg clean
--added-modules foo
--added_modules foo Comma/space separated list of add on modules
affected by the modules_<blah> targets
--added-patches bar
--added_patches bar Comma/space separated list of patches applicable
when patch_the_kernel is turned on
--arch foo architecture
--cross-compile
--cross_compile target string
--subarch bar Set the subarch for the image being compiled
(have to be on a compatible machine).
--arch-in-name
--arch_in_name Embed the subarch in the image package name
--initrd Create a image package suitable for initrd
--pgpsign name An ID used to sign the changes file using pgp.
--config target Change the type of configure done from the default
oldconfig.
--targets Lists the known targets.
--noexec Pass a -n option to the make process
--zimage Create a kernel using zImage rather than bzImage
--bzimage Create a kernel using bzImage (in case the site
wide default is zimage, as set in
/etc/kernel-pkg.conf)
--rootcmd method A 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 for the
buildpackage target.
--uc This option is passed to dpkg-buildpackage, and
directs that package not to sign the
changelog. This is only relevant for the
buildpackage target.
Use one of --zimage or --bzimage, or none, but not both.
Option Format: 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 between an option string and a value. Please refer to man
Getopt::Long for details on how the options may be entered.
Version: $main::Version
$main::Author <$main::AuthorMail>
EOUSAGE
;
=head1 TARGETS
=over 3
=item B<clean>
=over 3
Cleans the kernel source directory of all files created by target
B<build>, and runs a I<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 I<.config>,
the file I<include/linux/autoconf.h> is not preserved.
=back
=item B<buildpackage>
=over 3
This target runs the targets B<clean>, B<build>, and B<binary>, and
produces the complete package using B<dpkg-buildpackage>.
=back
=item B<binary>
=over 3
This target produces all four Debian kernel packages by running the
targets B<kernel_source>, B<kernel_headers>, B<kernel_doc> and
B<kernel_image>.
=back
=item B<kernel_source>
=over 3
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 I</usr/src/linux> and
ensure that the link is pointed at the latest source/header package on
the system.
=back
=item B<kernel_headers>
=over 3
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
I</usr/src/linux> and ensure that the link is pointed at the latest
source/header package on the system.
=back
=item B<kernel_doc>
=over 3
This target produces a Debian package containing the documentation
included in the Linux kernel.
=back
=item B<kernel_image>
=over 3
This target produces a Debian package of the Linux kernel source
image, and any modules configured in the kernel configuration file
I<.config>. If there is no I<.config> file in the kernel source
directory, a default configuration is provided similar to the one used
to create the B<Debian> boot-floppies. The package produced updates
the symbolic links in the root directory to point to the new kernel
image in I</boot>. It also offers to run the Linux loader, B<LILO>
(or alternates like B<loadlin>, B<SILO>, B<QUIK>, B<VMELILO>, B<ZIPL>,
B<yaboot>, B<PALO> or B<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.
=back
=item B<build>
=over 3
This target, used by target B<kernel_image> above, compiles the Linux
kernel image.
=back
=item B<modules>
=over 3
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 I</usr/src/modules/x>, and runs the B<kdist> rule in
the local I<debian.rules> file. This target should create the B<Debian>
module package(s), and may also produce a compressed tar file, and a
compressed diff file, with I<md5sums> recorded in a changes file using
B<dpkg-genchanges>. The file is signed by the same identity that would
be used to sign the kernel packages.
=back
=item B<modules_config>
=over 3
This target allows you to configure all packages under
I</usr/src/modules>.
=back
=item B<modules_image>
=over 3
This target allows you to build all packages under I</usr/src/modules>,
but does not create the source or diff files, and does not create and
sign a changes file.
=back
=item B<modules_clean>
=over 3
This target allows you to clean the modules directories.
=back
=item B<configure>
=over 3
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.
=back
=back
=cut
my %Known_targets=("clean" => 1,
"buildpackage" => 1,
"binary" => 1,
"binary-indep" => 2,
"debian" => 1,
"kernel_source" => 3,
"kernel-source" => 3,
"kernel_headers" => 3,
"kernel-headers" => 3,
"libc-kheaders" => 3,
"kernel_doc" => 3,
"kernel-doc" => 3,
"binary-arch" => 2,
"kernel_image" => 3,
"kernel-image" => 3,
"build" => 4,
"modules" => 1,
"modules_image" => 1,
"modules_config" => 1,
"modules_clean" => 1,
"modules-image" => 1,
"modules-config" => 1,
"modules-clean" => 1,
"configure" => 1
);
my $targets_help =<<EOTRGT;
Known Targets are:
===============================================================================
| Targets | Automatically builds |
===============================================================================
| clean | |
| buildpackage | Builds the whole package |
| binary | Builds kernel_{source,headers,image,doc} |
| binary-indep | |
| kernel_source | |
| kernel_doc | |
| binary-arch | |
| kernel_headers | |
| kernel_image | Builds build |
| build | |
| modules | |
| modules_image | |
| modules_config | |
| modules_clean | |
| configure | If you wish to edit files |
| debian | generated by make config |
| debian | Creates ./debian dir, and |
| | optionally patches the source |
===============================================================================
See /usr/share/kernel-package/rules for details.
EOTRGT
;
sub main (){
my $ret;
my $rules_file;
my $target;
my $errors = "";
my $Targets = "";
$rules_file = "/usr/share/kernel-package/rules";
$ret = GetOptions(%option_ctl);
if(!$ret) {
print "use --help to display command line syntax help.\n" ;
exit 1;
}
if ($help_opt || $targ_opt){
print "$usage" if $help_opt;
print "$targets_help" if $targ_opt;
exit 0;
}
if ($bzimage && $zimage){
print "Use only one of bzimage and zimage options.\n";
print "use --help to display command line syntax help.\n";
exit 1;
}
if ($config_target !~ /^(?:|old|menu|x)(config)?$/) {
print "Config type must be one of {config,oldconfig,menuconfig,xconfig}.\n";
print "use --help to display command line syntax help.\n";
exit 1;
}
$config_target .= 'config' if ($1 eq '');
if ($ENV{'MAKEFLAGS'} =~ /-j/ || $ENV{'MAKEFLAGS'} =~ /--jobs/ ) {
$errors .= "The environment variable MAKEFLAGS contains the flag -j.\n" .
"Unfortunately, this is not supported at this time. Instead, please\n" .
"use the supported mechanism by setting CONCURRENCY_LEVEL\n" ;
}
if ($ENV{'MFLAGS'} =~ /-j/ || $ENV{'MFLAGS'} =~ /--jobs/ ) {
$errors .= "The environment variable MFLAGS contains the flag -j.\n" .
"Unfortunately, this is not supported at this time. Instead, please\n" .
"use the supported mechanism by setting CONCURRENCY_LEVEL\n" ;
}
if ($root_cmd || $unsign_source || $unsign_changelog){
if ($root_cmd){
if ($root_cmd =~ m/^-/o){
$errors .= "The rootcmd option takes a simple command name\n" .
"Like sudo or fakeroot. The leading - confuses me.\n" .
"rejecting rootcmd $root_cmd";
}
}
my $argstring = join (' ', @ARGV);
}
# Fine. Now we check targets.
foreach $target (@ARGV){
if ($Known_targets{$target}){
$Targets .= "$target ";
}
else {
$errors .= "Unknown target $target ";
}
}
if ($errors){
print STDERR "Error: $errors\n";
print "use --targets to display help on valid targets.\n";
exit 1;
}
# See if we are running in a linux kernel directory
if (!(-d "drivers" && -d "kernel" && -d "fs" && -d "include/linux")){
print STDERR <<EOERR;
We do not seem to be in a top level linux kernel source directory
tree. Since we are trying to make a kernel package, that does not make
sense. Please change directory to a top level linux kernel source
directory, and try again. (If I am wrong, and this is indeed a top
level linux kernel source directory, then I have gotten sadly out of
date with current kernels, and you should upgrade kernel-package)
EOERR
;
exit 1;
}
if (-f "stamp-debian" && -d "debian" && -x "debian/rules" &&
! -f "debian/official") {
if ($Targets !~ /^debian|configure/o) {
$rules_file = "debian/rules";
}
}
if (!-x "$rules_file"){
print STDERR <<EOERR1;
Could not locate the rules file (Normally found at the location
$rules_file), which would seem an
impossibility. I give up.
EOERR1
;
}
# Fine. Just do it!
my $command = "$rules_file ";
if ($signature){
$command .= " PGP_SIGNATURE=$signature ";
}
if ($revision) {
if (-e "debian/changelog") {
open(INPUT, "debian/changelog") or die "Can not open debian/changelog";
my $line=<INPUT>;
close INPUT;
chomp $line;
my $version = '';
$line =~ m/\((\S+)\)/;
$version = $1;
if ($revision && $version !~ m/$revision/) {
print STDERR <<"EOMSG";
I note that you are using the --revision flag with the value $revision.
However, the ./debian/changelog file exists, and has a different value
$version. I am confused by this discrepancy, and am halting.
EOMSG
;
exit (2);
}
}
$command .= " DEBIAN_REVISION=$revision ";
if ($revision !~ m/^(\d+:)?[a-zA-Z\d\.\+\-]+$/o) {
print STDERR " Error: The revision string may only contain\n";
print STDERR " alphanumerics and the characters + .\n";
print STDERR " If epochs are used, the colon : is also allowed\n";
print STDERR " The current value is: $revision\n";
print STDERR " Aborting.\n";
exit 1;
}
if ($revision =~ m/\-/o) {
print STDERR " I note you are using a hyphen in the revision number.\n";
print STDERR " Please ensure that the upstream and debian revision\n";
print STDERR " numbers are policy compliant enough that dpkg and\n";
print STDERR " shall not choke on them at the end of the compile\n";
print STDERR " Please hit return to continue\n";
my $ans = <STDIN>;
}
if ($revision !~ m/^(\d+:)?.*?\d.*$/){
print STDERR " Error: The revision string must contain digits,\n";
print STDERR " or else the package creation scripts complain\n";
print STDERR " The current value is: $revision\n";
print STDERR " Aborting.\n";
exit 1;
}
}
if ($flavour){
my $makefile_flavour = `grep FLAVOUR Makefile`;
if (! $makefile_flavour) {
print STDERR " Error: The top level makefile has not been edited\n";
print STDERR " to define FLAVOUR. Please read FLAVOURS.gz\n";
exit 1;
}
if ($flavour !~ m/^[a-z\d\.\-\+]+$/o) {
print STDERR " Error: The flavour variable may only contain\n";
print STDERR " lowercase alphanumerics and the characters - + .\n";
print STDERR " The current value is: $flavour\n";
print STDERR " Aborting.\n";
exit 1;
}
if ($flavour =~ m/[A-Z]+/o){
print STDERR "Error: Uppercase letters are not allowed in\n";
print STDERR "the flavour variable, since the flavour becomes\n";
print STDERR "part of the kernel-image name; and package names\n";
print STDERR "may only cantain lowercase alphanumerics.\n";
print STDERR "I have $flavour, which shall be dissallowed by the\n";
print STDERR "packaging tools. Aborting.\n";
exit 1;
}
$command .= " FLAVOUR=$flavour ";
}
if ($append_to_version){
if ($append_to_version !~ m/^[a-z\d\.\-\+]+$/o) {
print STDERR " Error: The extended version may only contain\n";
print STDERR " lowercase alphanumerics and the characters - + .\n";
print STDERR " The current value is: $append_to_version\n";
print STDERR " Aborting.\n";
exit 1;
}
if ($append_to_version =~ m/[A-Z]+/o){
print STDERR "Error: Uppercase letters are not allowed in\n";
print STDERR "the extended version, since the version becomes\n";
print STDERR "part of the kernel-image name; and package names\n";
print STDERR "may only contain lowercase alphanumerics.\n";
print STDERR "I have $append_to_version, which shall be dissallowed \n";
print STDERR "by the packaging tools. Aborting.\n";
exit 1;
}
if (-f "include/linux/version.h" && ! -f 'debian/official' &&
! $ENV{"VERSION_H_OK"}) {
print STDERR "Warning: The file include/linux/version.h exists\n";
print STDERR "If it was created just now by calling make-kpkg with\n";
print STDERR "the --append_to_version option on a clean source tree,\n";
print STDERR "please ignore this message. \n";
print STDERR "";
print STDERR "However, if the file exists from a previous run, and\n";
print STDERR "it existed before the make-kpkg --append_to_version was\n";
print STDERR "called, (for example, If you did not run make-kpkg clean\n";
print STDERR "after configuring the kernel with make (menu|x)?config)\n";
print STDERR "the chances are that it does not contain the appended:\n";
print STDERR "\t\t\t\"$append_to_version\"\n";
print STDERR "Please check the value of macro UTS_RELEASE in the file\n";
print STDERR "include/linux/version.h to make sure it is correct.\n";
print STDERR "If it is not correct (or if you are not sure), I \n";
print STDERR "strongly recommend that you abort now, and run:\n";
print STDERR " % make-kpkg clean\n";
print STDERR " % make-kpkg ... --append_to_version $append_to_version kernel_image [modules_image]\n";
print STDERR "By default, I assume you know what you are doing, and I\n";
print STDERR "apologize for being so annoying. Should I abort[Ny]?\n";
my $ans = <STDIN>;
if ($ans =~ m/^\s*[Yy]/g) {
print STDERR " Aborting.\n";
exit 1;
}
}
$command .= " APPEND_TO_VERSION=$append_to_version ";
}
if ($arch){
$command .= " KPKG_ARCH=$arch ";
}
if ($config_target ne 'oldconfig') {
$command .= " CONFIG_TARGET=$config_target ";
}
if ($cross_compile){
$command .= " CROSS_COMPILE=$cross_compile ";
}
if ($subarch){
$command .= " KPKG_SUBARCH=$subarch ";
}
if ($added_modules) {
$command .= " KPKG_SELECTED_MODULES=\"$added_modules\"";
}
if ($added_patches) {
$command .= " KPKG_SELECTED_PATCHES=\"$added_patches\"";
}
if ($arch_in_name){
$command .= " ARCH_IN_NAME=YES ";
}
if ($noexec){
$command .= " -n ";
}
if ($initrd) {
$command .= " INITRD=YES ";
}
if ($root_cmd){
$command .= " ROOT_CMD=$root_cmd ";
}
if ($unsign_changelog){
$command .= " UNSIGN_CHANGELOG=YES ";
}
if ($unsign_source){
$command .= " UNSIGN_SOURCE=YES ";
}
if ($zimage){
$command .= " IMAGE_TYPE=zImage ";
}
elsif ($bzimage) {
$command .= " IMAGE_TYPE=bzImage ";
}
my $hostcc = $ENV{'HOSTCC'};
$hostcc =~ s/^\s+//g;
$hostcc =~ s/\s+$//g;
$hostcc .= " ";
if ($hostcc eq " ") { $hostcc = "gcc"; };
my $cc = $ENV{'CC'};
$cc =~ s/^\s+//g;
$cc =~ s/\s+$//g;
$cc .= " ";
if ($cc eq ' ') { $cc = $cross_compile; $cc .= "gcc "; };
#$cc .= " -D__KERNEL__ -I";
#chomp($cc .= `pwd`);
#$cc .= "/include";
# For some reason, this causes all modules to fail
#$command .= " CC=\"$cc\" HOSTCC=\"$hostcc\"";
$command .= " $Targets";
# print STDERR $command;
exec $command;
}
## Now just call main
&main();
=head1 FILES
Apart from the runtime options, the debian.rules file run by B<make-kpkg>
also looks for site-wide defaults in the file I</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
I</etc/kernel-pkg.conf> file is actually a I<Makefile> snippet, and any
legal make directives may be included in there. B<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
I</usr/share/doc/kernel-package/Problems.gz> for a list of known
problems while compiling kernel images.
=cut
=head1 B<SEE ALSO>
B<kernel-pkg.conf>(5), B<dpkg-deb>(1), B<dpkg-source>(1), B<make>(1),
B<The GNU Make manual>, and the extensive documentation in the
directory I</usr/share/doc/kernel-package/>
=cut
=head1 BUGS
None known so far.
=cut
=head1 AUTHOR
This was written by Manoj Srivastava <srivasta@debian.org>, for the
Debian GNU/Linux system.
=cut
exit 0;
__END__
|