diff --git a/.gitignore b/.gitignore index f6050b88e95b..705e09913dc2 100644 --- a/.gitignore +++ b/.gitignore @@ -65,6 +65,11 @@ modules.builtin # /debian/ +# +# Snap directory (make snap-pkg) +# +/snap/ + # # tar directory (make tar*-pkg) # diff --git a/scripts/package/Makefile b/scripts/package/Makefile index c23534925b38..61e29da374cc 100644 --- a/scripts/package/Makefile +++ b/scripts/package/Makefile @@ -94,6 +94,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 +153,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' diff --git a/scripts/package/snapcraft.template b/scripts/package/snapcraft.template new file mode 100644 index 000000000000..626d278e4a5a --- /dev/null +++ b/scripts/package/snapcraft.template @@ -0,0 +1,14 @@ +name: kernel +version: KERNELRELEASE +summary: Linux kernel +description: The upstream Linux kernel +grade: stable +confinement: strict +type: kernel + +parts: + kernel: + plugin: kernel + source: SRCTREE + source-type: tar + kernel-with-firmware: false