aboutsummaryrefslogtreecommitdiffstats
path: root/scripts/package/builddeb
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/package/builddeb')
-rw-r--r--scripts/package/builddeb79
1 files changed, 79 insertions, 0 deletions
diff --git a/scripts/package/builddeb b/scripts/package/builddeb
new file mode 100644
index 000000000000..c279b6310f02
--- /dev/null
+++ b/scripts/package/builddeb
@@ -0,0 +1,79 @@
1#!/bin/sh
2#
3# builddeb 1.2
4# Copyright 2003 Wichert Akkerman <wichert@wiggy.net>
5#
6# Simple script to generate a deb package for a Linux kernel. All the
7# complexity of what to do with a kernel after it is installer or removed
8# is left to other scripts and packages: they can install scripts in the
9# /etc/kernel/{pre,post}{inst,rm}.d/ directories that will be called on
10# package install and removal.
11
12set -e
13
14# Some variables and settings used throughout the script
15version=$KERNELRELEASE
16tmpdir="$objtree/debian/tmp"
17
18# Setup the directory structure
19rm -rf "$tmpdir"
20mkdir -p "$tmpdir/DEBIAN" "$tmpdir/lib" "$tmpdir/boot"
21
22# Build and install the kernel
23cp System.map "$tmpdir/boot/System.map-$version"
24cp .config "$tmpdir/boot/config-$version"
25cp $KBUILD_IMAGE "$tmpdir/boot/vmlinuz-$version"
26
27if grep -q '^CONFIG_MODULES=y' .config ; then
28 INSTALL_MOD_PATH="$tmpdir" make modules_install
29fi
30
31# Install the maintainer scripts
32for script in postinst postrm preinst prerm ; do
33 mkdir -p "$tmpdir/etc/kernel/$script.d"
34 cat <<EOF > "$tmpdir/DEBIAN/$script"
35#!/bin/sh
36
37set -e
38
39test -d /etc/kernel/$script.d && run-parts --arg="$version" /etc/kernel/$script.d
40exit 0
41EOF
42 chmod 755 "$tmpdir/DEBIAN/$script"
43done
44
45name="Kernel Compiler <$(id -nu)@$(hostname -f)>"
46# Generate a simple changelog template
47cat <<EOF > debian/changelog
48linux ($version) unstable; urgency=low
49
50 * A standard release
51
52 -- $name $(date -R)
53EOF
54
55# Generate a control file
56cat <<EOF > debian/control
57Source: linux
58Section: base
59Priority: optional
60Maintainer: $name
61Standards-Version: 3.6.1
62
63Package: linux-$version
64Architecture: any
65Description: Linux kernel, version $version
66 This package contains the Linux kernel, modules and corresponding other
67 files version $version.
68EOF
69
70# Fix some ownership and permissions
71chown -R root:root "$tmpdir"
72chmod -R go-w "$tmpdir"
73
74# Perform the final magic
75dpkg-gencontrol -isp
76dpkg --build "$tmpdir" ..
77
78exit 0
79