]> git.proxmox.com Git - mirror_ubuntu-artful-kernel.git/commitdiff
make snap-pkg support
authorPaolo Pisati <paolo.pisati@canonical.com>
Tue, 27 Jun 2017 11:13:05 +0000 (13:13 +0200)
committerSeth Forshee <seth.forshee@canonical.com>
Tue, 5 Sep 2017 12:33:55 +0000 (07:33 -0500)
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@canonical.com>
Acked-by: Stefan Bader <stefan.bader@canonical.com>
Acked-by: Thadeu Lima de Souza Cascardo <cascardo@canonical.com>
Signed-off-by: Seth Forshee <seth.forshee@canonical.com>
.gitignore
scripts/package/Makefile
scripts/package/snapcraft.template [new file with mode: 0644]

index 126a04a5e1c0b4c168f4b0be4950df641e0db111..df207659bafa1f68030c5810b86482f98c3da4b4 100644 (file)
@@ -58,6 +58,11 @@ Module.symvers
 #
 #/debian/
 
+#
+# Snap directory (make snap-pkg)
+#
+/snap/
+
 #
 # tar directory (make tar*-pkg)
 #
index 71b4a8af9d4dcdf1dcec434b6be98636f468b2dd..491134e94161efe613d088ecc8e3a9bc72dad943 100644 (file)
@@ -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@KERNELRELEASE@$(KERNELRELEASE)@; \
+               s@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 (file)
index 0000000..2e7ffc8
--- /dev/null
@@ -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