← Back to issue list

feat: kernel|initrd plugins: extend and improve behavior

View original Github issue

Metadata

Project
snapcraft
Number
#6116
Type
pull request
State
merged
Author
dilyn-corner
Labels
—
Created
Updated
Closed

Current evaluation

Merged via #6255 (6598b614e), expanding kernel/initrd plugin behavior and options; the feature branch then reached main through #6284 (ceace05f3).

Resolution: closed resolved

Reason: PR #6116 was merged through feature-branch PR #6255 at commit 6598b614e. Its kernel and initrd changes were subsequently integrated into main by #6284 at commit ceace05f3.

Evaluated by: mr-cal-bot

No scores available.

Issue body

These changes update the feature branch kernel and initrd plugins in some key ways. The initrd plugin changes are largely isolated to migrating some of the root tarball fetch logic into the plugin more properly via a `@get_pull_commands`. For the legacy plugin, the prior behavior has been left in tact. The logic in the build script and some general formatting and refactoring have occurred to accommodate these changes. Additionally, a "bug" (behavioral glitch, more like) was resolved by adding an `--allow-downgrades` flag to an `apt install` command. Otherwise, the behavior is largely the same. The spread tests have been updated to leverage some new kernel plugin options, gaining some tests of new kernel options for free. The kernel plugin changes are a bit more substantive. Firstly, like the initrd plugin, the kernel source fetching logic has moved, in part, to the plugin itself (with analogous updates to the build script logic as a result). Furthermore, some options from the ubuntu-kernel plugin have been integrated into this plugin. Specifically, the ability to build a snap from a deb, to specify the Ubuntu release of a kernel tree to build from, as well as the ability to build several kernel tools (instead of just perf). Enabling ZFS support was removed, for what I think are good reasons. Those reasons being... DKMS support "exists" in the ubuntu-kernel plugin insofar as the plugin builds a deb and leverages the existing kernel build system to build DKMS packages. Attempts were made at emulating this logic within the kernel plugin, but interacting with DKMS felt far too cumbersome (not to mention incredibly fragile) in this setting; DKMS requires a lot of facts to be true of the build environment, and it proved onerous to make the logic work in a consistent fashion. DKMS is not intended to be used in this fashion anyways; DKMS is intended to be run on runtime targets after a kernel has been updated. If you are building the module at kernel build time (ostensibly what the kernel plugin purports to do), then you can merely build the module in the relevant fashion alongside the kernel in the traditional way; no need to bother with DKMS. The enable-zfs kernel plugin option demonstrated this fact -- enabling this option effectively ran the compilation commands the DKMS tooling would run, albeit in a far more opinionated fashion than DKMS would. In lieu of this support, documentation has been created (along with some examples) for how to perform something like an out-of-tree kernel module build within a snapcraft.yaml for kernel snaps. If DKMS is desired, its usage can be spoofed by adding some relevant part and creating the correct file hierarchies within the build environment. As such, building a kernel snap with ZFS support has been removed; it was too opinionated and prescriptive for what the true intention of the flag was, and to make it more flexible would force the kernel plugin to lose its identity. The ability to build additional kernel tools (bpftool, perf, cpupower) have been added. Most critically, the legacy implementations of the plugins have been removed due to the addition of a different kernel plugin (one which many of us are used to) being merged at some point; the implementation in this PR would probably break many existing users of this new plugin, and as such it has been reverted :) Things to resolve before merging: - [x] cross building when using certain options (`kernel-use-binary-package` for sure) fails in some cases due to RISC-V kernel debs having *dumb names*. The logic in the script could be improved to resolve this issue, or we can simply make the build fail with an error (checked by the plugin rather than the script). - [x] Builds haven't been tested on actual hardware. This is my next move. - [x] commits need to be cleaned up to resolve some merge issues ETA: docs-related tests failing are probably because of something unrelated? The docs tests ran fine (locally) for me previously, I suspect something has happened to e.g. Frame docs because of the RTD move/reorg. cc @stewarthore @kubiko @laurenbrock @jicheu Supercedes #6102 --- - [x] I've followed the [contribution guidelines](https://github.com/canonical/snapcraft/blob/main/CONTRIBUTING.md). - [x] I've signed the [CLA](http://www.ubuntu.com/legal/contributors/). - [x] I've successfully run `make lint && make test`. - [x] I've added or updated any relevant documentation. - [ ] I've updated the relevant release notes.

Evaluation history

Date Model Scores Action Summary
stealth/space-bunny-alpha — closed resolved Merged via #6255 (6598b614e), expanding kernel/initrd plugin behavior and options; the feature branch then reached main through #6284 (ceace05f3).
stealth/space-bunny-alpha — closed resolved Merged as commit 7c9706674, expanding kernel/initrd plugins with Ubuntu kernel options, ABI and tool support, plugin-managed fetching, tests/docs, and removal of ZFS support.
stealth/space-bunny-alpha — closed resolved Merged in #6255 (commit 6598b614e), adding expanded kernel/initrd plugin behavior and Ubuntu kernel, tool, and ABI options; build the feature branch from merged main.
qwen/qwen3.6-35b-a3b — — Merged after review and testing. Extended kernel and initrd plugins by migrating fetch logic, adding Ubuntu release and binary package options, and supporting extra kernel tools. Removed ZFS/DKMS support in favor of documentation. Supersedes #6102.
qwen3.6-35b-a3b-mtp-q6 — — Merged. Extended kernel and initrd plugins by migrating fetch logic, adding Ubuntu kernel options, and enabling additional tool builds. Removed ZFS/DKMS support, cleaned legacy code, and fixed cross-build issues. Validated via hardware testing.

Update history

No update history recorded yet.

Related work

  • Related To: canonical/snapcraft#6102 (confidence 100%)

    Predecessor PR explicitly superseded by #6116.

  • Related To: canonical/snapcraft#6255 (confidence 98%)

    Merged the feature branch containing #6116 at commit 6598b614e.

  • Related To: canonical/snapcraft#6284 (confidence 98%)

    Integrated the completed kernel/initrd plugin feature branch into main at ceace05f3.

Related issues

Issue Project State Summary Similarity
#6102 feat: kernel|initrd plugins: extend and improve behavior snapcraft closed Superseded by #6110; cleaned-up kernel/initrd work landed through #6116 and was merged into main by #6284 (ceace05f3).
90%
#6255 Feature/kernel initrd plugin merge snapcraft merged Merged as commit 6598b614e: a main-into-feature-branch sync for the kernel/initrd plugin branch (after conflict cleanup), picking up #6254 (518476fc1). The branch later landed on main via #6284 (ceace05f3).
84%
#6254 feat(kernel,initrd): extend plugins with new options, stabilize snapcraft merged PR #6254 merged as commit 518476fc1, adding kernel/initrd plugin options, stability fixes, docs and a new kernel-deb spread test; later landed on main via #6284 (ceace05f3).
83%
#6284 feat: merge feature/kernel initrd plugin into main snapcraft merged Merged into main as ceace05f3, adding kernel and initrd plugins for base core22 and higher.
83%
#5814 feat(plugins): add kernel and initrd plugins snapcraft merged Merged #5814 in 8f56d299d, adding a reworked post-core18 kernel plugin and a new initrd/UKI plugin; it supersedes #4302.
78%
#6106 feat: add ubuntu core initrd plugin snapcraft closed Closed unmerged as duplicate work; the parallel kernel/initrd implementation landed via #6284 (commit ceace05f3).
76%
#4111 plugins: merge kernel plugin snapcraft merged Merged PR #4111 into main, landing the craft-parts and v2 kernel plugin changes from the feature branch.
74%
#4302 plugins: kernel: split kernel plugin into kernel and initrd plugins snapcraft closed PR #4302 (split kernel plugin into kernel + initrd plugins) was closed unmerged on 2025-10-14 by author kubiko as superseded by canonical/snapcraft#5814, merged in commit 8f56d299d.
71%
#6110 chore(merge): main into feature/kernel-initrd-plugin snapcraft merged Merged as bb354f749, syncing main into feature/kernel-initrd-plugin to simplify review. The kernel/initrd feature changes later landed through #6116 and #6284.
71%