linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Paolo Pisati <paolo.pisati@canonical.com>
To: "Masahiro Yamada" <yamada.masahiro@socionext.com>,
	"Michal Marek" <michal.lkml@markovi.net>,
	"Behan Webster" <behanw@converseincode.com>,
	"Matthias Kaehlcke" <mka@chromium.org>,
	"Vinícius Tinti" <viniciustinti@gmail.com>,
	linux-kbuild@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH v3] scripts/package: snap-pkg target
Date: Mon, 27 Nov 2017 12:07:34 +0100	[thread overview]
Message-ID: <1511780854-7213-1-git-send-email-paolo.pisati@canonical.com> (raw)
In-Reply-To: <20171114123834.xsjiy2ynvott4gae@brain>

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>
---
Changes since v2:
 - use a tarball to instead of cloning the src tree via git
 - set 'kernel-with-firmware: false' to accomodate for
   'firmware_install' removal

Changes since v1:
 - slightly improve the messaging
---
 .gitignore                         |  5 +++++
 scripts/package/Makefile           | 16 ++++++++++++++++
 scripts/package/snapcraft.template | 14 ++++++++++++++
 3 files changed, 35 insertions(+)
 create mode 100644 scripts/package/snapcraft.template

diff --git a/.gitignore b/.gitignore
index f6050b8..705e099 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 9ed96aef..5996300 100644
--- a/scripts/package/Makefile
+++ b/scripts/package/Makefile
@@ -95,6 +95,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
 # ---------------------------------------------------------------------------
@@ -139,6 +154,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 0000000..626d278e
--- /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
-- 
2.7.4

       reply	other threads:[~2017-11-27 11:07 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20171114123834.xsjiy2ynvott4gae@brain>
2017-11-27 11:07 ` Paolo Pisati [this message]
2017-11-27 18:33   ` [PATCH v3] scripts/package: snap-pkg target Jim Davis
2017-11-28 17:14     ` Paolo Pisati
2017-11-28 19:35       ` Jim Davis
2017-11-29  7:33         ` Masahiro Yamada
2017-11-29 17:05           ` Paolo Pisati
2017-11-30 23:15             ` Jim Davis
2017-12-05 11:43               ` Paolo Pisati
2017-12-05 21:23                 ` Jim Davis
2017-12-06 10:36                   ` Masahiro Yamada
2017-12-06 18:14                     ` Paolo Pisati
2017-12-07 15:31                       ` Masahiro Yamada
2017-12-12 15:08                         ` Masahiro Yamada
2017-12-01 12:03             ` Riku Voipio
2017-12-05 11:31               ` Paolo Pisati
2017-11-29 17:03         ` Paolo Pisati

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1511780854-7213-1-git-send-email-paolo.pisati@canonical.com \
    --to=paolo.pisati@canonical.com \
    --cc=behanw@converseincode.com \
    --cc=linux-kbuild@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=michal.lkml@markovi.net \
    --cc=mka@chromium.org \
    --cc=viniciustinti@gmail.com \
    --cc=yamada.masahiro@socionext.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).