summaryrefslogtreecommitdiffstats
path: root/scripts/package/Makefile
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2018-02-01 11:43:45 -0800
committerLinus Torvalds <torvalds@linux-foundation.org>2018-02-01 11:43:45 -0800
commita659f1598585071eed5c39485840b0f018c9f457 (patch)
tree9d785768a926c3dc2b42944b5851620684e00dba /scripts/package/Makefile
parent06c8f7a7501ab3ae338a98ff8515b9f03160bea6 (diff)
parent1640eea35e8dcf0cb437f03c56868a97d0666df3 (diff)
downloadlinux-stable-a659f1598585071eed5c39485840b0f018c9f457.tar.gz
linux-stable-a659f1598585071eed5c39485840b0f018c9f457.tar.bz2
linux-stable-a659f1598585071eed5c39485840b0f018c9f457.zip
Merge tag 'kbuild-misc-v4.16' of git://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuild
Pull Kbuild misc updates from Masahiro Yamada: - add snap-pkg target to create Linux kernel snap package - make out-of-tree creation of source packages fail correctly - improve and fix several semantic patches * tag 'kbuild-misc-v4.16' of git://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuild: Coccinelle: coccicheck: fix typo Coccinelle: memdup: drop spurious line Coccinelle: kzalloc-simple: Rename kzalloc-simple to zalloc-simple Coccinelle: ifnullfree: Trim the warning reported in report mode Coccinelle: alloc_cast: Add more memory allocating functions to the list Coccinelle: array_size: report even if include is missing Coccinelle: kzalloc-simple: Add all zero allocating functions kbuild: pkg: make out-of-tree rpm/deb-pkg build immediately fail scripts/package: snap-pkg target
Diffstat (limited to 'scripts/package/Makefile')
-rw-r--r--scripts/package/Makefile26
1 files changed, 23 insertions, 3 deletions
diff --git a/scripts/package/Makefile b/scripts/package/Makefile
index c23534925b38..9fbcf5ed0ca7 100644
--- a/scripts/package/Makefile
+++ b/scripts/package/Makefile
@@ -32,10 +32,14 @@ MKSPEC := $(srctree)/scripts/package/mkspec
quiet_cmd_src_tar = TAR $(2).tar.gz
cmd_src_tar = \
+set -e; \
if test "$(objtree)" != "$(srctree)"; then \
- echo "Building source tarball is not possible outside the"; \
- echo "kernel source tree. Don't set KBUILD_OUTPUT, or use the"; \
- echo "binrpm-pkg or bindeb-pkg target instead."; \
+ echo >&2; \
+ echo >&2 " ERROR:"; \
+ echo >&2 " Building source tarball is not possible outside the"; \
+ echo >&2 " kernel source tree. Don't set KBUILD_OUTPUT, or use the"; \
+ echo >&2 " binrpm-pkg or bindeb-pkg target instead."; \
+ echo >&2; \
false; \
fi ; \
$(srctree)/scripts/setlocalversion --save-scmversion; \
@@ -94,6 +98,21 @@ bindeb-pkg: FORCE
clean-dirs += $(objtree)/debian/
+# snap-pkg
+# ---------------------------------------------------------------------------
+snap-pkg: FORCE
+ rm -rf $(objtree)/snap
+ mkdir $(objtree)/snap
+ $(MAKE) clean
+ $(call cmd,src_tar,$(KERNELPATH))
+ sed "s@KERNELRELEASE@$(KERNELRELEASE)@; \
+ s@SRCTREE@$(shell realpath $(KERNELPATH).tar.gz)@" \
+ $(srctree)/scripts/package/snapcraft.template > \
+ $(objtree)/snap/snapcraft.yaml
+ cd $(objtree)/snap && \
+ snapcraft --target-arch=$(UTS_MACHINE)
+
+clean-dirs += $(objtree)/snap/
# tarball targets
# ---------------------------------------------------------------------------
@@ -138,6 +157,7 @@ help: FORCE
@echo ' binrpm-pkg - Build only the binary kernel RPM package'
@echo ' deb-pkg - Build both source and binary deb kernel packages'
@echo ' bindeb-pkg - Build only the binary kernel deb package'
+ @echo ' snap-pkg - Build only the binary kernel snap package (will connect to external hosts)'
@echo ' tar-pkg - Build the kernel as an uncompressed tarball'
@echo ' targz-pkg - Build the kernel as a gzip compressed tarball'
@echo ' tarbz2-pkg - Build the kernel as a bzip2 compressed tarball'