diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2011-01-10 11:28:38 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2011-01-10 11:28:38 -0500 |
commit | 1693ed284f14a288c29f7265f9d71103e4c10821 (patch) | |
tree | e0cc81fbd96c2836785ea551b930b7b5b63370ed /scripts/package | |
parent | f28b1c8aaa97a68028bb894bffb1690185c62b01 (diff) | |
parent | ee81b786a07f1d6062d6e14b6152f1f6cc4bc63b (diff) |
Merge branch 'packaging' of git://git.kernel.org/pub/scm/linux/kernel/git/mmarek/kbuild-2.6
* 'packaging' of git://git.kernel.org/pub/scm/linux/kernel/git/mmarek/kbuild-2.6:
deb-pkg: s/hdr/kernel_headers_/ && s/header/libc_headers_/
deb-pkg: Make deb-pkg generate a seperate linux-libc-dev deb
kbuild: create linux-headers package in deb-pkg
kbuild, deb-pkg: support overriding userland architecture
kbuild, deb-pkg: select userland architecture based on UTS_MACHINE
kbuild, deb-pkg: Fix build with paranoid umask
Diffstat (limited to 'scripts/package')
-rw-r--r-- | scripts/package/builddeb | 93 |
1 files changed, 89 insertions, 4 deletions
diff --git a/scripts/package/builddeb b/scripts/package/builddeb index 49b74e1ee12d..b0b2357aef42 100644 --- a/scripts/package/builddeb +++ b/scripts/package/builddeb | |||
@@ -25,8 +25,44 @@ create_package() { | |||
25 | chown -R root:root "$pdir" | 25 | chown -R root:root "$pdir" |
26 | chmod -R go-w "$pdir" | 26 | chmod -R go-w "$pdir" |
27 | 27 | ||
28 | # Attempt to find the correct Debian architecture | ||
29 | local forcearch="" debarch="" | ||
30 | case "$UTS_MACHINE" in | ||
31 | i386|ia64|alpha) | ||
32 | debarch="$UTS_MACHINE" ;; | ||
33 | x86_64) | ||
34 | debarch=amd64 ;; | ||
35 | sparc*) | ||
36 | debarch=sparc ;; | ||
37 | s390*) | ||
38 | debarch=s390 ;; | ||
39 | ppc*) | ||
40 | debarch=powerpc ;; | ||
41 | parisc*) | ||
42 | debarch=hppa ;; | ||
43 | mips*) | ||
44 | debarch=mips$(grep -q CPU_LITTLE_ENDIAN=y .config && echo el) ;; | ||
45 | arm*) | ||
46 | debarch=arm$(grep -q CONFIG_AEABI=y .config && echo el) ;; | ||
47 | *) | ||
48 | echo "" >&2 | ||
49 | echo "** ** ** WARNING ** ** **" >&2 | ||
50 | echo "" >&2 | ||
51 | echo "Your architecture doesn't have it's equivalent" >&2 | ||
52 | echo "Debian userspace architecture defined!" >&2 | ||
53 | echo "Falling back to using your current userspace instead!" >&2 | ||
54 | echo "Please add support for $UTS_MACHINE to ${0} ..." >&2 | ||
55 | echo "" >&2 | ||
56 | esac | ||
57 | if [ -n "$KBUILD_DEBARCH" ] ; then | ||
58 | debarch="$KBUILD_DEBARCH" | ||
59 | fi | ||
60 | if [ -n "$debarch" ] ; then | ||
61 | forcearch="-DArchitecture=$debarch" | ||
62 | fi | ||
63 | |||
28 | # Create the package | 64 | # Create the package |
29 | dpkg-gencontrol -isp -p$pname -P"$pdir" | 65 | dpkg-gencontrol -isp $forcearch -p$pname -P"$pdir" |
30 | dpkg --build "$pdir" .. | 66 | dpkg --build "$pdir" .. |
31 | } | 67 | } |
32 | 68 | ||
@@ -40,17 +76,27 @@ else | |||
40 | fi | 76 | fi |
41 | tmpdir="$objtree/debian/tmp" | 77 | tmpdir="$objtree/debian/tmp" |
42 | fwdir="$objtree/debian/fwtmp" | 78 | fwdir="$objtree/debian/fwtmp" |
79 | kernel_headers_dir="$objtree/debian/hdrtmp" | ||
80 | libc_headers_dir="$objtree/debian/headertmp" | ||
43 | packagename=linux-image-$version | 81 | packagename=linux-image-$version |
44 | fwpackagename=linux-firmware-image | 82 | fwpackagename=linux-firmware-image |
83 | kernel_headers_packagename=linux-headers-$version | ||
84 | libc_headers_packagename=linux-libc-dev | ||
45 | 85 | ||
46 | if [ "$ARCH" = "um" ] ; then | 86 | if [ "$ARCH" = "um" ] ; then |
47 | packagename=user-mode-linux-$version | 87 | packagename=user-mode-linux-$version |
48 | fi | 88 | fi |
49 | 89 | ||
50 | # Setup the directory structure | 90 | # Setup the directory structure |
51 | rm -rf "$tmpdir" "$fwdir" | 91 | rm -rf "$tmpdir" "$fwdir" "$kernel_headers_dir" "$libc_headers_dir" |
52 | mkdir -p "$tmpdir/DEBIAN" "$tmpdir/lib" "$tmpdir/boot" "$tmpdir/usr/share/doc/$packagename" | 92 | mkdir -m 755 -p "$tmpdir/DEBIAN" |
53 | mkdir -p "$fwdir/DEBIAN" "$fwdir/lib" "$fwdir/usr/share/doc/$fwpackagename" | 93 | mkdir -p "$tmpdir/lib" "$tmpdir/boot" "$tmpdir/usr/share/doc/$packagename" |
94 | mkdir -m 755 -p "$fwdir/DEBIAN" | ||
95 | mkdir -p "$fwdir/lib" "$fwdir/usr/share/doc/$fwpackagename" | ||
96 | mkdir -m 755 -p "$libc_headers_dir/DEBIAN" | ||
97 | mkdir -p "$libc_headers_dir/usr/share/doc/$libc_headers_packagename" | ||
98 | mkdir -m 755 -p "$kernel_headers_dir/DEBIAN" | ||
99 | mkdir -p "$kernel_headers_dir/usr/share/doc/$kernel_headers_packagename" | ||
54 | if [ "$ARCH" = "um" ] ; then | 100 | if [ "$ARCH" = "um" ] ; then |
55 | mkdir -p "$tmpdir/usr/lib/uml/modules/$version" "$tmpdir/usr/bin" | 101 | mkdir -p "$tmpdir/usr/lib/uml/modules/$version" "$tmpdir/usr/bin" |
56 | fi | 102 | fi |
@@ -81,6 +127,9 @@ if grep -q '^CONFIG_MODULES=y' .config ; then | |||
81 | fi | 127 | fi |
82 | fi | 128 | fi |
83 | 129 | ||
130 | make headers_check | ||
131 | make headers_install INSTALL_HDR_PATH="$libc_headers_dir/usr" | ||
132 | |||
84 | # Install the maintainer scripts | 133 | # Install the maintainer scripts |
85 | # Note: hook scripts under /etc/kernel are also executed by official Debian | 134 | # Note: hook scripts under /etc/kernel are also executed by official Debian |
86 | # kernel packages, as well as kernel packages built using make-kpkg | 135 | # kernel packages, as well as kernel packages built using make-kpkg |
@@ -188,6 +237,30 @@ EOF | |||
188 | 237 | ||
189 | fi | 238 | fi |
190 | 239 | ||
240 | # Build header package | ||
241 | find . -name Makefile -o -name Kconfig\* -o -name \*.pl > /tmp/files$$ | ||
242 | find arch/x86/include include scripts -type f >> /tmp/files$$ | ||
243 | (cd $objtree; find .config Module.symvers include scripts -type f >> /tmp/objfiles$$) | ||
244 | destdir=$kernel_headers_dir/usr/src/linux-headers-$version | ||
245 | mkdir -p "$destdir" | ||
246 | tar -c -f - -T /tmp/files$$ | (cd $destdir; tar -xf -) | ||
247 | (cd $objtree; tar -c -f - -T /tmp/objfiles$$) | (cd $destdir; tar -xf -) | ||
248 | rm -f /tmp/files$$ /tmp/objfiles$$ | ||
249 | arch=$(dpkg --print-architecture) | ||
250 | |||
251 | cat <<EOF >> debian/control | ||
252 | |||
253 | Package: $kernel_headers_packagename | ||
254 | Provides: linux-headers, linux-headers-2.6 | ||
255 | Architecture: $arch | ||
256 | Description: Linux kernel headers for $KERNELRELEASE on $arch | ||
257 | This package provides kernel header files for $KERNELRELEASE on $arch | ||
258 | . | ||
259 | This is useful for people who need to build external modules | ||
260 | EOF | ||
261 | |||
262 | create_package "$kernel_headers_packagename" "$kernel_headers_dir" | ||
263 | |||
191 | # Do we have firmware? Move it out of the way and build it into a package. | 264 | # Do we have firmware? Move it out of the way and build it into a package. |
192 | if [ -e "$tmpdir/lib/firmware" ]; then | 265 | if [ -e "$tmpdir/lib/firmware" ]; then |
193 | mv "$tmpdir/lib/firmware" "$fwdir/lib/" | 266 | mv "$tmpdir/lib/firmware" "$fwdir/lib/" |
@@ -203,6 +276,18 @@ EOF | |||
203 | create_package "$fwpackagename" "$fwdir" | 276 | create_package "$fwpackagename" "$fwdir" |
204 | fi | 277 | fi |
205 | 278 | ||
279 | cat <<EOF >> debian/control | ||
280 | |||
281 | Package: $libc_headers_packagename | ||
282 | Section: devel | ||
283 | Provides: linux-kernel-headers | ||
284 | Architecture: any | ||
285 | Description: Linux support headers for userspace development | ||
286 | This package provides userspaces headers from the Linux kernel. These headers | ||
287 | are used by the installed headers for GNU glibc and other system libraries. | ||
288 | EOF | ||
289 | |||
290 | create_package "$libc_headers_packagename" "$libc_headers_dir" | ||
206 | create_package "$packagename" "$tmpdir" | 291 | create_package "$packagename" "$tmpdir" |
207 | 292 | ||
208 | exit 0 | 293 | exit 0 |