aboutsummaryrefslogtreecommitdiffstats
path: root/scripts/package
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@ppc970.osdl.org>2005-04-16 18:20:36 -0400
committerLinus Torvalds <torvalds@ppc970.osdl.org>2005-04-16 18:20:36 -0400
commit1da177e4c3f41524e886b7f1b8a0c1fc7321cac2 (patch)
tree0bba044c4ce775e45a88a51686b5d9f90697ea9d /scripts/package
Linux-2.6.12-rc2v2.6.12-rc2
Initial git repository build. I'm not bothering with the full history, even though we have it. We can create a separate "historical" git archive of that later if we want to, and in the meantime it's about 3.2GB when imported into git - space that would just make the early git days unnecessarily complicated, when we don't have a lot of good infrastructure for it. Let it rip!
Diffstat (limited to 'scripts/package')
-rw-r--r--scripts/package/Makefile89
-rw-r--r--scripts/package/builddeb79
-rwxr-xr-xscripts/package/mkspec82
3 files changed, 250 insertions, 0 deletions
diff --git a/scripts/package/Makefile b/scripts/package/Makefile
new file mode 100644
index 000000000000..3b1f2eff2584
--- /dev/null
+++ b/scripts/package/Makefile
@@ -0,0 +1,89 @@
1# Makefile for the different targets used to generate full packages of a kernel
2# It uses the generic clean infrastructure of kbuild
3
4# Ignore the following files/directories during tar operation
5TAR_IGNORE := --exclude SCCS --exclude BitKeeper --exclude .svn --exclude CVS
6
7
8# RPM target
9# ---------------------------------------------------------------------------
10# The rpm target generates two rpm files:
11# /usr/src/packages/SRPMS/kernel-2.6.7rc2-1.src.rpm
12# /usr/src/packages/RPMS/i386/kernel-2.6.7rc2-1.<arch>.rpm
13# The src.rpm files includes all source for the kernel being built
14# The <arch>.rpm includes kernel configuration, modules etc.
15#
16# Process to create the rpm files
17# a) clean the kernel
18# b) Generate .spec file
19# c) Build a tar ball, using symlink to make kernel version
20# first entry in the path
21# d) and pack the result to a tar.gz file
22# e) generate the rpm files, based on kernel.spec
23# - Use /. to avoid tar packing just the symlink
24
25# Do we have rpmbuild, otherwise fall back to the older rpm
26RPM := $(shell if [ -x "/usr/bin/rpmbuild" ]; then echo rpmbuild; \
27 else echo rpm; fi)
28
29# Remove hyphens since they have special meaning in RPM filenames
30KERNELPATH := kernel-$(subst -,,$(KERNELRELEASE))
31MKSPEC := $(srctree)/scripts/package/mkspec
32PREV := set -e; cd ..;
33
34# rpm-pkg
35.PHONY: rpm-pkg rpm
36
37$(objtree)/kernel.spec: $(MKSPEC) $(srctree)/Makefile
38 $(CONFIG_SHELL) $(MKSPEC) > $@
39
40rpm-pkg rpm: $(objtree)/kernel.spec
41 $(MAKE) clean
42 $(PREV) ln -sf $(srctree) $(KERNELPATH)
43 $(PREV) tar -cz $(RCS_TAR_IGNORE) -f $(KERNELPATH).tar.gz $(KERNELPATH)/.
44 $(PREV) rm $(KERNELPATH)
45
46 set -e; \
47 $(CONFIG_SHELL) $(srctree)/scripts/mkversion > $(objtree)/.tmp_version
48 set -e; \
49 mv -f $(objtree)/.tmp_version $(objtree)/.version
50
51 $(RPM) --target $(UTS_MACHINE) -ta ../$(KERNELPATH).tar.gz
52 rm ../$(KERNELPATH).tar.gz
53
54clean-files := $(objtree)/kernel.spec
55
56# binrpm-pkg
57.PHONY: binrpm-pkg
58$(objtree)/binkernel.spec: $(MKSPEC) $(srctree)/Makefile
59 $(CONFIG_SHELL) $(MKSPEC) prebuilt > $@
60
61binrpm-pkg: $(objtree)/binkernel.spec
62 $(MAKE)
63 set -e; \
64 $(CONFIG_SHELL) $(srctree)/scripts/mkversion > $(objtree)/.tmp_version
65 set -e; \
66 mv -f $(objtree)/.tmp_version $(objtree)/.version
67
68 $(RPM) --define "_builddir $(srctree)" --target $(UTS_MACHINE) -bb $<
69
70clean-files += $(objtree)/binkernel.spec
71
72# Deb target
73# ---------------------------------------------------------------------------
74#
75.PHONY: deb-pkg
76deb-pkg:
77 $(MAKE)
78 $(CONFIG_SHELL) $(srctree)/scripts/package/builddeb
79
80clean-dirs += $(objtree)/debian/
81
82
83# Help text displayed when executing 'make help'
84# ---------------------------------------------------------------------------
85help:
86 @echo ' rpm-pkg - Build the kernel as an RPM package'
87 @echo ' binrpm-pkg - Build an rpm package containing the compiled kernel & modules'
88 @echo ' deb-pkg - Build the kernel as an deb package'
89
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
diff --git a/scripts/package/mkspec b/scripts/package/mkspec
new file mode 100755
index 000000000000..6e7a58f145ad
--- /dev/null
+++ b/scripts/package/mkspec
@@ -0,0 +1,82 @@
1#!/bin/sh
2#
3# Output a simple RPM spec file that uses no fancy features requring
4# RPM v4. This is intended to work with any RPM distro.
5#
6# The only gothic bit here is redefining install_post to avoid
7# stripping the symbols from files in the kernel which we want
8#
9# Patched for non-x86 by Opencon (L) 2002 <opencon@rio.skydome.net>
10#
11
12# how we were called determines which rpms we build and how we build them
13if [ "$1" = "prebuilt" ]; then
14 PREBUILT=true
15else
16 PREBUILT=false
17fi
18
19# starting to output the spec
20if [ "`grep CONFIG_DRM=y .config | cut -f2 -d\=`" = "y" ]; then
21 PROVIDES=kernel-drm
22fi
23
24PROVIDES="$PROVIDES kernel-$KERNELRELEASE"
25__KERNELRELEASE=`echo $KERNELRELEASE | sed -e "s/-//g"`
26
27echo "Name: kernel"
28echo "Summary: The Linux Kernel"
29echo "Version: $__KERNELRELEASE"
30# we need to determine the NEXT version number so that uname and
31# rpm -q will agree
32echo "Release: `. $srctree/scripts/mkversion`"
33echo "License: GPL"
34echo "Group: System Environment/Kernel"
35echo "Vendor: The Linux Community"
36echo "URL: http://www.kernel.org"
37
38if ! $PREBUILT; then
39echo "Source: kernel-$__KERNELRELEASE.tar.gz"
40fi
41
42echo "BuildRoot: /var/tmp/%{name}-%{PACKAGE_VERSION}-root"
43echo "Provides: $PROVIDES"
44echo "%define __spec_install_post /usr/lib/rpm/brp-compress || :"
45echo "%define debug_package %{nil}"
46echo ""
47echo "%description"
48echo "The Linux Kernel, the operating system core itself"
49echo ""
50
51if ! $PREBUILT; then
52echo "%prep"
53echo "%setup -q"
54echo ""
55fi
56
57echo "%build"
58
59if ! $PREBUILT; then
60echo "make clean && make %{_smp_mflags}"
61echo ""
62fi
63
64echo "%install"
65echo 'mkdir -p $RPM_BUILD_ROOT/boot $RPM_BUILD_ROOT/lib $RPM_BUILD_ROOT/lib/modules'
66
67echo 'INSTALL_MOD_PATH=$RPM_BUILD_ROOT make %{_smp_mflags} modules_install'
68echo 'cp $KBUILD_IMAGE $RPM_BUILD_ROOT'"/boot/vmlinuz-$KERNELRELEASE"
69
70echo 'cp System.map $RPM_BUILD_ROOT'"/boot/System.map-$KERNELRELEASE"
71
72echo 'cp .config $RPM_BUILD_ROOT'"/boot/config-$KERNELRELEASE"
73echo ""
74echo "%clean"
75echo '#echo -rf $RPM_BUILD_ROOT'
76echo ""
77echo "%files"
78echo '%defattr (-, root, root)'
79echo "%dir /lib/modules"
80echo "/lib/modules/$KERNELRELEASE"
81echo "/boot/*"
82echo ""