diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2011-01-10 08:28:38 -0800 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2011-01-10 08:28:38 -0800 |
commit | 1693ed284f14a288c29f7265f9d71103e4c10821 (patch) | |
tree | e0cc81fbd96c2836785ea551b930b7b5b63370ed | |
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
-rw-r--r-- | Documentation/kbuild/kbuild.txt | 8 | ||||
-rw-r--r-- | scripts/package/builddeb | 93 |
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. The output directory can also be specified using "O=...". Setting "O=..." takes precedence over KBUILD_OUTPUT. +KBUILD_DEBARCH +-------------------------------------------------- +For the deb-pkg target, allows overriding the normal heuristics deployed by +deb-pkg. Normally deb-pkg attempts to guess the right architecture based on +the UTS_MACHINE variable, and on some architectures also the kernel config. +The value of KBUILD_DEBARCH is assumed (not checked) to be a valid Debian +architecture. + ARCH -------------------------------------------------- Set 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() { chown -R root:root "$pdir" chmod -R go-w "$pdir" + # Attempt to find the correct Debian architecture + local forcearch="" debarch="" + case "$UTS_MACHINE" in + i386|ia64|alpha) + debarch="$UTS_MACHINE" ;; + x86_64) + debarch=amd64 ;; + sparc*) + debarch=sparc ;; + s390*) + debarch=s390 ;; + ppc*) + debarch=powerpc ;; + parisc*) + debarch=hppa ;; + mips*) + debarch=mips$(grep -q CPU_LITTLE_ENDIAN=y .config && echo el) ;; + arm*) + debarch=arm$(grep -q CONFIG_AEABI=y .config && echo el) ;; + *) + echo "" >&2 + echo "** ** ** WARNING ** ** **" >&2 + echo "" >&2 + echo "Your architecture doesn't have it's equivalent" >&2 + echo "Debian userspace architecture defined!" >&2 + echo "Falling back to using your current userspace instead!" >&2 + echo "Please add support for $UTS_MACHINE to ${0} ..." >&2 + echo "" >&2 + esac + if [ -n "$KBUILD_DEBARCH" ] ; then + debarch="$KBUILD_DEBARCH" + fi + if [ -n "$debarch" ] ; then + forcearch="-DArchitecture=$debarch" + fi + # Create the package - dpkg-gencontrol -isp -p$pname -P"$pdir" + dpkg-gencontrol -isp $forcearch -p$pname -P"$pdir" dpkg --build "$pdir" .. } @@ -40,17 +76,27 @@ else fi tmpdir="$objtree/debian/tmp" fwdir="$objtree/debian/fwtmp" +kernel_headers_dir="$objtree/debian/hdrtmp" +libc_headers_dir="$objtree/debian/headertmp" packagename=linux-image-$version fwpackagename=linux-firmware-image +kernel_headers_packagename=linux-headers-$version +libc_headers_packagename=linux-libc-dev if [ "$ARCH" = "um" ] ; then packagename=user-mode-linux-$version fi # Setup the directory structure -rm -rf "$tmpdir" "$fwdir" -mkdir -p "$tmpdir/DEBIAN" "$tmpdir/lib" "$tmpdir/boot" "$tmpdir/usr/share/doc/$packagename" -mkdir -p "$fwdir/DEBIAN" "$fwdir/lib" "$fwdir/usr/share/doc/$fwpackagename" +rm -rf "$tmpdir" "$fwdir" "$kernel_headers_dir" "$libc_headers_dir" +mkdir -m 755 -p "$tmpdir/DEBIAN" +mkdir -p "$tmpdir/lib" "$tmpdir/boot" "$tmpdir/usr/share/doc/$packagename" +mkdir -m 755 -p "$fwdir/DEBIAN" +mkdir -p "$fwdir/lib" "$fwdir/usr/share/doc/$fwpackagename" +mkdir -m 755 -p "$libc_headers_dir/DEBIAN" +mkdir -p "$libc_headers_dir/usr/share/doc/$libc_headers_packagename" +mkdir -m 755 -p "$kernel_headers_dir/DEBIAN" +mkdir -p "$kernel_headers_dir/usr/share/doc/$kernel_headers_packagename" if [ "$ARCH" = "um" ] ; then mkdir -p "$tmpdir/usr/lib/uml/modules/$version" "$tmpdir/usr/bin" fi @@ -81,6 +127,9 @@ if grep -q '^CONFIG_MODULES=y' .config ; then fi fi +make headers_check +make headers_install INSTALL_HDR_PATH="$libc_headers_dir/usr" + # Install the maintainer scripts # Note: hook scripts under /etc/kernel are also executed by official Debian # kernel packages, as well as kernel packages built using make-kpkg @@ -188,6 +237,30 @@ EOF fi +# Build header package +find . -name Makefile -o -name Kconfig\* -o -name \*.pl > /tmp/files$$ +find arch/x86/include include scripts -type f >> /tmp/files$$ +(cd $objtree; find .config Module.symvers include scripts -type f >> /tmp/objfiles$$) +destdir=$kernel_headers_dir/usr/src/linux-headers-$version +mkdir -p "$destdir" +tar -c -f - -T /tmp/files$$ | (cd $destdir; tar -xf -) +(cd $objtree; tar -c -f - -T /tmp/objfiles$$) | (cd $destdir; tar -xf -) +rm -f /tmp/files$$ /tmp/objfiles$$ +arch=$(dpkg --print-architecture) + +cat <<EOF >> debian/control + +Package: $kernel_headers_packagename +Provides: linux-headers, linux-headers-2.6 +Architecture: $arch +Description: Linux kernel headers for $KERNELRELEASE on $arch + This package provides kernel header files for $KERNELRELEASE on $arch + . + This is useful for people who need to build external modules +EOF + +create_package "$kernel_headers_packagename" "$kernel_headers_dir" + # Do we have firmware? Move it out of the way and build it into a package. if [ -e "$tmpdir/lib/firmware" ]; then mv "$tmpdir/lib/firmware" "$fwdir/lib/" @@ -203,6 +276,18 @@ EOF create_package "$fwpackagename" "$fwdir" fi +cat <<EOF >> debian/control + +Package: $libc_headers_packagename +Section: devel +Provides: linux-kernel-headers +Architecture: any +Description: Linux support headers for userspace development + This package provides userspaces headers from the Linux kernel. These headers + are used by the installed headers for GNU glibc and other system libraries. +EOF + +create_package "$libc_headers_packagename" "$libc_headers_dir" create_package "$packagename" "$tmpdir" exit 0 |