blob: d8fffe6f890657b3b42c32639ad8bc5313880328 [file] [log] [blame]
Jan-Benedict Glaw6d983fe2005-05-24 11:27:37 +02001#!/bin/sh
2
3#
4# buildtar 0.0.3
5#
6# (C) 2004-2005 by Jan-Benedict Glaw <jbglaw@lug-owl.de>
7#
8# This script is used to compile a tarball from the currently
9# prepared kernel. Based upon the builddeb script from
10# Wichert Akkerman <wichert@wiggy.net>.
11#
12
13set -e
14
15#
16# Some variables and settings used throughout the script
17#
18version="${VERSION}.${PATCHLEVEL}.${SUBLEVEL}${EXTRAVERSION}${EXTRANAME}"
19tmpdir="${objtree}/tar-install"
20tarball="${objtree}/linux-${version}.tar"
21
22
23#
24# Figure out how to compress, if requested at all
25#
26case "${1}" in
27 tar-pkg)
28 compress="cat"
29 file_ext=""
30 ;;
31 targz-pkg)
32 compress="gzip -c9"
33 file_ext=".gz"
34 ;;
35 tarbz2-pkg)
36 compress="bzip2 -c9"
37 file_ext=".bz2"
38 ;;
39 *)
40 echo "Unknown tarball target \"${1}\" requested, please add it to ${0}." >&2
41 exit 1
42 ;;
43esac
44
45
46#
47# Clean-up and re-create the temporary directory
48#
49rm -rf -- "${tmpdir}"
50mkdir -p -- "${tmpdir}/boot"
51
52
53#
54# Try to install modules
55#
56if ! make INSTALL_MOD_PATH="${tmpdir}" modules_install; then
57 echo "" >&2
58 echo "Ignoring error at module_install time, since that could be" >&2
59 echo "a result of missing local modutils/module-init-tools," >&2
60 echo "or you just didn't compile in module support at all..." >&2
61 echo "" >&2
62fi
63
64
65#
66# Install basic kernel files
67#
68cp -v -- System.map "${tmpdir}/boot/System.map-${version}"
69cp -v -- .config "${tmpdir}/boot/config-${version}"
70cp -v -- vmlinux "${tmpdir}/boot/vmlinux-${version}"
71
72
73#
74# Install arch-specific kernel image(s)
75#
76case "${ARCH}" in
77 i386)
78 [ -f arch/i386/boot/bzImage ] && cp -v -- arch/i386/boot/bzImage "${tmpdir}/boot/vmlinuz-${version}"
79 ;;
80 alpha)
81 [ -f arch/alpha/boot/vmlinux.gz ] && cp -v -- arch/alpha/boot/vmlinux.gz "${tmpdir}/boot/vmlinuz-${version}"
82 ;;
83 vax)
84 [ -f vmlinux.SYS ] && cp -v -- vmlinux.SYS "${tmpdir}/boot/vmlinux-${version}.SYS"
85 [ -f vmlinux.dsk ] && cp -v -- vmlinux.dsk "${tmpdir}/boot/vmlinux-${version}.dsk"
86 ;;
87 *)
88 [ -f "${KBUILD_IMAGE}" ] && cp -v -- "${KBUILD_IMAGE}" "${tmpdir}/boot/vmlinux-kbuild-${version}"
89 echo "" >&2
90 echo '** ** ** WARNING ** ** **' >&2
91 echo "" >&2
92 echo "Your architecture did not define any architecture-dependant files" >&2
93 echo "to be placed into the tarball. Please add those to ${0} ..." >&2
94 echo "" >&2
95 sleep 5
96 ;;
97esac
98
99
100#
101# Create the tarball
102#
103(
104 cd "${tmpdir}"
105 tar cf - . | ${compress} > "${tarball}${file_ext}"
106)
107
108echo "Tarball successfully created in ${tarball}${file_ext}"
109
110exit 0
111