summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaolo Pisati <paolo.pisati@canonical.com>2017-11-27 12:07:34 +0100
committerMasahiro Yamada <yamada.masahiro@socionext.com>2017-12-13 00:00:18 +0900
commit5704d4557f279962a1fa9ee9c5b562eb27376103 (patch)
treed54426acf7e60e5911b9fade9e9b153fd904e688
parentae64f9bd1d3621b5e60d7363bc20afb46aede215 (diff)
downloadlwn-5704d4557f279962a1fa9ee9c5b562eb27376103.tar.gz
lwn-5704d4557f279962a1fa9ee9c5b562eb27376103.zip
scripts/package: snap-pkg target
Following in footsteps of other targets like 'deb-pkg, 'rpm-pkg' and 'tar-pkg', this patch adds a 'snap-pkg' target for the creation of a Linux kernel snap package using the kbuild infrastructure. A snap, in its general form, is a self contained, sandboxed, universal package and it is intended to work across multiple distributions and/or devices. A snap package is distributed as a single compressed squashfs filesystem. A kernel snap is a snap package carrying the Linux kernel, kernel modules, accessory files (DTBs, System.map, etc) and a manifesto file. The purpose of a kernel snap is to carry the Linux kernel during the creation of a system image, eg. Ubuntu Core, and its subsequent upgrades. For more information on snap packages: https://snapcraft.io/docs/ Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com> Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
-rw-r--r--.gitignore5
-rw-r--r--scripts/package/Makefile16
-rw-r--r--scripts/package/snapcraft.template14
3 files changed, 35 insertions, 0 deletions
diff --git a/.gitignore b/.gitignore
index f6050b88e95b..705e09913dc2 100644
--- a/.gitignore
+++ b/.gitignore
@@ -66,6 +66,11 @@ modules.builtin
/debian/
#
+# Snap directory (make snap-pkg)
+#
+/snap/
+
+#
# tar directory (make tar*-pkg)
#
/tar-install/
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