From patchwork Mon Nov 14 02:47:49 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Donnellan X-Patchwork-Id: 9425759 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 0331B60484 for ; Mon, 14 Nov 2016 02:48:49 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id ED0DA2888D for ; Mon, 14 Nov 2016 02:48:48 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E1B9728893; Mon, 14 Nov 2016 02:48:48 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.4 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1FB702888F for ; Mon, 14 Nov 2016 02:48:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S935646AbcKNCso (ORCPT ); Sun, 13 Nov 2016 21:48:44 -0500 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:33185 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752820AbcKNCsR (ORCPT ); Sun, 13 Nov 2016 21:48:17 -0500 Received: from pps.filterd (m0098396.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.17/8.16.0.17) with SMTP id uAE2hl92115642 for ; Sun, 13 Nov 2016 21:48:17 -0500 Received: from e23smtp02.au.ibm.com (e23smtp02.au.ibm.com [202.81.31.144]) by mx0a-001b2d01.pphosted.com with ESMTP id 26pqj13erd-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Sun, 13 Nov 2016 21:48:16 -0500 Received: from localhost by e23smtp02.au.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Mon, 14 Nov 2016 12:48:14 +1000 Received: from d23dlp01.au.ibm.com (202.81.31.203) by e23smtp02.au.ibm.com (202.81.31.208) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Mon, 14 Nov 2016 12:48:13 +1000 Received: from d23relay09.au.ibm.com (d23relay09.au.ibm.com [9.185.63.181]) by d23dlp01.au.ibm.com (Postfix) with ESMTP id 7ABCF2CE805A; Mon, 14 Nov 2016 13:48:12 +1100 (EST) Received: from d23av04.au.ibm.com (d23av04.au.ibm.com [9.190.235.139]) by d23relay09.au.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id uAE2mC4J62259450; Mon, 14 Nov 2016 13:48:12 +1100 Received: from d23av04.au.ibm.com (localhost [127.0.0.1]) by d23av04.au.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id uAE2mC4c001623; Mon, 14 Nov 2016 13:48:12 +1100 Received: from ozlabs.au.ibm.com (ozlabs.au.ibm.com [9.192.253.14]) by d23av04.au.ibm.com (8.14.4/8.14.4/NCO v10.0 AVin) with ESMTP id uAE2mC5m001620; Mon, 14 Nov 2016 13:48:12 +1100 Received: from ajd.ozlabs.ibm.com (haven.au.ibm.com [9.192.254.114]) (using TLSv1.2 with cipher AES128-SHA256 (128/128 bits)) (No client certificate requested) by ozlabs.au.ibm.com (Postfix) with ESMTPSA id CC1FBA0277; Mon, 14 Nov 2016 13:48:11 +1100 (AEDT) From: Andrew Donnellan To: mmarek@suse.com, linux-kbuild@vger.kernel.org Cc: linux-kernel@vger.kernel.org Subject: [PATCH RESEND 2/2] builddeb: allow building without headers/firmware packages Date: Mon, 14 Nov 2016 13:47:49 +1100 X-Mailer: git-send-email 2.10.2 In-Reply-To: <20161114024749.25488-1-andrew.donnellan@au1.ibm.com> References: <20161114024749.25488-1-andrew.donnellan@au1.ibm.com> X-TM-AS-MML: disable X-Content-Scanned: Fidelis XPS MAILER x-cbid: 16111402-0004-0000-0000-000001B77B4F X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 16111402-0005-0000-0000-000009183026 Message-Id: <20161114024749.25488-2-andrew.donnellan@au1.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2016-11-13_11:, , signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 suspectscore=0 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1609300000 definitions=main-1611140052 Sender: linux-kbuild-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kbuild@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Currently, the deb-pkg and bindeb-pkg targets create multiple packages for the kernel binaries, headers, userspace headers and firmware. For developers who generate Debian packages as part of their development workflows, it's often not necessary to generate all these packages. Allow the creation of the linux-headers, linux-libc-dev and linux-firmware packages to be disabled if the environment variables KDEB_NO_HEADERS, KDEB_NO_LIBC_HEADERS or KDEB_NO_FIRMWARE are non-empty. Signed-off-by: Andrew Donnellan Tested-by: Jim Davis --- Documentation/kbuild/kbuild.txt | 7 +++++ scripts/package/builddeb | 67 ++++++++++++++++++++++++----------------- 2 files changed, 46 insertions(+), 28 deletions(-) diff --git a/Documentation/kbuild/kbuild.txt b/Documentation/kbuild/kbuild.txt index 0ff6a46..cef4f7f 100644 --- a/Documentation/kbuild/kbuild.txt +++ b/Documentation/kbuild/kbuild.txt @@ -238,3 +238,10 @@ KBUILD_VMLINUX_MAIN All object files for the main part of vmlinux. KBUILD_VMLINUX_INIT and KBUILD_VMLINUX_MAIN together specify all the object files used to link vmlinux. + +KDEB_NO_HEADERS, KDEB_NO_LIBC_HEADERS, KDEB_NO_FIRMWARE +------------------------------------------------------- +If these variables are set, the deb-pkg and bindeb-pkg targets won't create +linux-headers, linux-libc-dev and linux-firmware packages respectively. This +may be useful for developers who use the deb-pkg targets in their workflow +but don't need the full set of packages. diff --git a/scripts/package/builddeb b/scripts/package/builddeb index d600fd0..da595da 100755 --- a/scripts/package/builddeb +++ b/scripts/package/builddeb @@ -187,7 +187,9 @@ fi if [ "$ARCH" != "um" ]; then $MAKE headers_check KBUILD_SRC= - $MAKE headers_install KBUILD_SRC= INSTALL_HDR_PATH="$libc_headers_dir/usr" + if [ -z "$KDEB_NO_LIBC_HEADERS" ]; then + $MAKE headers_install KBUILD_SRC= INSTALL_HDR_PATH="$libc_headers_dir/usr" + fi fi # Install the maintainer scripts @@ -324,26 +326,27 @@ EOF fi # Build kernel header package -(cd $srctree; find . -name Makefile\* -o -name Kconfig\* -o -name \*.pl) > "$objtree/debian/hdrsrcfiles" -(cd $srctree; find arch/*/include include scripts -type f) >> "$objtree/debian/hdrsrcfiles" -(cd $srctree; find arch/$SRCARCH -name module.lds -o -name Kbuild.platforms -o -name Platform) >> "$objtree/debian/hdrsrcfiles" -(cd $srctree; find $(find arch/$SRCARCH -name include -o -name scripts -type d) -type f) >> "$objtree/debian/hdrsrcfiles" -if grep -q '^CONFIG_STACK_VALIDATION=y' $KCONFIG_CONFIG ; then - (cd $objtree; find tools/objtool -type f -executable) >> "$objtree/debian/hdrobjfiles" -fi -(cd $objtree; find arch/$SRCARCH/include Module.symvers include scripts -type f) >> "$objtree/debian/hdrobjfiles" -if grep -q '^CONFIG_GCC_PLUGINS=y' $KCONFIG_CONFIG ; then - (cd $objtree; find scripts/gcc-plugins -name \*.so -o -name gcc-common.h) >> "$objtree/debian/hdrobjfiles" -fi -destdir=$kernel_headers_dir/usr/src/linux-headers-$version -mkdir -p "$destdir" -(cd $srctree; tar -c -f - -T -) < "$objtree/debian/hdrsrcfiles" | (cd $destdir; tar -xf -) -(cd $objtree; tar -c -f - -T -) < "$objtree/debian/hdrobjfiles" | (cd $destdir; tar -xf -) -(cd $objtree; cp $KCONFIG_CONFIG $destdir/.config) # copy .config manually to be where it's expected to be -ln -sf "/usr/src/linux-headers-$version" "$kernel_headers_dir/lib/modules/$version/build" -rm -f "$objtree/debian/hdrsrcfiles" "$objtree/debian/hdrobjfiles" +if [ -z "$KDEB_NO_HEADERS" ]; then + (cd $srctree; find . -name Makefile\* -o -name Kconfig\* -o -name \*.pl) > "$objtree/debian/hdrsrcfiles" + (cd $srctree; find arch/*/include include scripts -type f) >> "$objtree/debian/hdrsrcfiles" + (cd $srctree; find arch/$SRCARCH -name module.lds -o -name Kbuild.platforms -o -name Platform) >> "$objtree/debian/hdrsrcfiles" + (cd $srctree; find $(find arch/$SRCARCH -name include -o -name scripts -type d) -type f) >> "$objtree/debian/hdrsrcfiles" + if grep -q '^CONFIG_STACK_VALIDATION=y' $KCONFIG_CONFIG ; then + (cd $objtree; find tools/objtool -type f -executable) >> "$objtree/debian/hdrobjfiles" + fi + (cd $objtree; find arch/$SRCARCH/include Module.symvers include scripts -type f) >> "$objtree/debian/hdrobjfiles" + if grep -q '^CONFIG_GCC_PLUGINS=y' $KCONFIG_CONFIG ; then + (cd $objtree; find scripts/gcc-plugins -name \*.so -o -name gcc-common.h) >> "$objtree/debian/hdrobjfiles" + fi + destdir=$kernel_headers_dir/usr/src/linux-headers-$version + mkdir -p "$destdir" + (cd $srctree; tar -c -f - -T -) < "$objtree/debian/hdrsrcfiles" | (cd $destdir; tar -xf -) + (cd $objtree; tar -c -f - -T -) < "$objtree/debian/hdrobjfiles" | (cd $destdir; tar -xf -) + (cd $objtree; cp $KCONFIG_CONFIG $destdir/.config) # copy .config manually to be where it's expected to be + ln -sf "/usr/src/linux-headers-$version" "$kernel_headers_dir/lib/modules/$version/build" + rm -f "$objtree/debian/hdrsrcfiles" "$objtree/debian/hdrobjfiles" -cat <> debian/control + cat <> debian/control Package: $kernel_headers_packagename Provides: linux-headers, linux-headers-2.6 @@ -353,13 +356,13 @@ Description: Linux kernel headers for $KERNELRELEASE on \${kernel:debarch} . This is useful for people who need to build external modules EOF +fi # 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/firmware/$version/" - rmdir "$tmpdir/lib/firmware" - - cat <> debian/control + if [ -z "$KDEB_NO_FIRMWARE" ]; then + mv "$tmpdir/lib/firmware"/* "$fwdir/lib/firmware/$version/" + cat <> debian/control Package: $fwpackagename Architecture: all @@ -367,10 +370,13 @@ Description: Linux kernel firmware, version $version This package contains firmware from the Linux kernel, version $version. EOF - create_package "$fwpackagename" "$fwdir" + create_package "$fwpackagename" "$fwdir" + fi + rm -r "$tmpdir/lib/firmware" fi -cat <> debian/control +if [ -z "$KDEB_NO_LIBC_HEADERS" ]; then + cat <> debian/control Package: $libc_headers_packagename Section: devel @@ -380,10 +386,15 @@ 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 +fi if [ "$ARCH" != "um" ]; then - create_package "$kernel_headers_packagename" "$kernel_headers_dir" - create_package "$libc_headers_packagename" "$libc_headers_dir" + if [ -z "$KDEB_NO_HEADERS" ]; then + create_package "$kernel_headers_packagename" "$kernel_headers_dir" + fi + if [ -z "$KDEB_NO_LIBC_HEADERS" ]; then + create_package "$libc_headers_packagename" "$libc_headers_dir" + fi fi create_package "$packagename" "$tmpdir"