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

Masahiro Yamada masahiro.yamada at canonical.com
Tue Feb 28 09:49:45 UTC 2023


'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 at canonical.com>
---
 scripts/Makefile.package           | 2 +-
 scripts/package/snapcraft.template | 1 +
 2 files changed, 2 insertions(+), 1 deletion(-)

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:
-- 
2.34.1




More information about the kernel-team mailing list