From e86c2412c88fbe4676920c40348d3c547c9edb0d Mon Sep 17 00:00:00 2001 From: maximilian attems Date: Fri, 29 Oct 2010 15:55:50 +0200 Subject: kbuild, deb-pkg: Fix build with paranoid umask umask 077 make deb-pkg dpkg-deb: building package `linux-image-2.6.36+' in `../linux-image-2.6.36+_2.6.36+-4_amd64.deb'. dpkg-deb: control directory has bad permissions 700 (must be >=0755 and <=0775) make[1]: *** [deb-pkg] Error 2 Reported-by: Bastian Blank Signed-off-by: maximilian attems Signed-off-by: Michal Marek --- scripts/package/builddeb | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'scripts') diff --git a/scripts/package/builddeb b/scripts/package/builddeb index 49b74e1ee12..4dfec9aaaac 100644 --- a/scripts/package/builddeb +++ b/scripts/package/builddeb @@ -49,8 +49,10 @@ 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" +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" if [ "$ARCH" = "um" ] ; then mkdir -p "$tmpdir/usr/lib/uml/modules/$version" "$tmpdir/usr/bin" fi -- cgit v1.2.3 From 10f26fa64200095af0e5d80a980e47877865e4b7 Mon Sep 17 00:00:00 2001 From: Asbjoern Sloth Toennesen Date: Fri, 5 Nov 2010 13:30:08 +0000 Subject: kbuild, deb-pkg: select userland architecture based on UTS_MACHINE Instead of creating the debian package for the compiling userland, create it for a userland matching the kernel thats being compiled. This patch supports all Lenny release architectures, and Linux-based architecture candidates for Squeeze. If it can't find a proper Debian userspace it displays a warning, and fallback to let deb-gencontrol use the host's userspace arch. Eg. with this patch the following make command: make ARCH=i386 deb-pkg will output an i386 Debian package instead of an amd64 one, when run on an amd64 machine. Signed-off-by: Asbjoern Sloth Toennesen Acked-by: maximilian attems Signed-off-by: Michal Marek --- scripts/package/builddeb | 35 ++++++++++++++++++++++++++++++++++- 1 file changed, 34 insertions(+), 1 deletion(-) (limited to 'scripts') diff --git a/scripts/package/builddeb b/scripts/package/builddeb index 4dfec9aaaac..5d6be3f5e7f 100644 --- a/scripts/package/builddeb +++ b/scripts/package/builddeb @@ -25,8 +25,41 @@ 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 "$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" .. } -- cgit v1.2.3 From 55f88eccf9c288eed2f93f9ca7d7fe4dd2da762e Mon Sep 17 00:00:00 2001 From: Asbjoern Sloth Toennesen Date: Sun, 12 Dec 2010 17:39:40 +0000 Subject: kbuild, deb-pkg: support overriding userland architecture Usefull if building for sparc64 userland, because the sparc and sparc64 userlands use the same 64-bit kernel, making it impossible to always select the correct userland architecture for the resulting debian package. Might also be usefull, if you want a i386 userland with a amd64 kernel. Example usage: make KBUILD_DEBARCH=i386 deb-pkg LKML-reference: Signed-off-by: Asbjoern Sloth Toennesen Reviewed-by: WANG Cong Acked-by: maximilian attems Signed-off-by: Michal Marek --- scripts/package/builddeb | 3 +++ 1 file changed, 3 insertions(+) (limited to 'scripts') diff --git a/scripts/package/builddeb b/scripts/package/builddeb index 5d6be3f5e7f..ffe24194b76 100644 --- a/scripts/package/builddeb +++ b/scripts/package/builddeb @@ -54,6 +54,9 @@ create_package() { 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 -- cgit v1.2.3 From cd8d60a20a4516016c117ac0f1ac7b06ff606f7e Mon Sep 17 00:00:00 2001 From: Theodore Ts'o Date: Fri, 24 Dec 2010 09:42:10 -0500 Subject: kbuild: create linux-headers package in deb-pkg Create a linux-headers-$KVER.deb package which can be used to build external modules without having the source tree around. Signed-off-by: "Theodore Ts'o" Signed-off-by: Michal Marek --- scripts/package/builddeb | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) (limited to 'scripts') diff --git a/scripts/package/builddeb b/scripts/package/builddeb index ffe24194b76..5fc1e6f7183 100644 --- a/scripts/package/builddeb +++ b/scripts/package/builddeb @@ -76,15 +76,17 @@ else fi tmpdir="$objtree/debian/tmp" fwdir="$objtree/debian/fwtmp" +hdrdir="$objtree/debian/hdrtmp" packagename=linux-image-$version fwpackagename=linux-firmware-image +hdrpackagename=linux-headers-$version if [ "$ARCH" = "um" ] ; then packagename=user-mode-linux-$version fi # Setup the directory structure -rm -rf "$tmpdir" "$fwdir" +rm -rf "$tmpdir" "$fwdir" "$hdrdir" mkdir -m 755 -p "$tmpdir/DEBIAN" mkdir -p "$tmpdir/lib" "$tmpdir/boot" "$tmpdir/usr/share/doc/$packagename" mkdir -m 755 -p "$fwdir/DEBIAN" @@ -226,6 +228,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=$hdrdir/usr/src/linux-headers-$version +mkdir -p "$destdir" "$hdrdir/DEBIAN" "$hdrdir/usr/share/doc/$hdrpackagename" +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 <> debian/control + +Package: $hdrpackagename +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 "$hdrpackagename" "$hdrdir" + # 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/" -- cgit v1.2.3 From e68077856e599cd33d8cd5db15762df60c29d361 Mon Sep 17 00:00:00 2001 From: maximilian attems Date: Sat, 1 Jan 2011 16:44:13 +0100 Subject: deb-pkg: Make deb-pkg generate a seperate linux-libc-dev deb userland dev likes latest incarnation of that userland API. make it easy to also build it on make deb-pkg invocation: dpkg-deb: building package `linux-libc-dev' in `../linux-libc-dev_2.6.32-rc6-4_amd64.deb'. Last year patch rebased on top of latest deb-pkg changes. Signed-off-by: maximilian attems Signed-off-by: Michal Marek --- scripts/package/builddeb | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) (limited to 'scripts') diff --git a/scripts/package/builddeb b/scripts/package/builddeb index 5fc1e6f7183..8c1f8d4d156 100644 --- a/scripts/package/builddeb +++ b/scripts/package/builddeb @@ -77,20 +77,24 @@ fi tmpdir="$objtree/debian/tmp" fwdir="$objtree/debian/fwtmp" hdrdir="$objtree/debian/hdrtmp" +headerdir="$objtree/debian/headertmp" packagename=linux-image-$version fwpackagename=linux-firmware-image hdrpackagename=linux-headers-$version +headerpackagename=linux-libc-dev if [ "$ARCH" = "um" ] ; then packagename=user-mode-linux-$version fi # Setup the directory structure -rm -rf "$tmpdir" "$fwdir" "$hdrdir" +rm -rf "$tmpdir" "$fwdir" "$hdrdir" "$headerdir" 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 "$headerdir/DEBIAN" +mkdir -p "$headerdir/usr/share/doc/$headerpackagename" if [ "$ARCH" = "um" ] ; then mkdir -p "$tmpdir/usr/lib/uml/modules/$version" "$tmpdir/usr/bin" fi @@ -121,6 +125,9 @@ if grep -q '^CONFIG_MODULES=y' .config ; then fi fi +make headers_check +make headers_install INSTALL_HDR_PATH="$headerdir/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 @@ -267,6 +274,18 @@ EOF create_package "$fwpackagename" "$fwdir" fi +cat <> debian/control + +Package: $headerpackagename +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 "$headerpackagename" "$headerdir" create_package "$packagename" "$tmpdir" exit 0 -- cgit v1.2.3 From ee81b786a07f1d6062d6e14b6152f1f6cc4bc63b Mon Sep 17 00:00:00 2001 From: maximilian attems Date: Fri, 7 Jan 2011 16:13:06 +0100 Subject: deb-pkg: s/hdr/kernel_headers_/ && s/header/libc_headers_/ hdrpackage and headerpackage are not intuitive names, use proposed alternatives by Michel Marek. While touching them move the mkdir of the kernel_headers dir up and fix it for paranoid umask. CC: Theodore Ts'o Signed-off-by: maximilian attems Signed-off-by: Michal Marek --- scripts/package/builddeb | 30 ++++++++++++++++-------------- 1 file changed, 16 insertions(+), 14 deletions(-) (limited to 'scripts') diff --git a/scripts/package/builddeb b/scripts/package/builddeb index 8c1f8d4d156..b0b2357aef4 100644 --- a/scripts/package/builddeb +++ b/scripts/package/builddeb @@ -76,25 +76,27 @@ else fi tmpdir="$objtree/debian/tmp" fwdir="$objtree/debian/fwtmp" -hdrdir="$objtree/debian/hdrtmp" -headerdir="$objtree/debian/headertmp" +kernel_headers_dir="$objtree/debian/hdrtmp" +libc_headers_dir="$objtree/debian/headertmp" packagename=linux-image-$version fwpackagename=linux-firmware-image -hdrpackagename=linux-headers-$version -headerpackagename=linux-libc-dev +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" "$hdrdir" "$headerdir" +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 "$headerdir/DEBIAN" -mkdir -p "$headerdir/usr/share/doc/$headerpackagename" +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 @@ -126,7 +128,7 @@ if grep -q '^CONFIG_MODULES=y' .config ; then fi make headers_check -make headers_install INSTALL_HDR_PATH="$headerdir/usr" +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 @@ -239,8 +241,8 @@ fi 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=$hdrdir/usr/src/linux-headers-$version -mkdir -p "$destdir" "$hdrdir/DEBIAN" "$hdrdir/usr/share/doc/$hdrpackagename" +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$$ @@ -248,7 +250,7 @@ arch=$(dpkg --print-architecture) cat <> debian/control -Package: $hdrpackagename +Package: $kernel_headers_packagename Provides: linux-headers, linux-headers-2.6 Architecture: $arch Description: Linux kernel headers for $KERNELRELEASE on $arch @@ -257,7 +259,7 @@ Description: Linux kernel headers for $KERNELRELEASE on $arch This is useful for people who need to build external modules EOF -create_package "$hdrpackagename" "$hdrdir" +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 @@ -276,7 +278,7 @@ fi cat <> debian/control -Package: $headerpackagename +Package: $libc_headers_packagename Section: devel Provides: linux-kernel-headers Architecture: any @@ -285,7 +287,7 @@ Description: Linux support headers for userspace development are used by the installed headers for GNU glibc and other system libraries. EOF -create_package "$headerpackagename" "$headerdir" +create_package "$libc_headers_packagename" "$libc_headers_dir" create_package "$packagename" "$tmpdir" exit 0 -- cgit v1.2.3