@@ -136,12 +136,10 @@ PHONY += snap-pkg
snap-pkg:
rm -rf $(objtree)/snap
mkdir $(objtree)/snap
- $(MAKE) clean
- $(call cmd,src_tar,$(KERNELPATH))
- sed "s@KERNELRELEASE@$$(echo $(KERNELRELEASE) | cut -b -32)@; \
- s@SRCTREE@$(shell realpath $(KERNELPATH).tar.gz)@" \
+ sed "s@KERNELRELEASE@$$(echo $(KERNELRELEASE) | cut -b -32)@" \
$(srctree)/scripts/package/snapcraft.template > \
$(objtree)/snap/snapcraft.yaml
+ mkdir -p snap/dummy
cd $(objtree)/snap && \
SNAPCRAFT_BUILD_ENVIRONMENT=host snapcraft --target-arch=$(UTS_MACHINE)
@@ -10,6 +10,13 @@ build-base: core18
parts:
kernel:
plugin: kernel
- source: SRCTREE
- source-type: tar
+ source: dummy
+ source-type: local
kernel-with-firmware: false
+ override-build: |
+ # build in-place
+ cd ..
+ rm -rf build
+ ln -s ../../.. build
+ cd build
+ snapcraftctl build
Currently, the source tree is passed as a tarball, but it is very slow, and there is no reason to do so. Use the local source-type to skip the tarball creation. The kernel is built in snap/parts/kerenl/build, which does not reuse the objects in the tree. Make parts/kernel/build a symlink to the top of objtree. This is a trick to build in-place. There is no need to replicate the entire tree to parts/kernel/src since we build the kernel in-place. Just let it copy an empty directory. Signed-off-by: Masahiro Yamada <masahiro.yamada@canonical.com> --- scripts/Makefile.package | 6 ++---- scripts/package/snapcraft.template | 11 +++++++++-- 2 files changed, 11 insertions(+), 6 deletions(-)