linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] kbuild: Add an "imgdeb-pkg" target to build only linux-image
@ 2020-03-12  5:50 Josh Triplett
  0 siblings, 0 replies; only message in thread
From: Josh Triplett @ 2020-03-12  5:50 UTC (permalink / raw)
  To: Masahiro Yamada, Michal Marek; +Cc: linux-kbuild, linux-kernel

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

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2020-03-12  5:50 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-03-12  5:50 [PATCH] kbuild: Add an "imgdeb-pkg" target to build only linux-image Josh Triplett

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).