[PATCH] make snap-pkg support
Paolo Pisati
paolo.pisati at canonical.com
Tue Jun 27 11:13:05 UTC 2017
BugLink: http://bugs.launchpad.net/bugs/1700747
This patch integrates snapcraft in the kbuild environment of the Linux kernel.
To use it:
make defconfig
make snap-pkg
or in case of cross-compilation (e.g. arm):
export ARCH=arm; export CROSS_COMPILE=arm-linux-gnueabihf-
make defconfig
make snap-pkg
The resulting kernel snap will be generated in $(objtree)/snap
Signed-off-by: Paolo Pisati <paolo.pisati at canonical.com>
---
.gitignore | 5 +++++
scripts/package/Makefile | 13 +++++++++++++
scripts/package/snapcraft.template | 14 ++++++++++++++
3 files changed, 32 insertions(+)
create mode 100644 scripts/package/snapcraft.template
diff --git a/.gitignore b/.gitignore
index e78c8c2..efdd5ab 100644
--- a/.gitignore
+++ b/.gitignore
@@ -57,6 +57,11 @@ Module.symvers
#/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 493e226..3b08e1b 100644
--- a/scripts/package/Makefile
+++ b/scripts/package/Makefile
@@ -99,6 +99,19 @@ bindeb-pkg: FORCE
clean-dirs += $(objtree)/debian/
+# snap-pkg
+# ---------------------------------------------------------------------------
+snap-pkg: FORCE
+ rm -rf $(objtree)/snap
+ mkdir $(objtree)/snap
+ sed "s at KERNELRELEASE@$(KERNELRELEASE)@; \
+ s at SRCTREE@$(shell realpath $(srctree))@" \
+ $(srctree)/scripts/package/snapcraft.template > \
+ $(objtree)/snap/snapcraft.yaml
+ cd $(objtree)/snap && \
+ snapcraft --target-arch=$(UTS_MACHINE)
+
+clean-dirs += $(objtree)/snap/
# tarball targets
# ---------------------------------------------------------------------------
diff --git a/scripts/package/snapcraft.template b/scripts/package/snapcraft.template
new file mode 100644
index 0000000..2e7ffc8
--- /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: git
+ kconfigfile: SRCTREE/.config
--
2.7.4
More information about the kernel-team
mailing list