linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2] scripts/package: snap-pkg target
@ 2017-09-12 10:11 Paolo Pisati
  2017-09-20  9:28 ` Masahiro Yamada
  0 siblings, 1 reply; 3+ messages in thread
From: Paolo Pisati @ 2017-09-12 10:11 UTC (permalink / raw)
  To: Michal Marek, Masahiro Yamada, Vinícius Tinti,
	Behan Webster, Matthias Kaehlcke
  Cc: linux-kbuild, linux-kernel

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 v1:
 - slightly improve the messaging
---
 .gitignore                         |  5 +++++
 scripts/package/Makefile           | 14 ++++++++++++++
 scripts/package/snapcraft.template | 14 ++++++++++++++
 3 files changed, 33 insertions(+)
 create mode 100644 scripts/package/snapcraft.template

diff --git a/.gitignore b/.gitignore
index 0c39aa2..638c492 100644
--- a/.gitignore
+++ b/.gitignore
@@ -59,6 +59,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 71b4a8a..cfa1b2d 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@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
 # ---------------------------------------------------------------------------
@@ -143,6 +156,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..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

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH v2] scripts/package: snap-pkg target
  2017-09-12 10:11 [PATCH v2] scripts/package: snap-pkg target Paolo Pisati
@ 2017-09-20  9:28 ` Masahiro Yamada
  2017-11-27 10:46   ` Paolo Pisati
  0 siblings, 1 reply; 3+ messages in thread
From: Masahiro Yamada @ 2017-09-20  9:28 UTC (permalink / raw)
  To: Paolo Pisati
  Cc: Michal Marek, Vinícius Tinti, Behan Webster,
	Matthias Kaehlcke, Linux Kbuild mailing list,
	Linux Kernel Mailing List

Hi Paolo,


2017-09-12 19:11 GMT+09:00 Paolo Pisati <paolo.pisati@canonical.com>:

> @@ -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


Other targets such as rpm-pkg and deb-pkg
work without relying on git.

However, snap-pkg every time does "git clone", so
changes added to the source tree, but not committed yet,
are not reflected to the package.

Is it possible to work with a tarball,
like other targets do?




-- 
Best Regards
Masahiro Yamada

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH v2] scripts/package: snap-pkg target
  2017-09-20  9:28 ` Masahiro Yamada
@ 2017-11-27 10:46   ` Paolo Pisati
  0 siblings, 0 replies; 3+ messages in thread
From: Paolo Pisati @ 2017-11-27 10:46 UTC (permalink / raw)
  To: Masahiro Yamada
  Cc: Michal Marek, Vinícius Tinti, Behan Webster,
	Matthias Kaehlcke, Linux Kbuild mailing list,
	Linux Kernel Mailing List

On Wed, Sep 20, 2017 at 11:28 AM, Masahiro Yamada
<yamada.masahiro@socionext.com> wrote:
>> @@ -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
>
>
> Other targets such as rpm-pkg and deb-pkg
> work without relying on git.
>
> However, snap-pkg every time does "git clone", so
> changes added to the source tree, but not committed yet,
> are not reflected to the package.
>
> Is it possible to work with a tarball,
> like other targets do?

Thanks for your feedback Yamada-san.

Yes, switching to a tarball is doable and i'll send a v3 with that change.
-- 
bye,
p.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2017-11-27 11:01 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-09-12 10:11 [PATCH v2] scripts/package: snap-pkg target Paolo Pisati
2017-09-20  9:28 ` Masahiro Yamada
2017-11-27 10:46   ` Paolo Pisati

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).