Skip to content

Commit 5704d45

Browse files
piso77masahir0y
authored andcommitted
scripts/package: snap-pkg target
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]>
1 parent ae64f9b commit 5704d45

File tree

3 files changed

+35
-0
lines changed

3 files changed

+35
-0
lines changed

.gitignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,11 @@ modules.builtin
6565
#
6666
/debian/
6767

68+
#
69+
# Snap directory (make snap-pkg)
70+
#
71+
/snap/
72+
6873
#
6974
# tar directory (make tar*-pkg)
7075
#

scripts/package/Makefile

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,21 @@ bindeb-pkg: FORCE
9494

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

97+
# snap-pkg
98+
# ---------------------------------------------------------------------------
99+
snap-pkg: FORCE
100+
rm -rf $(objtree)/snap
101+
mkdir $(objtree)/snap
102+
$(MAKE) clean
103+
$(call cmd,src_tar,$(KERNELPATH))
104+
sed "s@KERNELRELEASE@$(KERNELRELEASE)@; \
105+
s@SRCTREE@$(shell realpath $(KERNELPATH).tar.gz)@" \
106+
$(srctree)/scripts/package/snapcraft.template > \
107+
$(objtree)/snap/snapcraft.yaml
108+
cd $(objtree)/snap && \
109+
snapcraft --target-arch=$(UTS_MACHINE)
110+
111+
clean-dirs += $(objtree)/snap/
97112

98113
# tarball targets
99114
# ---------------------------------------------------------------------------
@@ -138,6 +153,7 @@ help: FORCE
138153
@echo ' binrpm-pkg - Build only the binary kernel RPM package'
139154
@echo ' deb-pkg - Build both source and binary deb kernel packages'
140155
@echo ' bindeb-pkg - Build only the binary kernel deb package'
156+
@echo ' snap-pkg - Build only the binary kernel snap package (will connect to external hosts)'
141157
@echo ' tar-pkg - Build the kernel as an uncompressed tarball'
142158
@echo ' targz-pkg - Build the kernel as a gzip compressed tarball'
143159
@echo ' tarbz2-pkg - Build the kernel as a bzip2 compressed tarball'

scripts/package/snapcraft.template

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
name: kernel
2+
version: KERNELRELEASE
3+
summary: Linux kernel
4+
description: The upstream Linux kernel
5+
grade: stable
6+
confinement: strict
7+
type: kernel
8+
9+
parts:
10+
kernel:
11+
plugin: kernel
12+
source: SRCTREE
13+
source-type: tar
14+
kernel-with-firmware: false

0 commit comments

Comments
 (0)