-
Notifications
You must be signed in to change notification settings - Fork 29
reference: development: the-kernel-snap: extend information #281
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
dilyn-corner
wants to merge
5
commits into
canonical:main
Choose a base branch
from
dilyn-corner:kernel-update
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
1876c1d
reference: development: the-kernel-snap: extend information
dilyn-corner 70fee7a
reference: development: the-gadget-snap: fixup ref links
dilyn-corner 7978c50
reference: development: the-kernel-snap: feedback
dilyn-corner c12945d
reference: development: the-kernel-snap: TODO on initrd section
dilyn-corner e8cde22
reference: development: the-kernel-snap: replace "referenceable"
dilyn-corner File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
78 changes: 70 additions & 8 deletions
78
docs/reference/development/yaml-schemas/the-kernel-snap.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,22 +1,84 @@ | ||
| (reference-development-yaml-schemas-the-kernel-snap)= | ||
| # 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. | ||
| The kernel snap is responsible for providing the Linux kernel image and modules | ||
| for the system. The kernel snap to be used is defined in the device's model | ||
| assertion, which is produced and signed by the Brand authority. | ||
|
|
||
| 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. | ||
| 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. | ||
|
|
||
| For details on building a kernel snap, see [Build a kernel snap](https://documentation.ubuntu.com/core/how-to-guides/image-creation/build-a-kernel-snap/) | ||
| in the Ubuntu Core documentation. | ||
|
|
||
| ## 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. | ||
| 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: | ||
| The layout for a kernel snap has some variation, but usually follows: | ||
|
|
||
| - `meta/snap.yaml` - Traditional snap details, with `type: kernel` explicitly defined | ||
| - `kernel.img` - The actual kernel image | ||
| - `initrd.img` - The respective initrd image | ||
| - `meta/kernel.yaml` - Optional kernel-specific metadata defining kernel-provided assets | ||
| - `snapd-info` - Information about the snapd packaged in the initrd | ||
| - `modules/<version>/` - Kernel modules; version must match the one in `snap.yaml` | ||
| - `firmware/` - Optional firmware files. | ||
| - `firmware/` - Optional firmware files | ||
| - `dtbs/` - Optional binary device-tree files, if gadget.yaml states `device-tree-origin: kernel` | ||
| - kernel - The actual kernel image | ||
| - initrd - The initrd image | ||
|
|
||
| The kernel and initrd may be discrete objects, usually named `kernel.img` and | ||
| `initrd.img`, respectively. However, they could also be distributed as a single [Unified Kernel Image](https://uapi-group.org/specifications/specs/unified_kernel_image/) | ||
| (UKI) or as a [Flatted Image Tree](https://fitspec.osfw.foundation/) (FIT) image. | ||
| These are usually named `kernel.efi` or `kernel.img`, respectively. | ||
|
|
||
| ### kernel.yaml | ||
|
|
||
| The `kernel.yaml` provides information used by snapd to determine | ||
| kernel-specific asset information. Primarily, this is about device trees and | ||
| kernel modules. The standard format is: | ||
|
|
||
| ```yaml | ||
| dynamic-modules: $SNAP_DATA | ||
| assets: | ||
| dtbs: | ||
| update: true | ||
| content: | ||
| - dtbs/ | ||
| ``` | ||
|
|
||
| * `dynamic-modules` points to a folder which contains `modules/` and `firmware/` | ||
| directories, usually created by a kernel component. | ||
|
|
||
| * `assets` details a list of content the kernel snap provides, usually device | ||
| tree files, to the gadget snap. These are then citable in the gadget snap's | ||
| `gadget.yaml` like so: | ||
|
|
||
| ```yaml | ||
| volumes: | ||
| platform: | ||
| schema: gpt | ||
| bootloader: grub | ||
| structure: | ||
| - name: ubuntu-seed | ||
| role: system-seed | ||
| filesystem: vfat | ||
| type: C12A7328-F81F-11D2-BA4B-00A0C93EC93B | ||
| size: 800M | ||
| offset: 8M | ||
| content: | ||
| - source: $kernel:dtbs/dtbs/ | ||
| target: /dtbs/ | ||
| ``` | ||
|
|
||
| <!-- | ||
| TODO -- document the initrd more thoroughly | ||
| ## initrd | ||
|
|
||
| Sample configuration files may be found in the reference gadget snaps. For further details, see [Build a kernel snap](https://documentation.ubuntu.com/core/how-to-guides/image-creation/build-a-kernel-snap/) in the Ubuntu Core documentation. | ||
| The initrd component of the kernel snap plays a fundamental role in the booting | ||
| of an Ubuntu Core system. | ||
|
|
||
| The initrd is usually built using the ubuntu-core-initramfs tool. | ||
|
dilyn-corner marked this conversation as resolved.
|
||
| --> | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.