linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Josh Triplett <josh@joshtriplett.org>
To: Masahiro Yamada <masahiroy@kernel.org>,
	Michal Marek <michal.lkml@markovi.net>
Cc: linux-kbuild@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH] kbuild: Add an "imgdeb-pkg" target to build only linux-image
Date: Thu, 12 Mar 2020 06:50:53 +0100	[thread overview]
Message-ID: <b45738b05bb396e175a36f67b02fa01de4c7472f.1583912084.git.josh@joshtriplett.org> (raw)

This skips building the linux-headers and linux-libc-dev packages, which
take much longer to build, and which aren't needed for many common test
scenarios.

Signed-off-by: Josh Triplett <josh@joshtriplett.org>
---
 scripts/Makefile.package |  5 +++++
 scripts/package/builddeb |  2 +-
 scripts/package/mkdebian | 33 +++++++++++++++++++++++----------
 3 files changed, 29 insertions(+), 11 deletions(-)

diff --git a/scripts/Makefile.package b/scripts/Makefile.package
index 02135d2671a6..efc2f2f69bc1 100644
--- a/scripts/Makefile.package
+++ b/scripts/Makefile.package
@@ -82,6 +82,11 @@ bindeb-pkg:
 	$(CONFIG_SHELL) $(srctree)/scripts/package/mkdebian
 	+dpkg-buildpackage -r$(KBUILD_PKG_ROOTCMD) -a$$(cat debian/arch) $(DPKG_FLAGS) -b -nc -uc
 
+PHONY += imgdeb-pkg
+imgdeb-pkg:
+	DEBIAN_IMAGE_ONLY=1 $(CONFIG_SHELL) $(srctree)/scripts/package/mkdebian
+	+dpkg-buildpackage -r$(KBUILD_PKG_ROOTCMD) -a$$(cat debian/arch) $(DPKG_FLAGS) -b -nc -uc
+
 PHONY += intdeb-pkg
 intdeb-pkg:
 	+$(CONFIG_SHELL) $(srctree)/scripts/package/builddeb
diff --git a/scripts/package/builddeb b/scripts/package/builddeb
index 6df3c9f8b2da..c7615a35f34f 100755
--- a/scripts/package/builddeb
+++ b/scripts/package/builddeb
@@ -201,7 +201,7 @@ EOF
 	chmod 755 "$tmpdir/DEBIAN/$script"
 done
 
-if [ "$ARCH" != "um" ]; then
+if [ "$ARCH" != "um" ] && [ -z "$DEBIAN_IMAGE_ONLY" ]; then
 	deploy_kernel_headers debian/linux-headers
 	create_package linux-headers-$version debian/linux-headers
 
diff --git a/scripts/package/mkdebian b/scripts/package/mkdebian
index 357dc56bcf30..9969855d2eb8 100755
--- a/scripts/package/mkdebian
+++ b/scripts/package/mkdebian
@@ -169,7 +169,8 @@ License version 2 can be found in \`/usr/share/common-licenses/GPL-2'.
 EOF
 
 # Generate a control file
-cat <<EOF > debian/control
+{
+	cat <<EOF
 Source: $sourcename
 Section: kernel
 Priority: optional
@@ -183,6 +184,17 @@ Description: Linux kernel, version $version
  This package contains the Linux kernel, modules and corresponding other
  files, version: $version.
 
+Package: $dbg_packagename
+Section: debug
+Architecture: $debarch
+Description: Linux kernel debugging symbols for $version
+ This package will come in handy if you need to debug the kernel. It provides
+ all the necessary debug symbols for the kernel and its modules.
+EOF
+
+	if [ -z "$DEBIAN_IMAGE_ONLY" ]; then
+		cat <<EOF
+
 Package: $kernel_headers_packagename
 Architecture: $debarch
 Description: Linux kernel headers for $version on $debarch
@@ -198,14 +210,13 @@ 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.
 Multi-Arch: same
-
-Package: $dbg_packagename
-Section: debug
-Architecture: $debarch
-Description: Linux kernel debugging symbols for $version
- This package will come in handy if you need to debug the kernel. It provides
- all the necessary debug symbols for the kernel and its modules.
 EOF
+	fi
+} > debian/control
+
+if [ -n "$DEBIAN_IMAGE_ONLY" ]; then
+	DEBIAN_IMAGE_ONLY_ENV="DEBIAN_IMAGE_ONLY=1"
+fi
 
 cat <<EOF > debian/rules
 #!$(command -v $MAKE) -f
@@ -214,11 +225,13 @@ srctree ?= .
 
 build:
 	\$(MAKE) KERNELRELEASE=${version} ARCH=${ARCH} \
-	KBUILD_BUILD_VERSION=${revision} -f \$(srctree)/Makefile
+	KBUILD_BUILD_VERSION=${revision} ${DEBIAN_IMAGE_ONLY_ENV} \
+	-f \$(srctree)/Makefile
 
 binary-arch:
 	\$(MAKE) KERNELRELEASE=${version} ARCH=${ARCH} \
-	KBUILD_BUILD_VERSION=${revision} -f \$(srctree)/Makefile intdeb-pkg
+	KBUILD_BUILD_VERSION=${revision} ${DEBIAN_IMAGE_ONLY_ENV} \
+	-f \$(srctree)/Makefile intdeb-pkg
 
 clean:
 	rm -rf debian/*tmp debian/files
-- 
2.25.1

                 reply	other threads:[~2020-03-12  5:50 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=b45738b05bb396e175a36f67b02fa01de4c7472f.1583912084.git.josh@joshtriplett.org \
    --to=josh@joshtriplett.org \
    --cc=linux-kbuild@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=masahiroy@kernel.org \
    --cc=michal.lkml@markovi.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).