diff mbox series

[RFC/upstream:linux,1/5] kbuild: snap-pkg: make it work on Ubuntu 20.04 or later

Message ID 20230228094949.2660702-2-masahiro.yamada@canonical.com
State New
Headers show
Series kbuild: snap-pkg: make 'make snap-pkg' comple on Ubuntu 20.04 | expand

Commit Message

Masahiro Yamada Feb. 28, 2023, 9:49 a.m. UTC
'make snap-pkg' works on Ubuntu 18.04, but not on 20.04 or later.

Add 'build-base' to meet the current requirement. As documented in the
snapcraft document [1], the kernel plugin is only available on core
and core18 based snaps. Specify 'build-base: core18' to use the kbuild
plugin.

Another change in snapcraft is that it tries to build the snap in a
multipass VM by default, then it fails to find the source tar in the
host file system. Pass SNAPCRAFT_BUILD_ENVIRONMENT=host to build it in
the destructive mode.

[1]: https://snapcraft.io/docs/kernel-plugin

Signed-off-by: Masahiro Yamada <masahiro.yamada@canonical.com>
---
 scripts/Makefile.package           | 2 +-
 scripts/package/snapcraft.template | 1 +
 2 files changed, 2 insertions(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/scripts/Makefile.package b/scripts/Makefile.package
index b941e6341b36..3058d0cdb578 100644
--- a/scripts/Makefile.package
+++ b/scripts/Makefile.package
@@ -143,7 +143,7 @@  snap-pkg:
 		$(srctree)/scripts/package/snapcraft.template > \
 		$(objtree)/snap/snapcraft.yaml
 	cd $(objtree)/snap && \
-	snapcraft --target-arch=$(UTS_MACHINE)
+	SNAPCRAFT_BUILD_ENVIRONMENT=host snapcraft --target-arch=$(UTS_MACHINE)
 
 # dir-pkg tar*-pkg - tarball targets
 # ---------------------------------------------------------------------------
diff --git a/scripts/package/snapcraft.template b/scripts/package/snapcraft.template
index 626d278e4a5a..9835bf4c3194 100644
--- a/scripts/package/snapcraft.template
+++ b/scripts/package/snapcraft.template
@@ -5,6 +5,7 @@  description: The upstream Linux kernel
 grade: stable
 confinement: strict
 type: kernel
+build-base: core18
 
 parts:
   kernel: