diff mbox

make snap-pkg support

Message ID 1498561985-10413-2-git-send-email-paolo.pisati@canonical.com
State New
Headers show

Commit Message

Paolo Pisati June 27, 2017, 11:13 a.m. UTC
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>
---
 .gitignore                         |  5 +++++
 scripts/package/Makefile           | 13 +++++++++++++
 scripts/package/snapcraft.template | 14 ++++++++++++++
 3 files changed, 32 insertions(+)
 create mode 100644 scripts/package/snapcraft.template

Comments

Stefan Bader July 10, 2017, 9:54 a.m. UTC | #1
On 27.06.2017 13:13, Paolo Pisati wrote:
> 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>

> ---
>  .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@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
> 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
>
Thadeu Lima de Souza Cascardo July 11, 2017, 2:51 p.m. UTC | #2
On Tue, Jun 27, 2017 at 01:13:05PM +0200, Paolo Pisati wrote:
> 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

Should be a UBUNTU SAUCE patch. Besides that,

Acked-by: Thadeu Lima de Souza Cascardo <cascardo@canonical.com>

> 
> Signed-off-by: Paolo Pisati <paolo.pisati@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@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
> 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
> 
> 
> -- 
> kernel-team mailing list
> kernel-team@lists.ubuntu.com
> https://lists.ubuntu.com/mailman/listinfo/kernel-team
diff mbox

Patch

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