The kernel snap

As the name implies, the kernel snap is responsible for defining the Linux kernel that will run in a snap-based system. The correct kernel snap for a given system is selected via the model assertion, produced and signed by the device’s brand account before the image is built. Once the image is built, the kernel snap may be updated, but it cannot be replaced by a completely different kernel snap.

Canonical publishes some reference kernel snaps as well as kernel snaps for main Canonical models such as official Ubuntu Core VMs on various certified public clouds, as well as general purpose computing images for popular physical devices such as the 64-bit x86 PC and Raspberry Pi 2 and 3.

Setup files

In addition to traditional snap metadata, the kernel snap also holds some setup files fundamental to the initialization and lifecycle of the device.

The current layout for a kernel snap is straightforward:

  • meta/snap.yaml - Traditional snap details, with type: kernel explicitly defined
  • kernel.img - The actual kernel image
  • initrd.img - The respective initrd image
  • modules/<version>/ - Kernel modules; version must match the one in snap.yaml
  • firmware/ - Optional firmware files.
  • dtbs/ - Optional binary device-tree files, if gadget.yaml states device-tree-origin: kernel

Sample configuration files may be found in the reference gadget snaps.

2 Likes

Content moved out of the wiki.

@mvo you recently had a PR for Snapcraft to support kernel.yaml but I do not see it documented here nor anywhere else nor what contents it is supposed to have. Can that be added? Maybe @degville?

I’ve spoken to @mvo about this and we’ll make sure it’s documented. The final iteration of the spec has just been completed.

1 Like

Exciting work - I’m looking forward to trying this out.

It still isn’t documented and I had to use this last week! This page is also out of date considering we ship kernel.efi now in many kernels…