Commit 6cc28377 authored by Leann Ogasawara's avatar Leann Ogasawara Committed by Tim Gardner
Browse files

UBUNTU: [debian] Initial debian and ubuntu directories


Ignore: yes
Signed-off-by: default avatarTim Gardner <tim.gardner@canonical.com>
parent 2134d97a
UBUNTU: Bump ABI
Ignore: yes
#
# This template is used for commit messages that don't need to
# show up in debian/changelog. Administrative stuff like config
# updates, ABI bumps, etc. Setting 'Ignore: yes' prevents
# 'debian/rules insertchanges' from inserting this commit meesage
# as a changelog entry.
#
# Please give a one-line description of the config change followed
# by a detailed explanation if necessary
UBUNTU: [Config] XXXX
# BugLink: http://bugs.launchpad.net/bugs/<enter bug# here>
# Ignore: yes
# Other text below here.
# Ubuntu external driver commit.
#
# NOTE: This gets reformatted for README.Ubuntu-External-Drivers and
# debian/changelog.
#
# This is only needed when a driver is added, updated or removed. It is
# not needed when patches or fixes are applied to the driver. If the
# driver is being removed, add the line:
#
# Removing: yes
#
# to the commit, and you can remove all other tags (except UBUNTU:).
#
UBUNTU:
ExternalDriver:
Description:
Url:
Mask:
Version:
UBUNTU: build/modules: Add modules that have intentionally gone missing
Ignore: yes
UBUNTU: Start new release
Ignore: yes
# Ubuntu commit template.
#
# NOTE: This gets reformatted for debian/changelog
#
#
# SAUCE refers to the fact that this patch might not go upstream, but we need to
# carry it to successive releases. In most cases you DONOT want to use this
# template.
#
# An example of a SAUCE patch is the ACPI DSDT-in-initramfs patch which has been
# refused upstream, but still provides useful functionality to users with broken
# BIOSes.
#
#-------------------------------------------------------------------------
#
# The initial UBUNTU is a flag that this is an Ubuntu commit. It will be
# referenced to the Author in the debian/changelog entry.
#
# The text following is the short message that will be placed in the
# changelog. Extra text on the following lines will be ignored, but left
# in the git commit. Lines with # will be ignored in the commit.
#
# OriginalAuthor allows for alternate attribution.
#
# OriginalLocation allows for a URL or description of where the patch came
# from.
#
# BugLink is a URL to a Malone bug.
#
# Ignore: yes will keep this commit from showing up in the changelog.
#
UBUNTU: SAUCE:
<Why is this patch not going upstream?>
# OriginalAuthor:
# OriginalLocation:
# BugLink: http://bugs.launchpad.net/bugs/<enter bug# here>
# Ignore: yes
# Other text below here.
# Ubuntu commit template.
#
# NOTE: This gets reformatted for debian/changelog
#
# The initial UBUNTU is a flag that this is an Ubuntu commit. It will be
# referenced to the Author in the debian/changelog entry.
#
# The text following is the short message that will be placed in the
# changelog. Extra text on the following lines will be ignored, but left
# in the git commit. Lines with # will be ignored in the commit.
#
# OriginalAuthor allows for alternate attribution.
#
# OriginalLocation allows for a URL or description of where the patch came
# from.
#
# BugLink is a URL to a Malone bug.
#
# Ignore: yes will keep this commit from showing up in the changelog.
#
UBUNTU: [Upstream]
# OriginalAuthor:
# OriginalLocation:
# BugLink: http://bugs.launchpad.net/bugs/<enter bug# here>
# Ignore: yes
# Other text below here.
5
#!/usr/bin/perl
# -*- Mode: Cperl -*-
# debian.postinst ---
# Author : Manoj Srivastava ( srivasta@pilgrim.umass.edu )
# Created On : Sat Apr 27 05:42:43 1996
# Created On Node : melkor.pilgrim.umass.edu
# Last Modified By : Manoj Srivastava
# Last Modified On : Sat Aug 5 13:20:22 2006
# Last Machine Used: glaurung.internal.golden-gryphon.com
# Update Count : 45
# Status : Unknown, Use with caution!
# HISTORY :
# Description :
#
#
#
# arch-tag: 1c716174-2f0a-476d-a626-a1322e62503a
#
$|=1;
# Predefined values:
my $version = "=V";
my $kimage = "=K";
my $package_name = "linux-image-$version";
# Ignore all invocations uxcept when called on to configure.
exit 0 unless ($ARGV[0] && $ARGV[0] =~ /configure/);
#known variables
my $image_dest = "/";
my $realimageloc = "/boot/";
my $silent_modules = '';
my $modules_base = '/lib/modules';
my $CONF_LOC = '/etc/kernel-img.conf';
# remove multiple leading slashes; make sure there is at least one.
$realimageloc =~ s|^/*|/|o;
$realimageloc =~ s|/+|/|o;
chdir '/usr/src' or die "Could not chdir to /usr/src:$!";
if (-r "$CONF_LOC" && -f "$CONF_LOC" ) {
if (open(CONF, "$CONF_LOC")) {
while (<CONF>) {
chomp;
s/\#.*$//g;
next if /^\s*$/;
$header_postinst_hook = "$1" if /^\s*header_postinst_hook\s*=\s*(\S+)/ig;
}
close CONF;
}
}
sub exec_script {
my $type = shift;
my $script = shift;
print STDERR "Running $type hook script $script.\n";
system ("$script $version $realimageloc$kimage-$version") &&
print STDERR "User $type hook script [$script] ";
if ($?) {
if ($? == -1) {
print STDERR "failed to execute: $!\n";
}
elsif ($? & 127) {
printf STDERR "died with signal %d, %s coredump\n",
($? & 127), ($? & 128) ? 'with' : 'without';
}
else {
printf STDERR "exited with value %d\n", $? >> 8;
}
exit $? >> 8;
}
}
sub run_hook {
my $type = shift;
my $script = shift;
if ($script =~ m,^/,) {
# Full path provided for the hook script
if (-x "$script") {
&exec_script($type,$script);
}
else {
die "The provided $type hook script [$script] could not be run.\n";
}
}
else {
# Look for it in a safe path
for my $path ('/bin', '/sbin', '/usr/bin', '/usr/sbin') {
if (-x "$path/$script") {
&exec_script($type, "$path/$script");
return 0;
}
}
# No luck
print STDERR "Could not find $type hook script [$script].\n";
die "Looked in: '/bin', '/sbin', '/usr/bin', '/usr/sbin'\n";
}
}
## Run user hook script here, if any
if (-x "$header_postinst_hook") {
&run_hook("postinst", $header_postinst_hook);
}
if (-d "/etc/kernel/header_postinst.d") {
print STDERR "Examining /etc/kernel/header_postinst.d.\n";
system ("run-parts --verbose --exit-on-error --arg=$version " .
"--arg=$realimageloc$kimage-$version " .
"/etc/kernel/header_postinst.d") &&
die "Failed to process /etc/kernel/header_postinst.d";
}
if (-d "/etc/kernel/header_postinst.d/$version") {
print STDERR "Examining /etc/kernel/header_postinst.d/$version.\n";
system ("run-parts --verbose --exit-on-error --arg=$version " .
"--arg=$realimageloc$kimage-$version " .
"/etc/kernel/header_postinst.d/$version") &&
die "Failed to process /etc/kernel/header_postinst.d/$version";
}
exit 0;
__END__
This diff is collapsed.
#! /usr/bin/perl
# -*- Mode: Cperl -*-
# image.postrm ---
# Author : Manoj Srivastava ( srivasta@glaurung.green-gryphon.com )
# Created On : Sat May 15 11:05:13 1999
# Created On Node : glaurung.green-gryphon.com
# Last Modified By : Manoj Srivastava
# Last Modified On : Wed Sep 13 11:26:19 2006
# Last Machine Used: glaurung.internal.golden-gryphon.com
# Update Count : 57
# Status : Unknown, Use with caution!
# HISTORY :
# Description :
#
# $Id: image.postrm,v 1.31 2003/10/07 16:24:20 srivasta Exp $
#
#
#use strict; #for debugging
use Cwd 'abs_path';
$|=1;
# Predefined values:
my $version = "=V";
my $link_in_boot = ""; # Should be empty, mostly
my $no_symlink = ""; # Should be empty, mostly
my $reverse_symlink = ""; # Should be empty, mostly
my $do_symlink = "Yes"; # target machine defined
my $do_boot_enable = "Yes"; # target machine defined
my $do_bootfloppy = "Yes"; # target machine defined
my $do_bootloader = "Yes"; # target machine defined
my $move_image = ''; # target machine defined
my $kimage = "=K"; # Should be empty, mostly
my $loader = "=L"; # lilo, silo, quik, palo, vmelilo, or nettrom
my $image_dir = "/boot"; # where the image is located
my $clobber_modules = ''; # target machine defined
my $initrd = "YES"; # initrd kernel
my $do_initrd = ''; # Normally, we don't
my $warn_initrd = 'YES'; # Normally we do
my $use_hard_links = ''; # hardlinks do not work across fs boundaries
my $postinst_hook = ''; #Normally we do not
my $postrm_hook = ''; #Normally we do not
my $preinst_hook = ''; #Normally we do not
my $prerm_hook = ''; #Normally we do not
my $minimal_swap = ''; # Do not swap symlinks
my $ignore_depmod_err = ''; # normally we do not
my $relink_build_link = 'YES'; # There is no harm in checking the link
my $force_build_link = ''; # we shall not create a dangling link
my $kernel_arch = "=B";
my $ramdisk = "/usr/sbin/update-initramfs";
my $package_name = "linux-image-$version";
my $Loader = "NoLOADER"; #
$Loader = "LILO" if $loader =~ /^lilo/io;
$Loader = "SILO" if $loader =~ /^silo/io;
$Loader = "QUIK" if $loader =~ /^quik/io;
$Loader = "yaboot" if $loader =~ /^yaboot/io;
$Loader = "PALO" if $loader =~ /^palo/io;
$Loader = "NETTROM" if $loader =~ /^nettrom/io;
$Loader = "VMELILO" if $loader =~ /^vmelilo/io;
$Loader = "ZIPL" if $loader =~ /^zipl/io;
$Loader = "ELILO" if $loader =~ /^elilo/io;
# This should not point to /tmp, because of security risks.
my $temp_file_name = "/var/log/$loader" . "_log.$$";
#known variables
my @boilerplate = ();
my @silotemplate = ();
my @quiktemplate = ();
my @palotemplate = ();
my @vmelilotemplate = ();
my $bootdevice = '';
my $rootdevice = '';
my $rootdisk = '';
my $rootpartition = '';
my $image_dest = "/";
my $realimageloc = "/$image_dir/";
my $have_conffile = "";
my $CONF_LOC = '/etc/kernel-img.conf';
my $relative_links = '';
my $silent_modules = '';
my $silent_loader = '';
my $warn_reboot = 'Yes'; # Warn that we are installing a version of
# the kernel we are running
chdir('/') or die "could not chdir to /:$!\n";
# remove multiple leading slashes; make sure there is at least one.
$realimageloc =~ s|^/*|/|o;
$realimageloc =~ s|/+|/|o;
if (-r "$CONF_LOC" && -f "$CONF_LOC" ) {
if (open(CONF, "$CONF_LOC")) {
while (<CONF>) {
chomp;
s/\#.*$//g;
next if /^\s*$/;
$do_symlink = "" if /^\s*do_symlinks\s*=\s*(no|false|0)\s*$/ig;
$no_symlink = "" if /^\s*no_symlinks\s*=\s*(no|false|0)\s*$/ig;
$reverse_symlink = "" if /^\s*reverse_symlinks\s*=\s*(no|false|0)\s*$/ig;
$link_in_boot = "" if /^\s*image_in_boot\s*=\s*(no|false|0)\s*$/ig;
$link_in_boot = "" if /^\s*link_in_boot\s*=\s*(no|false|0)\s*$/ig;
$move_image = "" if /^\s*move_image\s*=\s*(no|false|0)\s*$/ig;
$clobber_modules = '' if /^\s*clobber_modules\s*=\s*(no|false|0)\s*$/ig;
$do_boot_enable = '' if /^\s*do_boot_enable\s*=\s*(no|false|0)\s*$/ig;
$do_bootfloppy = '' if /^\s*do_bootfloppy\s*=\s*(no|false|0)\s*$/ig;
$relative_links = '' if /^\s*relative_links \s*=\s*(no|false|0)\s*$/ig;
$do_bootloader = '' if /^\s*do_bootloader\s*=\s*(no|false|0)\s*$/ig;
$do_initrd = '' if /^\s*do_initrd\s*=\s*(no|false|0)\s*$/ig;
$warn_initrd = '' if /^\s*warn_initrd\s*=\s*(no|false|0)\s*$/ig;
$use_hard_links = '' if /^\s*use_hard_links\s*=\s*(no|false|0)\s*$/ig;
$silent_modules = '' if /^\s*silent_modules\s*=\s*(no|false|0)\s*$/ig;
$silent_loader = '' if /^\s*silent_loader\s*=\s*(no|false|0)\s*$/ig;
$warn_reboot = '' if /^\s*warn_reboot\s*=\s*(no|false|0)\s*$/ig;
$minimal_swap = '' if /^\s*minimal_swap\s*=\s*(no|false|0)\s*$/ig;
$ignore_depmod_err = '' if /^\s*ignore_depmod_err\s*=\s*(no|false|0)\s*$/ig;
$relink_build_link = '' if /^\s*relink_build_link\s*=\s*(no|false|0)\s*$/ig;
$force_build_link = '' if /^\s*force_build_link\s*=\s*(no|false|0)\s*$/ig;
$do_symlink = "Yes" if /^\s*do_symlinks\s*=\s*(yes|true|1)\s*$/ig;
$no_symlink = "Yes" if /^\s*no_symlinks\s*=\s*(yes|true|1)\s*$/ig;
$reverse_symlink = "Yes" if /^\s*reverse_symlinks\s*=\s*(yes|true|1)\s*$/ig;
$link_in_boot = "Yes" if /^\s*image_in_boot\s*=\s*(yes|true|1)\s*$/ig;
$link_in_boot = "Yes" if /^\s*link_in_boot\s*=\s*(yes|true|1)\s*$/ig;
$move_image = "Yes" if /^\s*move_image\s*=\s*(yes|true|1)\s*$/ig;
$clobber_modules = "Yes" if /^\s*clobber_modules\s*=\s*(yes|true|1)\s*$/ig;
$do_boot_enable = "Yes" if /^\s*do_boot_enable\s*=\s*(yes|true|1)\s*$/ig;
$do_bootfloppy = "Yes" if /^\s*do_bootfloppy\s*=\s*(yes|true|1)\s*$/ig;
$do_bootloader = "Yes" if /^\s*do_bootloader\s*=\s*(yes|true|1)\s*$/ig;
$relative_links = "Yes" if /^\s*relative_links\s*=\s*(yes|true|1)\s*$/ig;
$do_initrd = "Yes" if /^\s*do_initrd\s*=\s*(yes|true|1)\s*$/ig;
$warn_initrd = "Yes" if /^\s*warn_initrd\s*=\s*(yes|true|1)\s*$/ig;
$use_hard_links = "Yes" if /^\s*use_hard_links\s*=\s*(yes|true|1)\s*$/ig;
$silent_modules = 'Yes' if /^\s*silent_modules\s*=\s*(yes|true|1)\s*$/ig;
$silent_loader = 'Yes' if /^\s*silent_loader\s*=\s*(yes|true|1)\s*$/ig;
$warn_reboot = 'Yes' if /^\s*warn_reboot\s*=\s*(yes|true|1)\s*$/ig;
$minimal_swap = 'Yes' if /^\s*minimal_swap\s*=\s*(yes|true|1)\s*$/ig;
$ignore_depmod_err = 'Yes' if /^\s*ignore_depmod_err\s*=\s*(yes|true|1)\s*$/ig;
$relink_build_link = 'Yes' if /^\s*relink_build_link\s*=\s*(yes|true|1)\s*$/ig;
$force_build_link = 'Yes' if /^\s*force_build_link\s*=\s*(yes|true|1)\s*$/ig;
$image_dest = "$1" if /^\s*image_dest\s*=\s*(\S+)/ig;
$postinst_hook = "$1" if /^\s*postinst_hook\s*=\s*(\S+)/ig;
$postrm_hook = "$1" if /^\s*postrm_hook\s*=\s*(\S+)/ig;
$preinst_hook = "$1" if /^\s*preinst_hook\s*=\s*(\S+)/ig;
$prerm_hook = "$1" if /^\s*prerm_hook\s*=\s*(\S+)/ig;
$ramdisk = "$1" if /^\s*ramdisk\s*=\s*(.+)$/ig;
}
close CONF;
$have_conffile = "Yes";
}
}
if ($link_in_boot) {
$image_dest = "/$image_dir/";
$image_dest =~ s|^/*|/|o;
}
$image_dest = "$image_dest/";
$image_dest =~ s|/+$|/|o;
# The destdir may be gone by now.
if (-d "$image_dest") {
chdir("$image_dest") or die "could not chdir to $image_dest:$!\n";
}
# Paranoid check to make sure that the correct value is put in there
if (! $kimage) {$kimage = "vmlinuz"} # Hmm. empty
elsif ($kimage =~ m/^b?uImage$/o) {$kimage = "vmlinuz"} # these produce vmlinuz
elsif ($kimage =~ m/^b?zImage$/o) {$kimage = "vmlinuz"} # these produce vmlinuz
elsif ($kimage =~ m/^[iI]mage$/o) { my $nop = $kimage;}
elsif ($kimage =~ m/^vmlinux$/o) { my $nop = $kimage;}
else {$kimage = "vmlinuz"} # default
$ENV{KERNEL_ARCH}=$kernel_arch if $kernel_arch;
######################################################################
######################################################################
############
######################################################################
######################################################################
sub remove_sym_link {
my $bad_image = $_[0];
warn "Removing symbolic link $bad_image \n";
if ($loader =~ /lilo/i)
{
warn "Unless you used the optional flag in lilo, \n";
}
warn " you may need to re-run your boot loader" . ($loader ? "[$loader]":"")
. "\n";
# Remove the dangling link
unlink "$bad_image";
}
######################################################################
######################################################################
############
######################################################################
######################################################################
sub CanonicalizePath {
my $path = join '/', @_;
my @work = split '/', $path;
my @out;
my $is_absolute;
if (@work && $work[0] eq "") { $is_absolute = 1; shift @work; }
while (@work) {
my $seg = shift @work;
if ($seg eq "." || $seg eq "") {
} elsif ($seg eq "..") {
if (@out && $out[-1] ne "..") {
pop @out;
} else {
# Leading "..", or "../..", etc.
push @out, $seg;
}
} else {
push @out, $seg;
}
}
unshift @out, "" if $is_absolute;
return join('/', @out);
}
######################################################################
######################################################################
############
######################################################################
######################################################################
# This removes dangling symlinks. What do we do about hard links? Surely a
# something with the nane $image_dest . "$kimage" ought not to be left behind?
sub image_magic {
my $kimage = $_[0];
my $image_dest = $_[1];
if (-l "$kimage") {
# There is a symbolic link
my $force_move = 0;
my $vmlinuz_target = readlink "$kimage";
my $real_target = '';
$real_target = abs_path($vmlinuz_target) if defined ($vmlinuz_target);
if (!defined($vmlinuz_target) || ! -f "$real_target") {
# what, a dangling symlink?
warn "The link " . $image_dest . "$kimage is a damaged link\n";
# Remove the dangling link
&remove_sym_link("$kimage");
}
else {
my $canonical_target = CanonicalizePath("$vmlinuz_target");
if (! -e $canonical_target) {
warn "The link " . $image_dest . "$kimage is a dangling link\n";
&remove_sym_link("$kimage");
}
}
}
}
# set the env var stem
$ENV{'STEM'} = "linux";
sub exec_script {
my $type = shift;
my $script = shift;
print STDERR "Running $type hook script $script.\n";
system ("$script $version $realimageloc$kimage-$version") &&
print STDERR "User $type hook script [$script] ";
if ($?) {
if ($? == -1) {
print STDERR "failed to execute: $!\n";
}
elsif ($? & 127) {
printf STDERR "died with signal %d, %s coredump\n",
($? & 127), ($? & 128) ? 'with' : 'without';
}
else {
printf STDERR "exited with value %d\n", $? >> 8;
}
}
}
sub run_hook {
my $type = shift;
my $script = shift;
if ($script =~ m,^/,) {
# Full path provided for the hook script
if (-x "$script") {
&exec_script($type,$script);
}
else {
warn "The provided $type hook script [$script] could not be run.\n";
}
}
else {
# Look for it in a safe path
for my $path ('/bin', '/sbin', '/usr/bin', '/usr/sbin') {
if (-x "$path/$script") {
&exec_script($type, "$path/$script");
return 0;
}
}
# No luck
print STDERR "Could not find $type hook script [$script].\n";
warn "Looked in: '/bin', '/sbin', '/usr/bin', '/usr/sbin'\n";
}
}
my $options;
for (@ARGV) {
s,','\\'',g;
$options .= " '$_'";
}
$ENV{'DEB_MAINT_PARAMS'}="$options";
## Run user hook script here, if any
if ($postrm_hook) {
&run_hook("postrm", $postrm_hook);
}
if (-d "/etc/kernel/postrm.d") {
warn "Examining /etc/kernel/postrm.d .\n";
system ("run-parts --verbose --exit-on-error --arg=$version " .
"--arg=$realimageloc$kimage-$version " .
"/etc/kernel/postrm.d") &&
die "Failed to process /etc/kernel/postrm.d";
}
if (-d "/etc/kernel/postrm.d/$version") {
warn "Examining /etc/kernel/postrm.d/$version .\n";
system ("run-parts --verbose --exit-on-error --arg=$version " .
"--arg=$realimageloc$kimage-$version " .
"/etc/kernel/postrm.d/$version") &&
die "Failed to process /etc/kernel/postrm.d/$version";
}
# check and remove damaged and dangling symlinks
if ($ARGV[0] !~ /upgrade/) {
system("$ramdisk -d -k " . $version . " > /dev/null 2>&1");
if (-f $realimageloc . "initrd.img-$version.bak") {
unlink $realimageloc . "initrd.img-$version.bak";
}
image_magic($kimage, $image_dest);
image_magic($kimage . ".old", $image_dest);
image_magic("initrd.img", $image_dest) if $initrd;
image_magic("initrd.img.old", $image_dest) if $initrd;
}
exit 0;
__END__
#! /usr/bin/perl
# -*- Mode: Cperl -*-
# image.preinst ---
# Author : Manoj Srivastava ( srivasta@tiamat.datasync.com )
# Created On : Sun Jun 14 03:38:02 1998
# Created On Node : tiamat.datasync.com
# Last Modified By : Manoj Srivastava
# Last Modified On : Sun Sep 24 14:04:42 2006
# Last Machine Used: glaurung.internal.golden-gryphon.com
# Update Count : 99
# Status : Unknown, Use with caution!
# HISTORY :
# Description :
#
#
#
#use strict; #for debugging
use Debconf::Client::ConfModule qw(:all);
version('2.0');
my $capb=capb("backup");
$|=1;
# Predefined values:
my $version = "=V";
my $link_in_boot = ""; # Should be empty, mostly
my $no_symlink = ""; # Should be empty, mostly
my $reverse_symlink = ""; # Should be empty, mostly
my $do_symlink = "Yes"; # target machine defined
my $do_boot_enable = "Yes"; # target machine defined
my $do_bootfloppy = "Yes"; # target machine defined
my $do_bootloader = "Yes"; # target machine defined
my $move_image = ''; # target machine defined
my $kimage = "=K"; # Should be empty, mostly
my $loader = "=L"; # lilo, silo, quik, palo, vmelilo, nettrom
# or elilo
my $image_dir = "/boot"; # where the image is located
my $initrd = "YES"; # initrd kernel
my $use_hard_links = ''; # hardlinks do not wirk across fs boundaries
my $postinst_hook = ''; #Normally we do not
my $postrm_hook = ''; #Normally we do not
my $preinst_hook = ''; #Normally we do not
my $prerm_hook = ''; #Normally we do not
my $minimal_swap = ''; # Do not swap symlinks
my $ignore_depmod_err = ''; # normally we do not
my $relink_src_link = 'YES'; # There is no harm in checking the link
my $relink_build_link = 'YES'; # There is no harm in checking the link
my $force_build_link = ''; # There is no harm in checking the link
my $kernel_arch = "=B";
my $ramdisk = "/usr/sbin/update-initramfs"; # List of tools to create initial ram fs.
my $package_name = "linux-image-$version";
my $Loader = "NoLOADER"; #
$Loader = "LILO" if $loader =~ /^lilo/io;
$Loader = "SILO" if $loader =~ /^silo/io;
$Loader = "QUIK" if $loader =~ /^quik/io;
$Loader = "yaboot" if $loader =~ /^yaboot/io;
$Loader = "PALO" if $loader =~ /^palo/io;
$Loader = "NETTROM" if $loader =~ /^nettrom/io;
$Loader = "VMELILO" if $loader =~ /^vmelilo/io;
$Loader = "ZIPL" if $loader =~ /^zipl/io;
$Loader = "ELILO" if $loader =~ /^elilo/io;
#known variables
my @boilerplate = ();
my @silotemplate = ();
my @quiktemplate = ();
my @palotemplate = ();
my @vmelilotemplate = ();
my $bootdevice = '';
my $rootdevice = '';
my $rootdisk = '';
my $rootpartition = '';
my $image_dest = "/";
my $realimageloc = "/$image_dir/";
my $have_conffile = "";
my $CONF_LOC = '/etc/kernel-img.conf';
my $relative_links = '';
my $silent_loader = '';
my $warn_reboot = ''; # Warn that we are installing a version of
# the kernel we are running
my $modules_base = '/lib/modules';
die "Pre inst Internal error. Aborting." unless $version;
exit 0 if $ARGV[0] =~ /abort-upgrade/;
exit 1 unless $ARGV[0] =~ /(install|upgrade)/;
$arch = `uname -i`;
if ($arch =~ m/86/) {
system ("grep -q ' pae ' /proc/cpuinfo");
if ($?) {
print STDERR "This kernel does not support a non-PAE CPU.\n";
exit 1;
}
}
# remove multiple leading slashes; make sure there is at least one.
$realimageloc =~ s|^/*|/|o;
$realimageloc =~ s|/+|/|o;
if (-r "$CONF_LOC" && -f "$CONF_LOC" ) {
if (open(CONF, "$CONF_LOC")) {
while (<CONF>) {
chomp;
s/\#.*$//g;
next if /^\s*$/;
$do_symlink = "" if /^\s*do_symlinks\s*=\s*(no|false|0)\s*$/ig;
$no_symlink = "" if /^\s*no_symlinks\s*=\s*(no|false|0)\s*$/ig;
$reverse_symlink = "" if /^\s*reverse_symlinks\s*=\s*(no|false|0)\s*$/ig;
$link_in_boot = "" if /^\s*image_in_boot\s*=\s*(no|false|0)\s*$/ig;
$link_in_boot = "" if /^\s*link_in_boot\s*=\s*(no|false|0)\s*$/ig;
$move_image = "" if /^\s*move_image\s*=\s*(no|false|0)\s*$/ig;
$do_boot_enable = '' if /^\s*do_boot_enable\s*=\s*(no|false|0)\s*$/ig;
$do_bootfloppy = '' if /^\s*do_bootfloppy\s*=\s*(no|false|0)\s*$/ig;
$do_bootloader = '' if /^\s*do_bootloader\s*=\s*(no|false|0)\s*$/ig;
$relative_links = '' if /^\s*relative_links \s*=\s*(no|false|0)\s*$/ig;
$use_hard_links = '' if /^\s*use_hard_links\s*=\s*(no|false|0)\s*$/ig;
$silent_loader = '' if /^\s*silent_loader\s*=\s*(no|false|0)\s*$/ig;
$warn_reboot = '' if /^\s*warn_reboot\s*=\s*(no|false|0)\s*$/ig;
$minimal_swap = '' if /^\s*minimal_swap\s*=\s*(no|false|0)\s*$/ig;
$ignore_depmod_err = '' if /^\s*ignore_depmod_err\s*=\s*(no|false|0)\s*$/ig;
$relink_src_link = '' if /^\s*relink_src_link\s*=\s*(no|false|0)\s*$/ig;
$relink_build_link = '' if /^\s*relink_build_link\s*=\s*(no|false|0)\s*$/ig;
$force_build_link = '' if /^\s*force_build_link\s*=\s*(no|false|0)\s*$/ig;
$do_symlink = "Yes" if /^\s*do_symlinks\s*=\s*(yes|true|1)\s*$/ig;
$no_symlink = "Yes" if /^\s*no_symlinks\s*=\s*(yes|true|1)\s*$/ig;
$reverse_symlink = "Yes" if /^\s*reverse_symlinks\s*=\s*(yes|true|1)\s*$/ig;
$link_in_boot = "Yes" if /^\s*image_in_boot\s*=\s*(yes|true|1)\s*$/ig;
$link_in_boot = "Yes" if /^\s*link_in_boot\s*=\s*(yes|true|1)\s*$/ig;
$move_image = "Yes" if /^\s*move_image\s*=\s*(yes|true|1)\s*$/ig;
$do_boot_enable = "Yes" if /^\s*do_boot_enable\s*=\s*(yes|true|1)\s*$/ig;
$do_bootfloppy = "Yes" if /^\s*do_bootfloppy\s*=\s*(yes|true|1)\s*$/ig;
$do_bootloader = "Yes" if /^\s*do_bootloader\s*=\s*(yes|true|1)\s*$/ig;
$relative_links = "Yes" if /^\s*relative_links\s*=\s*(yes|true|1)\s*$/ig;
$use_hard_links = "Yes" if /^\s*use_hard_links\s*=\s*(yes|true|1)\s*$/ig;
$silent_loader = 'Yes' if /^\s*silent_loader\s*=\s*(yes|true|1)\s*$/ig;
$warn_reboot = 'Yes' if /^\s*warn_reboot\s*=\s*(yes|true|1)\s*$/ig;
$minimal_swap = 'Yes' if /^\s*minimal_swap\s*=\s*(yes|true|1)\s*$/ig;
$ignore_depmod_err = 'Yes' if /^\s*ignore_depmod_err\s*=\s*(yes|true|1)\s*$/ig;
$relink_src_link = 'Yes' if /^\s*relink_src_link\s*=\s*(yes|true|1)\s*$/ig;
$relink_build_link = 'Yes' if /^\s*relink_build_link\s*=\s*(yes|true|1)\s*$/ig;
$force_build_link = 'Yes' if /^\s*force_build_link\s*=\s*(yes|true|1)\s*$/ig;
$image_dest = "$1" if /^\s*image_dest\s*=\s*(\S+)/ig;
$postinst_hook = "$1" if /^\s*postinst_hook\s*=\s*(\S+)/ig;
$postrm_hook = "$1" if /^\s*postrm_hook\s*=\s*(\S+)/ig;
$preinst_hook = "$1" if /^\s*preinst_hook\s*=\s*(\S+)/ig;
$prerm_hook = "$1" if /^\s*prerm_hook\s*=\s*(\S+)/ig;
$ramdisk = "$1" if /^\s*ramdisk\s*=\s*(.+)$/ig;
}
close CONF;
$have_conffile = "Yes";
$have_conffile = "Yes"; # stop perl complaining
}
}
$ENV{KERNEL_ARCH}=$kernel_arch if $kernel_arch;
# About to upgrade this package from version $2 TO THIS VERSION.
# "prerm upgrade" has already been called for the old version of
# this package.
sub find_initrd_tool {
my $hostversion = shift;
my $version = shift;
my @ramdisks =
grep {
my $args =
"$_ " .
"--supported-host-version=$hostversion " .
"--supported-target-version=$version " .
"1>/dev/null 2>&1"
;
system($args) == 0;
}
split (/[:,\s]+/, $ramdisk);
}
sub check {
my $version = shift;
my $lib_modules="$modules_base/$version";
my $message = '';
if (-d "$lib_modules") {
opendir(DIR, $lib_modules) || die "can’t opendir $lib_modules: $!";
my @children = readdir(DIR);
if ($#children > 1) {
my @dirs = grep { -d "$lib_modules/$_" } @children;
if ($#dirs > 1) { # we have subdirs
my $dir_message='';
for my $dir (@dirs) {
if ($dir =~/kernel$/) {
$dir_message="An older install was detected.\n";
}
else {
$dir_message="Module sub-directories were detected.\n"
unless $dir_message;
}
}
$message += $dir_message if $dir_message;
}
my @links = grep { -l "$lib_modules/$_" } @children;
if ($#links > -1) {
my $links_message = '';
for my $link (@links) {
next if ($link =~ /^build$/);
next if ($link =~ /^source$/);
$links_message = "Symbolic links were detected in $modules_base/$version.\n";
}
$message += $links_message if $links_message;
}
my @files = grep { -f "$lib_modules/$_" } @children;
$message += "Additional files also exist in $modules_base/$version.\n"
if ($#files > -1);
}
}
else { $message .= "$lib_modules does not exist. ";}
return $message;
}
if (-d "$modules_base/$version") {
my $errors=check($version);
warn "Info:\n$errors\n" if $errors;
}
# set the env var stem
$ENV{'STEM'} = "linux";
sub exec_script {
my $type = shift;
my $script = shift;
print STDERR "Running $type hook script $script.\n";
system ("$script $version $realimageloc$kimage-$version") &&
print STDERR "User $type hook script [$script] ";
if ($?) {
if ($? == -1) {
print STDERR "failed to execute: $!\n";
}
elsif ($? & 127) {
printf STDERR "died with signal %d, %s coredump\n",
($? & 127), ($? & 128) ? 'with' : 'without';
}
else {
printf STDERR "exited with value %d\n", $? >> 8;
}
exit $? >> 8;
}
}
sub run_hook {
my $type = shift;
my $script = shift;
if ($script =~ m,^/,) {
# Full path provided for the hook script
if (-x "$script") {
&exec_script($type,$script);
}
else {
die "The provided $type hook script [$script] could not be run.\n";
}
}
else {
# Look for it in a safe path
for my $path ('/bin', '/sbin', '/usr/bin', '/usr/sbin') {
if (-x "$path/$script") {
&exec_script($type, "$path/$script");
return 0;
}
}
# No luck
print STDERR "Could not find $type hook script [$script].\n";
die "Looked in: '/bin', '/sbin', '/usr/bin', '/usr/sbin'\n";
}
}
my $options;
for (@ARGV) {
s,','\\'',g;
$options .= " '$_'";
}
$ENV{'DEB_MAINT_PARAMS'}="$options";
## Run user hook script here, if any
if (-x "$preinst_hook") {
&run_hook("preinst", $preinst_hook);
}
if (-d "/etc/kernel/preinst.d") {
print STDERR "Examining /etc/kernel/preinst.d/\n";
system ("run-parts --verbose --exit-on-error --arg=$version" .
" --arg=$realimageloc$kimage-$version" .
" /etc/kernel/preinst.d") &&
die "Failed to process /etc/kernel/preinst.d";
}
if (-d "/etc/kernel/preinst.d/$version") {
print STDERR "Examining /etc/kernel/preinst.d/$version.\n";
system ("run-parts --verbose --exit-on-error --arg=$version" .
" --arg=$realimageloc$kimage-$version" .
" /etc/kernel/preinst.d/$version") &&
die "Failed to process /etc/kernel/preinst.d/$version";
}
print STDERR "Done.\n";
exit 0;
__END__
#! /usr/bin/perl
# -*- Mode: Perl -*-
# image.prerm ---
# Author : root ( root@melkor.pilgrim.umass.edu )
# Created On : Fri May 17 03:28:59 1996
# Created On Node : melkor.pilgrim.umass.edu
# Last Modified By : Manoj Srivastava
# Last Modified On : Sat Aug 5 13:14:17 2006
# Last Machine Used: glaurung.internal.golden-gryphon.com
# Update Count : 85
# Status : Unknown, Use with caution!
# HISTORY :
# Description :
#
#
# $Id: image.prerm,v 1.22 2003/10/07 16:24:20 srivasta Exp $
#
#
#use strict;
$|=1;
# Predefined values:
my $version = "=V";
my $link_in_boot = ""; # Should be empty, mostly
my $no_symlink = ""; # Should be empty, mostly
my $reverse_symlink = ""; # Should be empty, mostly
my $do_symlinks = "Yes"; # target machine defined
my $do_boot_enable = "Yes"; # target machine defined
my $do_bootfloppy = "Yes"; # target machine defined
my $do_bootloader = "Yes"; # target machine defined
my $move_image = ''; # target machine defined
my $kimage = "=K"; # Should be empty, mostly
my $loader = "=L"; # lilo, silo, quik, palo, vmelilo, or nettrom
my $image_dir = "/boot"; # where the image is located
my $clobber_modules = ''; # target machine defined
my $initrd = "YES"; # initrd kernel
my $use_hard_links = ''; # hardlinks do not wirk across fs boundaries
my $postinst_hook = ''; #Normally we do not
my $postrm_hook = ''; #Normally we do not
my $preinst_hook = ''; #Normally we do not
my $prerm_hook = ''; #Normally we do not
my $minimal_swap = ''; # Do not swap symlinks
my $ignore_depmod_err = ''; # normally we do not
my $relink_build_link = 'YES'; # There is no harm in checking the link
my $force_build_link = ''; # There is no harm in checking the link
my $kernel_arch = "=B";
my $ramdisk = "/usr/sbin/update-initramfs";
my $package_name = "linux-image-$version";
my $Loader = "NoLOADER"; #
$Loader = "LILO" if $loader =~ /^lilo/io;
$Loader = "SILO" if $loader =~ /^silo/io;
$Loader = "QUIK" if $loader =~ /^quik/io;
$Loader = "yaboot" if $loader =~ /^yaboot/io;
$Loader = "PALO" if $loader =~ /^palo/io;
$Loader = "NETTROM" if $loader =~ /^nettrom/io;
$Loader = "VMELILO" if $loader =~ /^vmelilo/io;
$Loader = "ZIPL" if $loader =~ /^zipl/io;
$Loader = "ELILO" if $loader =~ /^elilo/io;
# This should not point to /tmp, because of security risks.
my $temp_file_name = "/var/log/$loader" . "_log.$$";
#known variables
my $image_dest = "/";
my $realimageloc = "/$image_dir/";
my $have_conffile = "";
my $CONF_LOC = '/etc/kernel-img.conf';
my $relative_links = '';
my $silent_loader = '';
my $warn_reboot = 'Yes'; # Warn that we are installing a version of
# the kernel we are running
# remove multiple leading slashes; make sure there is at least one.
$realimageloc =~ s|^/*|/|o;
$realimageloc =~ s|/+|/|o;
my $DEBUG = 0;
# Variables used
my $image='';
my $ret=0;
my $seen='';
my $answer='';
my $running = '';
my $WouldInvalidate = 0;
if ($ARGV[0] && ($ARGV[0] =~ /remove/ || $ARGV[0] =~ /upgrade/)) {
if (-l "/usr/doc/linux-image-$version") {
unlink "/usr/doc/linux-image-$version";
}
}
# Ignore all invocations uxcept when called on to remove
exit 0 unless ($ARGV[0] && $ARGV[0] =~ /remove/) ;
# Paranoid check to make sure that the correct value is put in there
if (! $kimage) { $kimage = "vmlinuz";} # Hmm. empty
elsif ($kimage =~ m/^b?uImage$/o) { $kimage = "vmlinuz";} # these produce vmlinuz
elsif ($kimage =~ m/^b?zImage$/o) { $kimage = "vmlinuz";} # these produce vmlinuz
elsif ($kimage =~ m/^[iI]mage$/o) { my $nop = $kimage; }
elsif ($kimage =~ m/^vmlinux$/o) { my $nop = $kimage; }
else { $kimage = "vmlinuz";} # Default
if (-r "$CONF_LOC" && -f "$CONF_LOC" ) {
if (open(CONF, "$CONF_LOC")) {
while (<CONF>) {
chomp;
s/\#.*$//g;
next if /^\s*$/;
$do_symlink = "" if /^\s*do_symlinks\s*=\s*(no|false|0)\s*$/ig;
$no_symlink = "" if /^\s*no_symlinks\s*=\s*(no|false|0)\s*$/ig;
$reverse_symlink = "" if /^\s*reverse_symlinks\s*=\s*(no|false|0)\s*$/ig;
$link_in_boot = "" if /^\s*image_in_boot\s*=\s*(no|false|0)\s*$/ig;
$link_in_boot = "" if /^\s*link_in_boot\s*=\s*(no|false|0)\s*$/ig;
$move_image = "" if /^\s*move_image\s*=\s*(no|false|0)\s*$/ig;
$clobber_modules = '' if /^\s*clobber_modules\s*=\s*(no|false|0)\s*$/ig;
$do_boot_enable = '' if /^\s*do_boot_enable\s*=\s*(no|false|0)\s*$/ig;
$do_bootfloppy = '' if /^\s*do_bootfloppy\s*=\s*(no|false|0)\s*$/ig;
$relative_links = '' if /^\s*relative_links \s*=\s*(no|false|0)\s*$/ig;
$do_bootloader = '' if /^\s*do_bootloader\s*=\s*(no|false|0)\s*$/ig;
$do_initrd = '' if /^\s*do_initrd\s*=\s*(no|false|0)\s*$/ig;
$use_hard_links = '' if /^\s*use_hard_links\s*=\s*(no|false|0)\s*$/ig;
$silent_loader = '' if /^\s*silent_loader\s*=\s*(no|false|0)\s*$/ig;
$warn_reboot = '' if /^\s*warn_reboot\s*=\s*(no|false|0)\s*$/ig;
$minimal_swap = '' if /^\s*minimal_swap\s*=\s*(no|false|0)\s*$/ig;
$ignore_depmod_err = '' if /^\s*ignore_depmod_err\s*=\s*(no|false|0)\s*$/ig;
$relink_build_link = '' if /^\s*relink_build_link\s*=\s*(no|false|0)\s*$/ig;
$force_build_link = '' if /^\s*force_build_link\s*=\s*(no|false|0)\s*$/ig;
$do_symlink = "Yes" if /^\s*do_symlinks\s*=\s*(yes|true|1)\s*$/ig;
$no_symlink = "Yes" if /^\s*no_symlinks\s*=\s*(yes|true|1)\s*$/ig;
$reverse_symlink = "Yes" if /^\s*reverse_symlinks\s*=\s*(yes|true|1)\s*$/ig;
$link_in_boot = "Yes" if /^\s*image_in_boot\s*=\s*(yes|true|1)\s*$/ig;
$link_in_boot = "Yes" if /^\s*link_in_boot\s*=\s*(yes|true|1)\s*$/ig;
$move_image = "Yes" if /^\s*move_image\s*=\s*(yes|true|1)\s*$/ig;
$clobber_modules = "Yes" if /^\s*clobber_modules\s*=\s*(yes|true|1)\s*$/ig;
$do_boot_enable = "Yes" if /^\s*do_boot_enable\s*=\s*(yes|true|1)\s*$/ig;
$do_bootfloppy = "Yes" if /^\s*do_bootfloppy\s*=\s*(yes|true|1)\s*$/ig;
$do_bootloader = "Yes" if /^\s*do_bootloader\s*=\s*(yes|true|1)\s*$/ig;
$relative_links = "Yes" if /^\s*relative_links\s*=\s*(yes|true|1)\s*$/ig;
$do_initrd = "Yes" if /^\s*do_initrd\s*=\s*(yes|true|1)\s*$/ig;
$use_hard_links = "Yes" if /^\s*use_hard_links\s*=\s*(yes|true|1)\s*$/ig;
$silent_loader = 'Yes' if /^\s*silent_loader\s*=\s*(yes|true|1)\s*$/ig;
$warn_reboot = 'Yes' if /^\s*warn_reboot\s*=\s*(yes|true|1)\s*$/ig;
$minimal_swap = 'Yes' if /^\s*minimal_swap\s*=\s*(yes|true|1)\s*$/ig;
$ignore_depmod_err = 'Yes' if /^\s*ignore_depmod_err\s*=\s*(yes|true|1)\s*$/ig;
$relink_build_link = 'Yes' if /^\s*relink_build_link\s*=\s*(yes|true|1)\s*$/ig;
$force_build_link = 'Yes' if /^\s*force_build_link\s*=\s*(yes|true|1)\s*$/ig;
$image_dest = "$1" if /^\s*image_dest\s*=\s*(\S+)/ig;
$postinst_hook = "$1" if /^\s*postinst_hook\s*=\s*(\S+)/ig;
$postrm_hook = "$1" if /^\s*postrm_hook\s*=\s*(\S+)/ig;
$preinst_hook = "$1" if /^\s*preinst_hook\s*=\s*(\S+)/ig;
$prerm_hook = "$1" if /^\s*prerm_hook\s*=\s*(\S+)/ig;
$ramdisk = "$1" if /^\s*ramdisk\s*=\s*(.+)$/ig;
}
close CONF;
$have_conffile = "Yes";
}
}
$ENV{KERNEL_ARCH}=$kernel_arch if $kernel_arch;
#check to see if we are trying to remove a running kernel
# if so we abort right now.
chop($running=`uname -r`);
if ($running eq $version) {
print STDERR "WARN: Proceeding with removing running kernel image.\n";
}
#Now, they have an alternate kernel which they are currently running
# This is just us being nice to lilo users.
chdir("/") or die "could not chdir to /:$!\n";
if (-f "/etc/$loader.conf") { #I know, could be a link, but ..
open (LILO, "/etc/$loader.conf") || &success(); # this is not critical
while (<LILO>) {
chop;
s/\#.*//; # nix the comments
next unless /^\s*image\s*=\s(\S+)/o;
$image = $1;
if ($image && -e $image) {
while (defined($image) && -l $image) {
$image = readlink ($image);
}
if (defined($image) && -e $image) {
$WouldInvalidate |= $image =~ /$kimage-$version/;
}
else {
&success(); # invalid $loader.conf file
}
}
else {
&success(); # invalid $loader.conf file
}
}
close (LILO);
if ($WouldInvalidate) {
print STFERR "WARN: Proceeding with removing running kernel image.\n";
&success();
}
}
# set the env var stem
$ENV{'STEM'} = "linux";
sub exec_script {
my $type = shift;
my $script = shift;
print STDERR "Running $type hook script $script.\n";
system ("$script $version $realimageloc$kimage-$version") &&
print STDERR "User $type hook script [$script] ";
if ($?) {
if ($? == -1) {
print STDERR "failed to execute: $!\n";
}
elsif ($? & 127) {
printf STDERR "died with signal %d, %s coredump\n",
($? & 127), ($? & 128) ? 'with' : 'without';
}
else {
printf STDERR "exited with value %d\n", $? >> 8;
}
exit $? >> 8;
}
}
sub run_hook {
my $type = shift;
my $script = shift;
if ($script =~ m,^/,) {
# Full path provided for the hook script
if (-x "$script") {
&exec_script($type,$script);
}
else {
die "The provided $type hook script [$script] could not be run.\n";
}
}
else {
# Look for it in a safe path
for my $path ('/bin', '/sbin', '/usr/bin', '/usr/sbin') {
if (-x "$path/$script") {
&exec_script($type, "$path/$script");
return 0;
}
}
# No luck
print STDERR "Could not find $type hook script [$script].\n";
die "Looked in: '/bin', '/sbin', '/usr/bin', '/usr/sbin'\n";
}
}
my $options;
for (@ARGV) {
s,','\\'',g;
$options .= " '$_'";
}
$ENV{'DEB_MAINT_PARAMS'}="$options";
## Run user hook script here, if any
if (-x "$prerm_hook") {
&run_hook("prerm", $prerm_hook);
}
if (-d "/etc/kernel/prerm.d") {
print STDERR "Examining /etc/kernel/prerm.d.\n";
system ("run-parts --verbose --exit-on-error --arg=$version " .
"--arg=$realimageloc$kimage-$version /etc/kernel/prerm.d") &&
die "Failed to process /etc/kernel/prerm.d";
}
if (-d "/etc/kernel/prerm.d/$version") {
print STDERR "Examining /etc/kernel/prerm.d/$version.\n";
system ("run-parts --verbose --exit-on-error --arg=$version" .
" --arg=$realimageloc$kimage-$version " .
"/etc/kernel/prerm.d/$version") &&
die "Failed to process /etc/kernel/prerm.d/$version";
}
sub success () {
# NOTE: need to keep this list in sync with rules.d/2-binary-arch.mk
my %files_to_keep = (
'modules.builtin' => 1,
'modules.order' => 1,
);
my $short;
for my $file (</lib/modules/$version/modules.*>) {
$short = $file; $short =~ s,.*/,,;
if (!defined $files_to_keep{$short}) {
unlink "$file";
}
}
exit 0;
}
&success();
exit 0;
__END__
DEBIAN=debian.master
This README describes the reason for, and the use of, module
inclusion lists.
The original Hardy release had the notion of sub-flavours,
e.g., a flavour that was constructed as a subset of an existing flavour.
For example, the virtual flavour was extracted from the server flavour using
a subset of the server flavour modules. However, there were some difficult
mainteneance issues with regard to packaging, make rules, and scripts. This
re-implementation of the sub-flavours philosophy is hopefully simpler,
and retrofitable to all releases.
A module inclusion list looks at the problem of of constructing a package
from the perspective of what modules do we _want_ in the package, as opposed
to what modules we _don't_ want. As the kernel matures, more and more devices are added
which makes the problem of configuration maintenance a real pain in the ass.
If we took the approach of disabling all of the config options that we don't want,
then the differences between flavours will quickly become quite large, making
it difficult to quickly compare the individual flavour configs. Each time a
new config option is added then we also have to make a decision about disabling in
order to continue to keep the minimal number of modules.
A module inclusion list is applied on a per-flavour basis. For example,
debian.<BRANCH>/control.d/${flavour}.inclusion-list. For example, the
config for virtual is very close to server and generic, but the inclusion list
causes the virtual package to be constructed with _only_ the modules described
in the inclusion list.
The inclusion list format is a simple bash regular expression list of files. For example,
arch/*/{crypto,kernel,oprofile}
drivers/acpi/*
drivers/ata/ahci.ko
These 3 regular expression forms are suitable for expansion by bash and as inputs to 'find'.
See debian/scripts/module-inclusion for details.
There are 2 log files created as a side effect of the application of the module
inclusion list; $(flavour).inclusion-list.log and $(flavour).depmod.log.
$(flavour).inclusion-list.log : This log is created while the inclusion list
modules are being copied. If any are missing, then those warnings go in this log.
While its not considered a fatal error, you should endevour to correct your inclusion
list such that there are no missing modules.
$(flavour).depmod.log : The log is created as a result of running depmod on the
resulting set of modules. If there are missing symbols then you'll find that information
here. Again, you should modify your inclusion list such that there are no missing
symbols.
Tim Gardner <tim.gardner@canonical.com>
June 2, 2010
#!/usr/bin/make -f
#
# $(DEBIAN)/rules for Ubuntu linux
#
# Use this however you want, just give credit where credit is due.
#
# Copyright (c) 2007 Ben Collins <bcollins@ubuntu.com>
#
DEBIAN=$(shell awk -F= '($$1 == "DEBIAN") { print $$2 }' <debian/debian.env)
# dpkg-buildpackage passes options that are incomptatible
# with the kernel build.
unexport CFLAGS
unexport LDFLAGS
export LC_ALL=C
export SHELL=/bin/bash -e
# Where do we find the common configuration.
export DROOT=debian
# Common variables for all architectures
include $(DROOT)/rules.d/0-common-vars.mk
# Pull in some arch specific stuff
-include $(DEBIAN)/rules.d/$(arch).mk
# Maintainer targets
include $(DROOT)/rules.d/1-maintainer.mk
# Stages
ifeq ($(DEB_STAGE),stage1)
do_tools=false
do_doc_package=false
do_source_package=false
do_flavour_image_package=false
do_flavour_header_package=false
endif
# Debian Build System targets
binary: binary-indep binary-arch
build: build-arch build-indep
clean: debian/control
dh_testdir
dh_testroot
dh_clean
# d-i stuff
rm -rf $(DEBIAN)/d-i-$(arch)
# normal build junk
rm -rf $(DEBIAN)/abi/$(release)-$(revision)
rm -rf $(builddir)
rm -f $(stampdir)/stamp-*
rm -rf $(DEBIAN)/linux-*
# This gets rid of the d-i packages in control
cp -f $(DEBIAN)/control.stub $(DEBIAN)/control
cp $(DEBIAN)/changelog debian/changelog
# Install the copyright information.
cp $(DEBIAN)/copyright debian/copyright
distclean: clean
rm -rf $(DEBIAN)/control $(DEBIAN)/control.stub \
$(DEBIAN)/d-i/kernel-versions debian/changelog \
debian/control debian/control.stub debian/copyright
# Builds the image, arch headers and debug packages
include $(DROOT)/rules.d/2-binary-arch.mk
# Rules for building the udebs ($(DEBIAN)-installer)
include $(DROOT)/rules.d/5-udebs.mk
# Builds the source, doc and linux-headers indep packages
include $(DROOT)/rules.d/3-binary-indep.mk
# Various checks to be performed on builds
include $(DROOT)/rules.d/4-checks.mk
# Misc stuff
.PHONY: $(DEBIAN)/control.stub
$(DEBIAN)/control.stub: $(DEBIAN)/d-i/kernel-versions.in \
$(DROOT)/scripts/control-create \
$(DEBIAN)/control.stub.in \
$(DEBIAN)/changelog \
$(wildcard $(DEBIAN)/control.d/* $(DEBIAN)/sub-flavours/*.vars)
for i in $(DEBIAN)/d-i/kernel-versions.in $(DEBIAN)/control.stub.in; do \
new=`echo $$i | sed 's/\.in$$//'`; \
cat $$i | sed -e 's/PKGVER/$(release)/g' \
-e 's/ABINUM/$(abinum)/g' \
-e 's/SRCPKGNAME/$(src_pkg_name)/g' \
-e 's/=HUMAN=/$(human_arch)/g' \
> $$new; \
done
flavours="$(wildcard $(DEBIAN)/control.d/vars.* $(DEBIAN)/sub-flavours/*.vars)";\
for i in $$flavours; do \
$(SHELL) $(DROOT)/scripts/control-create $$i | \
sed -e 's/PKGVER/$(release)/g' \
-e 's/ABINUM/$(abinum)/g' \
-e 's/SRCPKGNAME/$(src_pkg_name)/g' \
-e 's/=HUMAN=/$(human_arch)/g' \
>> $(DEBIAN)/control.stub; \
done
cp $(DEBIAN)/control.stub $(DEBIAN)/control
.PHONY: debian/control
debian/control: $(DEBIAN)/control.stub
rm -rf $(builddir)/modules $(builddir)/firmware \
$(builddir)/kernel-versions $(builddir)/package-list \
$(builddir)/$(DEBIAN)
mkdir -p $(builddir)/modules/$(arch)/
cp $(DEBIAN)/d-i/modules/* $(builddir)/modules/$(arch)/
mkdir -p $(builddir)/firmware/$(arch)/
cp $(DEBIAN)/d-i/firmware/* $(builddir)/firmware/$(arch)/
cp $(DEBIAN)/d-i/package-list $(DEBIAN)/d-i/kernel-versions $(builddir)/
touch $(builddir)/modules/$(arch)/kernel-image
# kernel-wedge needs to poke around in $(DEBIAN)/
ln -nsf $(CURDIR)/debian $(builddir)/debian
# Some files may need to differ between architectures
if [ -d $(DEBIAN)/d-i/modules-$(arch) ]; then \
cp $(DEBIAN)/d-i/modules-$(arch)/* \
$(builddir)/modules/$(arch)/; \
fi
if [ -d $(DEBIAN)/d-i/firmware-$(arch) ]; then \
cp $(DEBIAN)/d-i/firmware-$(arch)/* \
$(builddir)/firmware/$(arch)/; \
fi
# Remove unwanted stuff for this architecture
if [ -r "$(DEBIAN)/d-i/exclude-modules.$(arch)" ]; then \
(cat $(DEBIAN)/d-i/exclude-modules.$(arch); \
ls $(builddir)/modules/$(arch)/) | sort | uniq -d | \
(cd $(builddir)/modules/$(arch)/; xargs rm -f); \
fi
if [ -r "$(DEBIAN)/d-i/exclude-firmware.$(arch)" ]; then \
(cat $(DEBIAN)/d-i/exclude-firmware.$(arch); \
ls $(builddir)/firmware/$(arch)/) | sort | uniq -d | \
(cd $(builddir)/firmware/$(arch)/; xargs rm -f); \
fi
# Per flavour module lists
flavour_modules=`ls $(DEBIAN)/d-i/modules.$(arch)-* 2>/dev/null` \
|| true; \
if [ "$$flavour_modules" != "" ]; then \
for flav in $$flavour_modules; do \
name=`echo $$flav | sed 's/.*\/modules.$(arch)-//'`; \
mkdir $(builddir)/modules/$(arch)-$$name; \
(cd $(builddir)/modules/; tar cf - `cat ../$$flav`) | \
(cd $(builddir)/modules/$(arch)-$$name/; tar xf -); \
touch $(builddir)/modules/$(arch)-$$name/kernel-image; \
done; \
fi
flavour_firmware=`ls $(DEBIAN)/d-i/firmware.$(arch)-* 2>/dev/null` \
|| true; \
if [ "$$flavour_firmware" != "" ]; then \
for flav in $$flavour_firmware; do \
name=`echo $$flav | sed 's/.*\/firmware.$(arch)-//'`; \
mkdir $(builddir)/firmware/$(arch)-$$name; \
(cd $(builddir)/firmware/; tar cf - `cat ../$$flav`) | \
(cd $(builddir)/firmware/$(arch)-$$name/; tar xf -);\
touch $(builddir)/firmware/$(arch)-$$name/kernel-image; \
done; \
fi
# Some files may need to differ between flavours
flavour_module_dirs=`ls -d $(DEBIAN)/d-i/modules-$(arch)-* 2>/dev/null`\
|| true; \
if [ "$$flavour_module_dirs" ]; then \
for flav in $$flavour_module_dirs; do \
name=`echo $$flav | sed 's/.*\/modules-$(arch)-//'`; \
[ -d $(builddir)/modules/$(arch)-$$name ] || \
cp -a $(builddir)/modules/$(arch) \
modules/$(arch)-$$name; \
cp $$flav/* $(builddir)/modules/$(arch)-$$name/; \
done; \
fi
flavour_firmware_dirs=`ls -d $(DEBIAN)/d-i/firmware-$(arch)-* 2>/dev/null`\
|| true; \
if [ "$$flavour_firmware_dirs" ]; then \
for flav in $$flavour_firmware_dirs; do \
name=`echo $$flav | sed 's/.*\/firmware-$(arch)-//'`; \
[ -d $(builddir)/firmware/$(arch)-$$name ] || \
cp -a $(builddir)/firmware/$(arch) \
firmware/$(arch)-$$name; \
cp $$flav/* $(builddir)/firmware/$(arch)-$$name/; \
done; \
fi
# Remove unwanted stuff for each flavour
flavour_exclude=`ls $(DEBIAN)/d-i/exclude-modules.$(arch)-* 2>/dev/null`\
|| true; \
if [ "$$flavour_exclude" ]; then \
for flav in $$flavour_exclude; do \
name=`echo $$flav | sed 's/.*\/exclude-modules.$(arch)-//'`;\
[ -d $(builddir)/modules/$(arch)-$$name ] || \
cp -a $(builddir)/modules/$(arch) \
$(builddir)/modules/$(arch)-$$name; \
(cat $$flav; \
ls $(builddir)/modules/$(arch)-$$name) | \
sort | uniq -d | \
(cd $(builddir)/modules/$(arch)-$$name/; \
xargs rm -f); \
done; \
fi
flavour_exclude=`ls $(DEBIAN)/d-i/exclude-firmware.$(arch)-* 2>/dev/null`\
|| true; \
if [ "$$flavour_exclude" ]; then \
for flav in $$flavour_exclude; do \
name=`echo $$flav | sed 's/.*\/exclude-firmware.$(arch)-//'`;\
[ -d $(builddir)/firmware/$(arch)-$$name ] || \
cp -a $(builddir)/firmware/$(arch) \
$(builddir)/firmware/$(arch)-$$name; \
(cat $$flav; \
ls $(builddir)/firmware/$(arch)-$$name) | \
sort | uniq -d | \
(cd $(builddir)/firmware/$(arch)-$$name/; \
xargs rm -f); \
done; \
fi
if [ ! -d $(builddir)/modules/$(build_arch) ]; then \
mkdir -p $(builddir)/modules/$(build_arch); \
cp $(builddir)/modules/$(arch)/* \
$(builddir)/modules/$(build_arch); \
fi
if [ ! -d $(builddir)/firmware/$(build_arch) ]; then \
mkdir -p $(builddir)/firmware/$(build_arch); \
cp $(builddir)/firmware/$(arch)/* \
$(builddir)/firmware/$(build_arch); \
fi
cp $(DEBIAN)/control.stub debian/control.stub
cd $(builddir) && kernel-wedge gen-control > $(CURDIR)/debian/control
#
# The source package name will be the first token from $(DEBIAN)/changelog
#
src_pkg_name=$(shell sed -n '1s/^\(.*\) (.*).*$$/\1/p' $(DEBIAN)/changelog)
# Get some version info
series := oneiric
release := $(shell sed -n '1s/^$(src_pkg_name).*(\(.*\)-.*).*$$/\1/p' $(DEBIAN)/changelog)
revisions := $(shell sed -n 's/^$(src_pkg_name)\ .*($(release)-\(.*\)).*$$/\1/p' $(DEBIAN)/changelog | tac)
revision ?= $(word $(words $(revisions)),$(revisions))
prev_revisions := $(filter-out $(revision),0.0 $(revisions))
prev_revision := $(word $(words $(prev_revisions)),$(prev_revisions))
family=ubuntu
# This is an internally used mechanism for the daily kernel builds. It
# creates packages whose ABI is suffixed with a minimal representation of
# the current git HEAD sha. If .git/HEAD is not present, then it uses the
# uuidgen program,
#
# AUTOBUILD can also be used by anyone wanting to build a custom kernel
# image, or rebuild the entire set of Ubuntu packages using custom patches
# or configs.
AUTOBUILD=
#
# This is a way to support some external variables. A good example is
# a local setup for ccache and distcc See LOCAL_ENV_CC and
# LOCAL_ENV_DISTCC_HOSTS in the definition of kmake.
# For example:
# LOCAL_ENV_CC="ccache distcc"
# LOCAL_ENV_DISTCC_HOSTS="localhost 10.0.2.5 10.0.2.221"
#
-include $(CURDIR)/../.$(series)-env
ifneq ($(AUTOBUILD),)
skipabi = true
skipmodule = true
skipdbg = true
gitver=$(shell if test -f .git/HEAD; then cat .git/HEAD; else uuidgen; fi)
gitverpre=$(shell echo $(gitver) | cut -b -3)
gitverpost=$(shell echo $(gitver) | cut -b 38-40)
abi_suffix = -$(gitverpre)$(gitverpost)
endif
ifneq ($(NOKERNLOG),)
ubuntu_log_opts += --no-kern-log
endif
ifneq ($(PRINTSHAS),)
ubuntu_log_opts += --print-shas
endif
# Get the kernels own extra version to be added to the release signature.
raw_kernelversion=$(shell make kernelversion)
#
# full_build -- are we doing a full buildd style build
#
ifeq ($(wildcard /CurrentlyBuilding),)
full_build?=false
else
full_build?=true
endif
#
# The debug packages are ginormous, so you probably want to skip
# building them (as a developer).
#
ifeq ($(full_build),false)
skipdbg=true
endif
abinum := $(shell echo $(revision) | sed -e 's/\..*//')$(abi_suffix)
prev_abinum := $(shell echo $(prev_revision) | sed -e 's/\..*//')$(abi_suffix)
abi_release := $(release)-$(abinum)
uploadnum := $(shell echo $(revision) | sed -e 's/.*\.//')
ifneq ($(full_build),false)
uploadnum := $(uploadnum)-Ubuntu
endif
# XXX: linux-libc-dev got bumped to -803.N inadvertantly by a ti-omap4 upload
# shift our version higher for this package only. Ensure this only
# occurs for the v2.6.35 kernel so that we do not propogate this into
# any other series.
raw_uploadnum := $(shell echo $(revision) | sed -e 's/.*\.//')
libc_dev_version :=
ifeq ($(DEBIAN),debian.master)
ifeq ($(release),2.6.35)
libc_dev_version := -v$(release)-$(shell expr "$(abinum)" + 1000).$(raw_uploadnum)
endif
endif
DEB_HOST_MULTIARCH = $(shell dpkg-architecture -qDEB_HOST_MULTIARCH)
DEB_HOST_GNU_TYPE = $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
DEB_BUILD_GNU_TYPE = $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)
DEB_HOST_ARCH = $(shell dpkg-architecture -qDEB_HOST_ARCH)
DEB_BUILD_ARCH = $(shell dpkg-architecture -qDEB_BUILD_ARCH)
#
# Detect invocations of the form 'fakeroot debian/rules binary arch=armel'
# within an x86'en schroot. This only gets you part of the way since the
# packaging phase fails, but you can at least compile the kernel quickly.
#
arch := $(DEB_HOST_ARCH)
ifneq ($(arch),$(DEB_HOST_ARCH))
CROSS_COMPILE ?= $(shell dpkg-architecture -a$(arch) -qDEB_HOST_GNU_TYPE -f 2>/dev/null)-
endif
#
# Detect invocations of the form 'dpkg-buildpackage -B -aarmel' within
# an x86'en schroot. This is the only way to build all of the packages
# (except for tools).
#
ifneq ($(DEB_BUILD_GNU_TYPE),$(DEB_HOST_GNU_TYPE))
CROSS_COMPILE ?= $(DEB_HOST_GNU_TYPE)-
endif
abidir := $(CURDIR)/$(DEBIAN)/abi/$(release)-$(revision)/$(arch)
prev_abidir := $(CURDIR)/$(DEBIAN)/abi/$(release)-$(prev_revision)/$(arch)
commonconfdir := $(CURDIR)/$(DEBIAN)/config
archconfdir := $(CURDIR)/$(DEBIAN)/config/$(arch)
sharedconfdir := $(CURDIR)/debian.master/config
builddir := $(CURDIR)/debian/build
stampdir := $(CURDIR)/debian/stamps
#
# The binary package name always starts with linux-image-$KVER-$ABI.$UPLOAD_NUM. There
# are places that you'll find linux-image hard coded, but I guess thats OK since the
# assumption that the binary package always starts with linux-image will never change.
#
bin_pkg_name=linux-image-$(abi_release)
extra_pkg_name=linux-image-extra-$(abi_release)
hdrs_pkg_name=linux-headers-$(abi_release)
#
# The generation of content in the doc package depends on both 'AUTOBUILD=' and
# 'do_doc_package_content=true'. There are usually build errors during the development
# cycle, so its OK to leave 'do_doc_package_content=false' until those build
# failures get sorted out. Finally, the doc package doesn't really need to be built
# for developer testing (its kind of slow), so only do it if on a buildd.
do_doc_package=true
do_doc_package_content=true
ifeq ($(full_build),false)
do_doc_package_content=false
endif
doc_pkg_name=$(src_pkg_name)-doc
#
# Similarly with the linux-source package, you need not build it as a developer. Its
# somewhat I/O intensive and utterly useless.
#
do_source_package=true
do_source_package_content=true
ifeq ($(full_build),false)
do_source_package_content=false
endif
# linux-libc-dev may not be needed, default to building it.
do_libc_dev_package=true
# common headers normally is built as an indep package, but may be arch
do_common_headers_indep=true
# add a 'full source' mode
do_full_source=false
# build tools
ifneq ($(wildcard $(CURDIR)/tools),)
ifeq ($(do_tools),)
ifneq ($(DEB_BUILD_GNU_TYPE),$(DEB_HOST_GNU_TYPE))
do_tools=false
endif
endif
do_tools?=true
else
do_tools?=false
endif
tools_pkg_name=$(src_pkg_name)-tools-$(abi_release)
tools_common_pkg_name=$(src_pkg_name)-tools-common
# The general flavour specific image package.
do_flavour_image_package=true
# The general flavour specific header package.
do_flavour_header_package=true
# Support parallel=<n> in DEB_BUILD_OPTIONS (see #209008)
#
# These 2 environment variables set the -j value of the kernel build. For example,
# CONCURRENCY_LEVEL=16 fakeroot $(DEBIAN)/rules binary-debs
# or
# DEB_BUILD_OPTIONS=parallel=16 fakeroot $(DEBIAN)/rules binary-debs
#
# The default is to use the number of CPUs.
#
COMMA=,
DEB_BUILD_OPTIONS_PARA = $(subst parallel=,,$(filter parallel=%,$(subst $(COMMA), ,$(DEB_BUILD_OPTIONS))))
ifneq (,$(DEB_BUILD_OPTIONS_PARA))
CONCURRENCY_LEVEL := $(DEB_BUILD_OPTIONS_PARA)
endif
ifeq ($(CONCURRENCY_LEVEL),)
# Check the environment
CONCURRENCY_LEVEL := $(shell echo $$CONCURRENCY_LEVEL)
# No? Then build with the number of CPUs on the host.
ifeq ($(CONCURRENCY_LEVEL),)
CONCURRENCY_LEVEL := $(shell expr `getconf _NPROCESSORS_ONLN` \* 1)
endif
# Oh hell, give 'em one
ifeq ($(CONCURRENCY_LEVEL),)
CONCURRENCY_LEVEL := 1
endif
endif
conc_level = -j$(CONCURRENCY_LEVEL)
# target_flavour is filled in for each step
kmake = make ARCH=$(build_arch) \
CROSS_COMPILE=$(CROSS_COMPILE) \
KERNELVERSION=$(abi_release)-$(target_flavour) \
CONFIG_DEBUG_SECTION_MISMATCH=y \
KBUILD_BUILD_VERSION="$(uploadnum)" \
LOCALVERSION= localver-extra=
ifneq ($(LOCAL_ENV_CC),)
kmake += CC=$(LOCAL_ENV_CC) DISTCC_HOSTS=$(LOCAL_ENV_DISTCC_HOSTS)
endif
# Locking is required in parallel builds to prevent loss of contents
# of the debian/files.
lockme_file = $(CURDIR)/debian/.LOCK
lockme_cmd = flock -w 60
lockme = $(lockme_cmd) $(lockme_file)
# The following targets are for the maintainer only! do not run if you don't
# know what they do.
.PHONY: printenv updateconfigs printchanges insertchanges startnewrelease diffupstream help updateportsconfigs editportsconfigs
help:
@echo "These are the targets in addition to the normal $(DEBIAN) ones:"
@echo
@echo " printenv : Print some variables used in the build"
@echo
@echo " updateconfigs : Update core arch configs"
@echo
@echo " editconfigs : Update core arch configs interractively"
@echo " genconfigs : Generate core arch configs in CONFIGS/*"
@echo
@echo " updateportsconfigs : Update ports arch configs"
@echo
@echo " editportsconfigs : Update ports arch configs interactivly"
@echo " genportconfigs : Generate ports arch configs in CONFIGS/*"
@echo
@echo " printchanges : Print the current changelog entries (from git)"
@echo
@echo " insertchanges : Insert current changelog entries (from git)"
@echo
@echo " startnewrelease : Start a new changelog set"
@echo
@echo " diffupstream : Diff stock kernel code against upstream (git)"
@echo
@echo " help : If you are kernel hacking, you need the professional"
@echo " version of this"
@echo
@echo "Environment variables:"
@echo
@echo " NOKERNLOG : Do not add upstream kernel commits to changelog"
@echo " CONCURRENCY_LEVEL=X"
@echo " : Use -jX for kernel compile"
@echo " PRINTSHAS : Include SHAs for commits in changelog"
printdebian:
@echo "$(DEBIAN)"
updateconfigs defaultconfigs editconfigs genconfigs dumpconfigs:
dh_testdir;
$(SHELL) $(DROOT)/scripts/misc/kernelconfig $@
rm -rf build
updateportsconfigs defaultportsconfigs editportsconfigs genportsconfigs askconfigs:
dh_testdir;
$(SHELL) $(DROOT)/scripts/misc/kernelconfig $@ ports
rm -rf build
printenv:
dh_testdir
@echo "src package name = $(src_pkg_name)"
@echo "release = $(release)"
@echo "revisions = $(revisions)"
@echo "revision = $(revision)"
@echo "uploadnum = $(uploadnum)"
@echo "prev_revisions = $(prev_revisions)"
@echo "prev_revision = $(prev_revision)"
@echo "abinum = $(abinum)"
@echo "gitver = $(gitver)"
@echo "flavours = $(flavours)"
@echo "skipabi = $(skipabi)"
@echo "skipmodule = $(skipmodule)"
@echo "skipdbg = $(skipdbg)"
@echo "ubuntu_log_opts = $(ubuntu_log_opts)"
@echo "CONCURRENCY_LEVEL = $(CONCURRENCY_LEVEL)"
@echo "bin package name = $(bin_pkg_name)"
@echo "hdr package name = $(hdrs_pkg_name)"
@echo "doc package name = $(doc_pkg_name)"
@echo "do_doc_package = $(do_doc_package)"
@echo "do_doc_package_content = $(do_doc_package_content)"
@echo "do_source_package = $(do_source_package)"
@echo "do_source_package_content = $(do_source_package_content)"
@echo "do_libc_dev_package = $(do_libc_dev_package)"
@echo "do_flavour_image_package = $(do_flavour_image_package)"
@echo "do_flavour_header_package = $(do_flavour_header_package)"
@echo "do_common_headers_indep = $(do_common_headers_indep)"
@echo "do_full_source = $(do_full_source)"
@echo "do_tools = $(do_tools)"
@echo "full_build = $(full_build)"
@echo "libc_dev_version = $(libc_dev_version)"
@echo "DEB_HOST_GNU_TYPE = $(DEB_HOST_GNU_TYPE)"
@echo "DEB_BUILD_GNU_TYPE = $(DEB_BUILD_GNU_TYPE)"
@echo "DEB_HOST_ARCH = $(DEB_HOST_ARCH)"
@echo "DEB_BUILD_ARCH = $(DEB_BUILD_ARCH)"
@echo "arch = $(arch)"
@echo "kmake = $(kmake)"
prev_release="$(release)-$(prev_revision)"
printchanges:
@baseCommit=$$(git log --pretty=format:'%H %s' | \
awk '/UBUNTU: '".*Ubuntu-$(prev_release)"'$$/ { print $$1; exit }'); \
git log "$$baseCommit"..HEAD | \
perl -w -f $(DROOT)/scripts/misc/git-ubuntu-log $(ubuntu_log_opts)
insertchanges:
@perl -w -f $(DROOT)/scripts/misc/insert-changes.pl $(DROOT) $(DEBIAN)
diffupstream:
@git diff-tree -p refs/remotes/linux-2.6/master..HEAD $(shell ls | grep -vE '^(ubuntu|$(DEBIAN)|\.git.*)')
startnewrelease:
dh_testdir
@nextminor=$(shell expr `echo $(revision) | awk -F. '{print $$2}'` + 1); \
now="$(shell date -R)"; \
echo "Creating new changelog set for $(abi_release).$$nextminor..."; \
echo -e "$(src_pkg_name) ($(abi_release).$$nextminor) UNRELEASED; urgency=low\n" > $(DEBIAN)/changelog.new; \
echo " CHANGELOG: Do not edit directly. Autogenerated at release." >> \
$(DEBIAN)/changelog.new; \
echo " CHANGELOG: Use the printchanges target to see the curent changes." \
>> $(DEBIAN)/changelog.new; \
echo " CHANGELOG: Use the insertchanges target to create the final log." \
>> $(DEBIAN)/changelog.new; \
echo -e "\n -- $$DEBFULLNAME <$$DEBEMAIL> $$now\n" >> \
$(DEBIAN)/changelog.new ; \
cat $(DEBIAN)/changelog >> $(DEBIAN)/changelog.new; \
mv $(DEBIAN)/changelog.new $(DEBIAN)/changelog
# We don't want make removing intermediary stamps
.SECONDARY :
# Prepare the out-of-tree build directory
ifeq ($(do_full_source),true)
build_cd = cd $(builddir)/build-$*; #
build_O =
else
build_cd =
build_O = O=$(builddir)/build-$*
endif
$(stampdir)/stamp-prepare-%: config-prepare-check-%
@echo Debug: $@
@touch $@
$(stampdir)/stamp-prepare-tree-%: target_flavour = $*
$(stampdir)/stamp-prepare-tree-%: $(commonconfdir)/config.common.$(family) $(archconfdir)/config.common.$(arch) $(archconfdir)/config.flavour.%
@echo Debug: $@
install -d $(builddir)/build-$*
touch $(builddir)/build-$*/ubuntu-build
[ "$(do_full_source)" != 'true' ] && true || \
rsync -a --exclude debian --exclude debian.master --exclude $(DEBIAN) * $(builddir)/build-$*
cat $^ | sed -e 's/.*CONFIG_VERSION_SIGNATURE.*/CONFIG_VERSION_SIGNATURE="Ubuntu $(release)-$(revision)-$* $(raw_kernelversion)"/' > $(builddir)/build-$*/.config
find $(builddir)/build-$* -name "*.ko" | xargs rm -f
$(build_cd) $(kmake) $(build_O) -j1 silentoldconfig prepare scripts
touch $@
# Used by developers as a shortcut to prepare a tree for compilation.
prepare-%: $(stampdir)/stamp-prepare-%
@echo Debug: $@
# Used by developers to allow efficient pre-building without fakeroot.
build-%: $(stampdir)/stamp-build-%
@echo Debug: $@
# Do the actual build, including image and modules
$(stampdir)/stamp-build-%: target_flavour = $*
$(stampdir)/stamp-build-%: dtb_target = $(notdir $(dtb_file_$*))
$(stampdir)/stamp-build-%: $(stampdir)/stamp-prepare-%
@echo Debug: $@
$(build_cd) $(kmake) $(build_O) $(conc_level) $(build_image) modules $(dtb_target)
@touch $@
# Install the finished build
install-%: pkgdir = $(CURDIR)/debian/$(bin_pkg_name)-$*
install-%: pkgdir_ex = $(CURDIR)/debian/$(extra_pkg_name)-$*
install-%: bindoc = $(pkgdir)/usr/share/doc/$(bin_pkg_name)-$*
install-%: dbgpkgdir = $(CURDIR)/debian/$(bin_pkg_name)-$*-dbgsym
install-%: basepkg = $(hdrs_pkg_name)
install-%: hdrdir = $(CURDIR)/debian/$(basepkg)-$*/usr/src/$(basepkg)-$*
install-%: target_flavour = $*
install-%: dtb_file=$(dtb_file_$*)
install-%: dtb_target=$(notdir $(dtb_file_$*))
install-%: checks-%
@echo Debug: $@
dh_testdir
dh_testroot
dh_clean -k -p$(bin_pkg_name)-$*
dh_clean -k -p$(hdrs_pkg_name)-$*
dh_clean -k -p$(dbg_pkg_name)-$*
# The main image
# compress_file logic required because not all architectures
# generate a zImage automatically out of the box
ifeq ($(compress_file),)
install -m600 -D $(builddir)/build-$*/$(kernel_file) \
$(pkgdir)/boot/$(install_file)-$(abi_release)-$*
else
install -d $(pkgdir)/boot
gzip -c9v $(builddir)/build-$*/$(kernel_file) > \
$(pkgdir)/boot/$(install_file)-$(abi_release)-$*
chmod 600 $(pkgdir)/boot/$(install_file)-$(abi_release)-$*
endif
install -m644 $(builddir)/build-$*/.config \
$(pkgdir)/boot/config-$(abi_release)-$*
install -m644 $(abidir)/$* \
$(pkgdir)/boot/abi-$(abi_release)-$*
install -m600 $(builddir)/build-$*/System.map \
$(pkgdir)/boot/System.map-$(abi_release)-$*
if [ "$(dtb_target)" ]; then \
install -d $(pkgdir)/lib/firmware/$(abi_release)-$*/device-tree; \
install -m644 $(builddir)/build-$*/$(dtb_file) \
$(pkgdir)/lib/firmware/$(abi_release)-$*/device-tree/$(dtb_target); \
fi
ifeq ($(no_dumpfile),)
makedumpfile -g $(pkgdir)/boot/vmcoreinfo-$(abi_release)-$* \
-x $(builddir)/build-$*/vmlinux
chmod 0600 $(pkgdir)/boot/vmcoreinfo-$(abi_release)-$*
endif
$(build_cd) $(kmake) $(build_O) $(conc_level) modules_install \
INSTALL_MOD_STRIP=1 INSTALL_MOD_PATH=$(pkgdir)/ \
INSTALL_FW_PATH=$(pkgdir)/lib/firmware/$(abi_release)-$*
#
# Remove all modules not in the inclusion list.
#
if [ -f $(DEBIAN)/control.d/$(target_flavour).inclusion-list ] ; then \
mkdir -p $(pkgdir_ex)/lib/modules/$(abi_release)-$*; \
mv $(pkgdir)/lib/modules/$(abi_release)-$*/kernel \
$(pkgdir_ex)/lib/modules/$(abi_release)-$*/kernel; \
$(SHELL) $(DROOT)/scripts/module-inclusion --master \
$(pkgdir_ex)/lib/modules/$(abi_release)-$*/kernel \
$(pkgdir)/lib/modules/$(abi_release)-$*/kernel \
$(DEBIAN)/control.d/$(target_flavour).inclusion-list 2>&1 | \
tee $(target_flavour).inclusion-list.log; \
/sbin/depmod -b $(pkgdir) -ea -F $(pkgdir)/boot/System.map-$(abi_release)-$* \
$(abi_release)-$* 2>&1 |tee $(target_flavour).depmod.log; \
fi
ifeq ($(no_dumpfile),)
makedumpfile -g $(pkgdir)/boot/vmcoreinfo-$(abi_release)-$* \
-x $(builddir)/build-$*/vmlinux
chmod 0600 $(pkgdir)/boot/vmcoreinfo-$(abi_release)-$*
endif
rm -f $(pkgdir)/lib/modules/$(abi_release)-$*/build
rm -f $(pkgdir)/lib/modules/$(abi_release)-$*/source
# Some initramfs-tools specific modules
install -d $(pkgdir)/lib/modules/$(abi_release)-$*/initrd
if [ -f $(pkgdir)/lib/modules/$(abi_release)-$*/kernel/drivers/video/vesafb.ko ]; then\
ln -f $(pkgdir)/lib/modules/$(abi_release)-$*/kernel/drivers/video/vesafb.ko \
$(pkgdir)/lib/modules/$(abi_release)-$*/initrd/; \
fi
# Now the image scripts
install -d $(pkgdir)/DEBIAN
for script in postinst postrm preinst prerm; do \
sed -e 's/=V/$(abi_release)-$*/g' -e 's/=K/$(install_file)/g' \
-e 's/=L/$(loader)/g' -e 's@=B@$(build_arch)@g' \
$(DROOT)/control-scripts/$$script > $(pkgdir)/DEBIAN/$$script; \
chmod 755 $(pkgdir)/DEBIAN/$$script; \
done
# Install the postinit/postrm scripts in the extras package.
if [ -f $(DEBIAN)/control.d/$(target_flavour).inclusion-list ] ; then \
install -d $(pkgdir_ex)/DEBIAN; \
for script in postinst postrm ; do \
sed -e 's/=V/$(abi_release)-$*/g' -e 's/=K/$(install_file)/g' \
-e 's/=L/$(loader)/g' -e 's@=B@$(build_arch)@g' \
debian/control-scripts/$$script > $(pkgdir_ex)/DEBIAN/$$script; \
chmod 755 $(pkgdir_ex)/DEBIAN/$$script; \
done; \
fi
# Install the full changelog.
ifeq ($(do_doc_package),true)
install -d $(bindoc)
cat $(DEBIAN)/changelog $(DEBIAN)/changelog.historical | \
gzip -9 >$(bindoc)/changelog.Debian.old.gz
chmod 644 $(bindoc)/changelog.Debian.old.gz
endif
ifneq ($(skipsub),true)
for sub in $($(*)_sub); do \
if ! (TO=$$sub FROM=$* ABI_RELEASE=$(abi_release) $(SHELL) \
$(DROOT)/scripts/sub-flavour); then exit 1; fi; \
/sbin/depmod -b debian/$(bin_pkg_name)-$$sub \
-ea -F debian/$(bin_pkg_name)-$$sub/boot/System.map-$(abi_release)-$* \
$(abi_release)-$*; \
install -d debian/$(bin_pkg_name)-$$sub/DEBIAN; \
for script in postinst postrm preinst prerm; do \
sed -e 's/=V/$(abi_release)-$*/g' \
-e 's/=K/$(install_file)/g' \
-e 's/=L/$(loader)/g' \
-e 's@=B@$(build_arch)@g' \
$(DROOT)/control-scripts/$$script > \
debian/$(bin_pkg_name)-$$sub/DEBIAN/$$script;\
chmod 755 debian/$(bin_pkg_name)-$$sub/DEBIAN/$$script;\
done; \
done
endif
ifneq ($(skipdbg),true)
# Debug image is simple
install -m644 -D $(builddir)/build-$*/vmlinux \
$(dbgpkgdir)/usr/lib/debug/boot/vmlinux-$(abi_release)-$*
$(build_cd) $(kmake) $(build_O) modules_install \
INSTALL_MOD_PATH=$(dbgpkgdir)/usr/lib/debug
# Add .gnu_debuglink sections to each stripped .ko
# pointing to unstripped verson
find $(pkgdir) -name '*.ko' | sed 's|$(pkgdir)||'| while read module ; do \
if [[ -f "$(dbgpkgdir)/usr/lib/debug/$$module" ]] ; then \
$(CROSS_COMPILE)objcopy \
--add-gnu-debuglink=$(dbgpkgdir)/usr/lib/debug/$$module \
$(pkgdir)/$$module; \
fi; \
done
rm -f $(dbgpkgdir)/usr/lib/debug/lib/modules/$(abi_release)-$*/build
rm -f $(dbgpkgdir)/usr/lib/debug/lib/modules/$(abi_release)-$*/source
rm -f $(dbgpkgdir)/usr/lib/debug/lib/modules/$(abi_release)-$*/modules.*
rm -fr $(dbgpkgdir)/usr/lib/debug/lib/firmware
endif
# The flavour specific headers image
# TODO: Would be nice if we didn't have to dupe the original builddir
install -d -m755 $(hdrdir)
cat $(builddir)/build-$*/.config | \
sed -e 's/.*CONFIG_DEBUG_INFO=.*/# CONFIG_DEBUG_INFO is not set/g' > \
$(hdrdir)/.config
chmod 644 $(hdrdir)/.config
$(kmake) O=$(hdrdir) -j1 silentoldconfig prepare scripts
# We'll symlink this stuff
rm -f $(hdrdir)/Makefile
rm -rf $(hdrdir)/include2
# Copy over the compilation version.
cp "$(builddir)/build-$*/include/generated/compile.h" \
"$(hdrdir)/include/generated/compile.h"
# powerpc seems to need some .o files for external module linking. Add them in.
ifeq ($(arch),powerpc)
mkdir -p $(hdrdir)/arch/powerpc/lib
cp $(builddir)/build-$*/arch/powerpc/lib/*.o $(hdrdir)/arch/powerpc/lib
endif
# Script to symlink everything up
$(SHELL) $(DROOT)/scripts/link-headers "$(hdrdir)" "$(basepkg)" "$*"
# The build symlink
install -d debian/$(basepkg)-$*/lib/modules/$(abi_release)-$*
ln -s /usr/src/$(basepkg)-$* \
debian/$(basepkg)-$*/lib/modules/$(abi_release)-$*/build
# And finally the symvers
install -m644 $(builddir)/build-$*/Module.symvers \
$(hdrdir)/Module.symvers
# Now the header scripts
install -d $(CURDIR)/debian/$(basepkg)-$*/DEBIAN
for script in postinst; do \
sed -e 's/=V/$(abi_release)-$*/g' -e 's/=K/$(install_file)/g' \
$(DROOT)/control-scripts/headers-$$script > \
$(CURDIR)/debian/$(basepkg)-$*/DEBIAN/$$script; \
chmod 755 $(CURDIR)/debian/$(basepkg)-$*/DEBIAN/$$script; \
done
# At the end of the package prep, call the tests
DPKG_ARCH="$(arch)" KERN_ARCH="$(build_arch)" FLAVOUR="$*" \
VERSION="$(abi_release)" REVISION="$(revision)" \
PREV_REVISION="$(prev_revision)" ABI_NUM="$(abinum)" \
PREV_ABI_NUM="$(prev_abinum)" BUILD_DIR="$(builddir)/build-$*" \
INSTALL_DIR="$(pkgdir)" SOURCE_DIR="$(CURDIR)" \
run-parts -v $(DROOT)/tests
#
# Remove files which are generated at installation by postinst,
# except for modules.order and modules.builtin
#
# NOTE: need to keep this list in sync with postrm
#
mkdir $(pkgdir)/lib/modules/$(abi_release)-$*/_
mv $(pkgdir)/lib/modules/$(abi_release)-$*/modules.order \
$(pkgdir)/lib/modules/$(abi_release)-$*/_
if [ -f $(pkgdir)/lib/modules/$(abi_release)-$*/modules.builtin ] ; then \
mv $(pkgdir)/lib/modules/$(abi_release)-$*/modules.builtin \
$(pkgdir)/lib/modules/$(abi_release)-$*/_; \
fi
rm -f $(pkgdir)/lib/modules/$(abi_release)-$*/modules.*
mv $(pkgdir)/lib/modules/$(abi_release)-$*/_/* \
$(pkgdir)/lib/modules/$(abi_release)-$*
rmdir $(pkgdir)/lib/modules/$(abi_release)-$*/_
headers_tmp := $(CURDIR)/debian/tmp-headers
headers_dir := $(CURDIR)/debian/linux-libc-dev
hmake := $(MAKE) -C $(CURDIR) O=$(headers_tmp) \
KERNELVERSION=$(abi_release) INSTALL_HDR_PATH=$(headers_tmp)/install \
SHELL="$(SHELL)" ARCH=$(header_arch)
install-arch-headers:
@echo Debug: $@
dh_testdir
dh_testroot
dh_clean -k -plinux-libc-dev
rm -rf $(headers_tmp)
install -d $(headers_tmp) $(headers_dir)/usr/include/
$(hmake) $(defconfig)
mv $(headers_tmp)/.config $(headers_tmp)/.config.old
sed -e 's/^# \(CONFIG_MODVERSIONS\) is not set$$/\1=y/' \
-e 's/.*CONFIG_LOCALVERSION_AUTO.*/# CONFIG_LOCALVERSION_AUTO is not set/' \
$(headers_tmp)/.config.old > $(headers_tmp)/.config
$(hmake) silentoldconfig
$(hmake) $(conc_level) headers_install
( cd $(headers_tmp)/install/include/ && \
find . -name '.' -o -name '.*' -prune -o -print | \
cpio -pvd --preserve-modification-time \
$(headers_dir)/usr/include/ )
mkdir $(headers_dir)/usr/include/$(DEB_HOST_MULTIARCH)
mv $(headers_dir)/usr/include/asm $(headers_dir)/usr/include/$(DEB_HOST_MULTIARCH)/
rm -rf $(headers_tmp)
binary-arch-headers: install-arch-headers
@echo Debug: $@
dh_testdir
dh_testroot
ifeq ($(do_libc_dev_package),true)
ifneq ($(DEBIAN),debian.master)
echo "non-master branch building linux-libc-dev, aborting"
exit 1
endif
dh_installchangelogs -plinux-libc-dev
dh_installdocs -plinux-libc-dev
dh_compress -plinux-libc-dev
dh_fixperms -plinux-libc-dev
dh_installdeb -plinux-libc-dev
$(lockme) dh_gencontrol -plinux-libc-dev -- $(libc_dev_version)
dh_md5sums -plinux-libc-dev
dh_builddeb -plinux-libc-dev
endif
binary-%: pkgimg = $(bin_pkg_name)-$*
binary-%: pkgimg_ex = $(extra_pkg_name)-$*
binary-%: pkghdr = $(hdrs_pkg_name)-$*
binary-%: dbgpkg = $(bin_pkg_name)-$*-dbgsym
binary-%: dbgpkgdir = $(CURDIR)/debian/$(bin_pkg_name)-$*-dbgsym
binary-%: target_flavour = $*
binary-%: install-%
@echo Debug: $@
dh_testdir
dh_testroot
dh_installchangelogs -p$(pkgimg)
dh_installdocs -p$(pkgimg)
dh_compress -p$(pkgimg)
dh_fixperms -p$(pkgimg) -X/boot/
dh_installdeb -p$(pkgimg)
dh_shlibdeps -p$(pkgimg)
$(lockme) dh_gencontrol -p$(pkgimg)
dh_md5sums -p$(pkgimg)
dh_builddeb -p$(pkgimg) -- -Zbzip2 -z9
if [ -f $(DEBIAN)/control.d/$(target_flavour).inclusion-list ] ; then \
dh_installchangelogs -p$(pkgimg_ex); \
dh_installdocs -p$(pkgimg_ex); \
dh_compress -p$(pkgimg_ex); \
dh_fixperms -p$(pkgimg_ex) -X/boot/; \
dh_installdeb -p$(pkgimg_ex); \
dh_shlibdeps -p$(pkgimg_ex); \
$(lockme) dh_gencontrol -p$(pkgimg_ex); \
dh_md5sums -p$(pkgimg_ex); \
dh_builddeb -p$(pkgimg_ex) -- -Zbzip2 -z9; \
fi
dh_installchangelogs -p$(pkghdr)
dh_installdocs -p$(pkghdr)
dh_compress -p$(pkghdr)
dh_fixperms -p$(pkghdr)
dh_shlibdeps -p$(pkghdr)
dh_installdeb -p$(pkghdr)
$(lockme) dh_gencontrol -p$(pkghdr)
dh_md5sums -p$(pkghdr)
dh_builddeb -p$(pkghdr)
ifneq ($(skipsub),true)
@set -e; for sub in $($(*)_sub); do \
pkg=$(bin_pkg_name)-$$sub; \
dh_installchangelogs -p$$pkg; \
dh_installdocs -p$$pkg; \
dh_compress -p$$pkg; \
dh_fixperms -p$$pkg -X/boot/; \
dh_shlibdeps -p$$pkg; \
dh_installdeb -p$$pkg; \
$(lockme) dh_gencontrol -p$$pkg; \
dh_md5sums -p$$pkg; \
dh_builddeb -p$$pkg; \
done
endif
ifneq ($(skipdbg),true)
dh_installchangelogs -p$(dbgpkg)
dh_installdocs -p$(dbgpkg)
dh_compress -p$(dbgpkg)
dh_fixperms -p$(dbgpkg)
dh_installdeb -p$(dbgpkg)
$(lockme) dh_gencontrol -p$(dbgpkg)
dh_md5sums -p$(dbgpkg)
dh_builddeb -p$(dbgpkg)
# Hokay...here's where we do a little twiddling...
# Renaming the debug package prevents it from getting into
# the primary archive, and therefore prevents this very large
# package from being mirrored. It is instead, through some
# archive admin hackery, copied to http://ddebs.ubuntu.com.
#
mv ../$(dbgpkg)_$(release)-$(revision)_$(arch).deb \
../$(dbgpkg)_$(release)-$(revision)_$(arch).ddeb
set -e; \
( \
$(lockme_cmd) 9 || exit 1; \
if grep -qs '^Build-Debug-Symbols: yes$$' /CurrentlyBuilding; then \
sed -i '/^$(dbgpkg)_/s/\.deb /.ddeb /' debian/files; \
else \
grep -v '^$(dbgpkg)_.*$$' debian/files > debian/files.new; \
mv debian/files.new debian/files; \
fi; \
) 9>$(lockme_file)
# Now, the package wont get into the archive, but it will get put
# into the debug system.
endif
ifneq ($(full_build),false)
# Clean out this flavours build directory.
rm -rf $(builddir)/build-$*
# Clean out the debugging package source directory.
rm -rf $(dbgpkgdir)
endif
#
# per-architecture packages
#
builddirpa = $(builddir)/tools-perarch
$(stampdir)/stamp-prepare-perarch:
@echo Debug: $@
ifeq ($(do_tools),true)
rm -rf $(builddirpa)
install -d $(builddirpa)
for i in *; do ln -s $(CURDIR)/$$i $(builddirpa); done
rm $(builddirpa)/tools
rsync -a tools/ $(builddirpa)/tools/
endif
touch $@
$(stampdir)/stamp-build-perarch: $(stampdir)/stamp-prepare-perarch
@echo Debug: $@
ifeq ($(do_tools),true)
cd $(builddirpa)/tools/perf && \
make HAVE_CPLUS_DEMANGLE=1 CROSS_COMPILE=$(CROSS_COMPILE)
if [ "$(arch)" = "amd64" ] || [ "$(arch)" = "i386" ]; then \
cd $(builddirpa)/tools/power/x86/x86_energy_perf_policy && make CROSS_COMPILE=$(CROSS_COMPILE); \
cd $(builddirpa)/tools/power/x86/turbostat && make CROSS_COMPILE=$(CROSS_COMPILE); \
if [ "$(do_hyperv)" = "true" ]; then \
cd $(builddirpa)/tools/hv && make CROSS_COMPILE=$(CROSS_COMPILE); \
fi; \
fi
endif
@touch $@
install-perarch: toolspkgdir = $(CURDIR)/debian/$(tools_pkg_name)
install-perarch: $(stampdir)/stamp-build-perarch
@echo Debug: $@
# Add the tools.
ifeq ($(do_tools),true)
install -d $(toolspkgdir)/usr/bin
install -s -m755 $(builddirpa)/tools/perf/perf \
$(toolspkgdir)/usr/bin/perf_$(abi_release)
if [ "$(arch)" = "amd64" ] || [ "$(arch)" = "i386" ]; then \
install -s -m755 $(builddirpa)/tools/power/x86/x86_energy_perf_policy/x86_energy_perf_policy \
$(toolspkgdir)/usr/bin/x86_energy_perf_policy_$(abi_release); \
install -s -m755 $(builddirpa)/tools/power/x86/turbostat/turbostat \
$(toolspkgdir)/usr/bin/turbostat_$(abi_release); \
if [ "$(do_hyperv)" = "true" ]; then \
install -d $(toolspkgdir)/usr/sbin; \
install -s -m755 $(builddirpa)/tools/hv/hv_kvp_daemon \
$(toolspkgdir)/usr/sbin/hv_kvp_daemon_$(abi_release); \
fi; \
fi
endif
binary-perarch: toolspkg = $(tools_pkg_name)
binary-perarch: install-perarch
@echo Debug: $@
ifeq ($(do_tools),true)
dh_installchangelogs -p$(toolspkg)
dh_installdocs -p$(toolspkg)
dh_compress -p$(toolspkg)
dh_fixperms -p$(toolspkg)
dh_shlibdeps -p$(toolspkg)
dh_installdeb -p$(toolspkg)
$(lockme) dh_gencontrol -p$(toolspkg)
dh_md5sums -p$(toolspkg)
dh_builddeb -p$(toolspkg)
endif
binary-debs: binary-perarch $(addprefix binary-,$(flavours))
@echo Debug: $@
build-arch-deps-$(do_flavour_image_package) += $(addprefix $(stampdir)/stamp-build-,$(flavours))
build-arch: $(build-arch-deps-true)
@echo Debug: $@
ifeq ($(AUTOBUILD),)
binary-arch-deps-$(do_flavour_image_package) += binary-udebs
else
binary-arch-deps-$(do_flavour_image_package) = binary-debs
endif
binary-arch-deps-$(do_libc_dev_package) += binary-arch-headers
ifneq ($(do_common_headers_indep),true)
binary-arch-deps-$(do_flavour_header_package) += binary-headers
endif
binary-arch: $(binary-arch-deps-true)
@echo Debug: $@
build-indep:
@echo Debug: $@
docpkg = $(doc_pkg_name)
docdir = $(CURDIR)/debian/$(docpkg)/usr/share/doc/$(docpkg)
install-doc: install-headers
@echo Debug: $@
ifeq ($(do_doc_package),true)
dh_testdir
dh_testroot
dh_clean -k -p$(docpkg)
install -d $(docdir)
ifeq ($(do_doc_package_content),true)
# First the html docs. We skip these for autobuilds
if [ -z "$(AUTOBUILD)" ]; then \
install -d $(docdir)/$(doc_pkg_name)-tmp; \
$(kmake) O=$(docdir)/$(doc_pkg_name)-tmp htmldocs; \
mv $(docdir)/$(doc_pkg_name)-tmp/Documentation/DocBook \
$(docdir)/html; \
rm -rf $(docdir)/$(doc_pkg_name)-tmp; \
fi
endif
# Copy the rest
cp -a Documentation/* $(docdir)
rm -rf $(docdir)/DocBook
find $(docdir) -name .gitignore | xargs rm -f
endif
indep_hdrpkg = $(hdrs_pkg_name)
indep_hdrdir = $(CURDIR)/debian/$(indep_hdrpkg)/usr/src/$(indep_hdrpkg)
install-headers:
@echo Debug: $@
ifeq ($(do_flavour_header_package),true)
dh_testdir
dh_testroot
dh_clean -k -p$(indep_hdrpkg)
install -d $(indep_hdrdir)
find . -path './debian' -prune -o -path './$(DEBIAN)' -prune \
-o -path './include/*' -prune \
-o -path './scripts/*' -prune -o -type f \
\( -name 'Makefile*' -o -name 'Kconfig*' -o -name 'Kbuild*' -o \
-name '*.sh' -o -name '*.pl' -o -name '*.lds' \) \
-print | cpio -pd --preserve-modification-time $(indep_hdrdir)
cp -a drivers/media/dvb/dvb-core/*.h $(indep_hdrdir)/drivers/media/dvb/dvb-core
cp -a drivers/media/video/*.h $(indep_hdrdir)/drivers/media/video
cp -a drivers/media/dvb/frontends/*.h $(indep_hdrdir)/drivers/media/dvb/frontends
cp -a scripts include $(indep_hdrdir)
(find arch -name include -type d -print | \
xargs -n1 -i: find : -type f) | \
cpio -pd --preserve-modification-time $(indep_hdrdir)
endif
srcpkg = $(src_pkg_name)-source-$(release)
srcdir = $(CURDIR)/debian/$(srcpkg)/usr/src/$(srcpkg)
balldir = $(CURDIR)/debian/$(srcpkg)/usr/src/$(srcpkg)/$(srcpkg)
install-source: install-doc
@echo Debug: $@
ifeq ($(do_source_package),true)
dh_testdir
dh_testroot
dh_clean -k -p$(srcpkg)
install -d $(srcdir)
ifeq ($(do_source_package_content),true)
find . -path './debian' -prune -o -path './$(DEBIAN)' -prune -o \
-path './.*' -prune -o -print | \
cpio -pd --preserve-modification-time $(balldir)
(cd $(srcdir); tar cf - $(srcpkg)) | bzip2 -9c > \
$(srcdir)/$(srcpkg).tar.bz2
rm -rf $(balldir)
find './debian' './$(DEBIAN)' \
-path './debian/linux-*' -prune -o \
-path './debian/$(src_pkg_name)-*' -prune -o \
-path './debian/build' -prune -o \
-path './debian/files' -prune -o \
-path './debian/stamps' -prune -o \
-path './debian/tmp' -prune -o \
-print | \
cpio -pd --preserve-modification-time $(srcdir)
ln -s $(srcpkg)/$(srcpkg).tar.bz2 $(srcdir)/..
endif
endif
install-tools: toolspkg = $(tools_common_pkg_name)
install-tools: toolsbin = $(CURDIR)/debian/$(toolspkg)/usr/bin
install-tools: toolssbin = $(CURDIR)/debian/$(toolspkg)/usr/sbin
install-tools: toolsman = $(CURDIR)/debian/$(toolspkg)/usr/share/man
install-tools: install-source $(stampdir)/stamp-build-perarch
@echo Debug: $@
ifeq ($(do_tools),true)
dh_testdir
dh_testroot
dh_clean -k -p$(toolspkg)
install -d $(toolsbin)
install -d $(toolsman)/man1
install -m755 debian/tools/perf $(toolsbin)/perf
if [ "$(arch)" = "amd64" ] || [ "$(arch)" = "i386" ]; then \
install -m755 debian/tools/x86_energy_perf_policy $(toolsbin)/x86_energy_perf_policy; \
install -m755 debian/tools/turbostat $(toolsbin)/turbostat; \
if [ "$(do_hyperv)" = "true" ]; then \
install -d $(toolssbin) ; \
install -m755 debian/tools/generic $(toolssbin)/hv_kvp_daemon; \
fi; \
fi
rm -rf $(builddir)/tools
install -d $(builddir)/tools
for i in *; do ln -s $(CURDIR)/$$i $(builddir)/tools/; done
rm $(builddir)/tools/tools
rsync -a tools/ $(builddir)/tools/tools/
cd $(builddir)/tools/tools/perf && make man
install -m644 $(builddir)/tools/tools/perf/Documentation/*.1 \
$(toolsman)/man1
if [ "$(arch)" = "amd64" ] || [ "$(arch)" = "i386" ]; then \
install -d $(toolsman)/man8; \
install -m644 $(CURDIR)/tools/power/x86/x86_energy_perf_policy/*.8 $(toolsman)/man8; \
install -m644 $(CURDIR)/tools/power/x86/turbostat/*.8 $(toolsman)/man8; \
if [ "$(do_hyperv)" = "true" ]; then \
install -m644 $(CURDIR)/tools/hv/*.8 $(toolsman)/man8; \
fi; \
fi
endif
install-indep: install-tools
@echo Debug: $@
# This is just to make it easy to call manually. Normally done in
# binary-indep target during builds.
binary-headers: install-headers
@echo Debug: $@
dh_testdir
dh_testroot
dh_installchangelogs -p$(indep_hdrpkg)
dh_installdocs -p$(indep_hdrpkg)
dh_compress -p$(indep_hdrpkg)
dh_fixperms -p$(indep_hdrpkg)
dh_installdeb -p$(indep_hdrpkg)
$(lockme) dh_gencontrol -p$(indep_hdrpkg)
dh_md5sums -p$(indep_hdrpkg)
dh_builddeb -p$(indep_hdrpkg)
binary-indep: install-indep
@echo Debug: $@
dh_testdir
dh_testroot
dh_installchangelogs -i
dh_installdocs -i
dh_compress -i
dh_fixperms -i
dh_installdeb -i
$(lockme) dh_gencontrol -i
dh_md5sums -i
dh_builddeb -i
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment