aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2011-01-10 11:28:38 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2011-01-10 11:28:38 -0500
commit1693ed284f14a288c29f7265f9d71103e4c10821 (patch)
treee0cc81fbd96c2836785ea551b930b7b5b63370ed
parentf28b1c8aaa97a68028bb894bffb1690185c62b01 (diff)
parentee81b786a07f1d6062d6e14b6152f1f6cc4bc63b (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
-rw-r--r--Documentation/kbuild/kbuild.txt8
-rw-r--r--scripts/package/builddeb93
2 files changed, 97 insertions, 4 deletions
diff --git a/Documentation/kbuild/kbuild.txt b/Documentation/kbuild/kbuild.txt
index 1e5165aa9e4e..4a990317b84a 100644
--- a/Documentation/kbuild/kbuild.txt
+++ b/Documentation/kbuild/kbuild.txt
@@ -73,6 +73,14 @@ Specify the output directory when building the kernel.
73The output directory can also be specified using "O=...". 73The output directory can also be specified using "O=...".
74Setting "O=..." takes precedence over KBUILD_OUTPUT. 74Setting "O=..." takes precedence over KBUILD_OUTPUT.
75 75
76KBUILD_DEBARCH
77--------------------------------------------------
78For the deb-pkg target, allows overriding the normal heuristics deployed by
79deb-pkg. Normally deb-pkg attempts to guess the right architecture based on
80the UTS_MACHINE variable, and on some architectures also the kernel config.
81The value of KBUILD_DEBARCH is assumed (not checked) to be a valid Debian
82architecture.
83
76ARCH 84ARCH
77-------------------------------------------------- 85--------------------------------------------------
78Set ARCH to the architecture to be built. 86Set ARCH to the architecture to be built.
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
40fi 76fi
41tmpdir="$objtree/debian/tmp" 77tmpdir="$objtree/debian/tmp"
42fwdir="$objtree/debian/fwtmp" 78fwdir="$objtree/debian/fwtmp"
79kernel_headers_dir="$objtree/debian/hdrtmp"
80libc_headers_dir="$objtree/debian/headertmp"
43packagename=linux-image-$version 81packagename=linux-image-$version
44fwpackagename=linux-firmware-image 82fwpackagename=linux-firmware-image
83kernel_headers_packagename=linux-headers-$version
84libc_headers_packagename=linux-libc-dev
45 85
46if [ "$ARCH" = "um" ] ; then 86if [ "$ARCH" = "um" ] ; then
47 packagename=user-mode-linux-$version 87 packagename=user-mode-linux-$version
48fi 88fi
49 89
50# Setup the directory structure 90# Setup the directory structure
51rm -rf "$tmpdir" "$fwdir" 91rm -rf "$tmpdir" "$fwdir" "$kernel_headers_dir" "$libc_headers_dir"
52mkdir -p "$tmpdir/DEBIAN" "$tmpdir/lib" "$tmpdir/boot" "$tmpdir/usr/share/doc/$packagename" 92mkdir -m 755 -p "$tmpdir/DEBIAN"
53mkdir -p "$fwdir/DEBIAN" "$fwdir/lib" "$fwdir/usr/share/doc/$fwpackagename" 93mkdir -p "$tmpdir/lib" "$tmpdir/boot" "$tmpdir/usr/share/doc/$packagename"
94mkdir -m 755 -p "$fwdir/DEBIAN"
95mkdir -p "$fwdir/lib" "$fwdir/usr/share/doc/$fwpackagename"
96mkdir -m 755 -p "$libc_headers_dir/DEBIAN"
97mkdir -p "$libc_headers_dir/usr/share/doc/$libc_headers_packagename"
98mkdir -m 755 -p "$kernel_headers_dir/DEBIAN"
99mkdir -p "$kernel_headers_dir/usr/share/doc/$kernel_headers_packagename"
54if [ "$ARCH" = "um" ] ; then 100if [ "$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"
56fi 102fi
@@ -81,6 +127,9 @@ if grep -q '^CONFIG_MODULES=y' .config ; then
81 fi 127 fi
82fi 128fi
83 129
130make headers_check
131make 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
189fi 238fi
190 239
240# Build header package
241find . -name Makefile -o -name Kconfig\* -o -name \*.pl > /tmp/files$$
242find arch/x86/include include scripts -type f >> /tmp/files$$
243(cd $objtree; find .config Module.symvers include scripts -type f >> /tmp/objfiles$$)
244destdir=$kernel_headers_dir/usr/src/linux-headers-$version
245mkdir -p "$destdir"
246tar -c -f - -T /tmp/files$$ | (cd $destdir; tar -xf -)
247(cd $objtree; tar -c -f - -T /tmp/objfiles$$) | (cd $destdir; tar -xf -)
248rm -f /tmp/files$$ /tmp/objfiles$$
249arch=$(dpkg --print-architecture)
250
251cat <<EOF >> debian/control
252
253Package: $kernel_headers_packagename
254Provides: linux-headers, linux-headers-2.6
255Architecture: $arch
256Description: 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
260EOF
261
262create_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.
192if [ -e "$tmpdir/lib/firmware" ]; then 265if [ -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"
204fi 277fi
205 278
279cat <<EOF >> debian/control
280
281Package: $libc_headers_packagename
282Section: devel
283Provides: linux-kernel-headers
284Architecture: any
285Description: 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.
288EOF
289
290create_package "$libc_headers_packagename" "$libc_headers_dir"
206create_package "$packagename" "$tmpdir" 291create_package "$packagename" "$tmpdir"
207 292
208exit 0 293exit 0