Skip to content

Commit

Permalink
scripts/package: snap-pkg target
Browse files Browse the repository at this point in the history
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 <[email protected]>
Signed-off-by: Masahiro Yamada <[email protected]>
  • Loading branch information
piso77 authored and masahir0y committed Dec 12, 2017
1 parent ae64f9b commit 5704d45
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,11 @@ modules.builtin
#
/debian/

#
# Snap directory (make snap-pkg)
#
/snap/

#
# tar directory (make tar*-pkg)
#
Expand Down
16 changes: 16 additions & 0 deletions scripts/package/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,21 @@ bindeb-pkg: FORCE

clean-dirs += $(objtree)/debian/

# snap-pkg
# ---------------------------------------------------------------------------
snap-pkg: FORCE
rm -rf $(objtree)/snap
mkdir $(objtree)/snap
$(MAKE) clean
$(call cmd,src_tar,$(KERNELPATH))
sed "s@KERNELRELEASE@$(KERNELRELEASE)@; \
s@SRCTREE@$(shell realpath $(KERNELPATH).tar.gz)@" \
$(srctree)/scripts/package/snapcraft.template > \
$(objtree)/snap/snapcraft.yaml
cd $(objtree)/snap && \
snapcraft --target-arch=$(UTS_MACHINE)

clean-dirs += $(objtree)/snap/

# tarball targets
# ---------------------------------------------------------------------------
Expand Down Expand Up @@ -138,6 +153,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'
Expand Down
14 changes: 14 additions & 0 deletions scripts/package/snapcraft.template
Original file line number Diff line number Diff line change
@@ -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: tar
kernel-with-firmware: false

0 comments on commit 5704d45

Please sign in to comment.