← Back to issue list

feat: kernel|initrd plugins: extend and improve behavior

View original Github issue

Metadata

Project
snapcraft
Number
#6102
Type
pull request
State
closed
Author
dilyn-corner
Labels
Created
Updated
Closed

Current evaluation

Superseded by PR #6110. The changes were reverted to prevent conflicts with a newly merged kernel plugin that would break existing users. The author closed this PR and redirected development to the replacement.

Suggested action:

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: - [ ] 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). - [ ] Builds haven't been tested on actual hardware. This is my next move. - [ ] 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 --- - [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
qwen/qwen3.6-35b-a3b Superseded by PR #6110. The changes were reverted to prevent conflicts with a newly merged kernel plugin that would break existing users. The author closed this PR and redirected development to the replacement.
qwen3.6-35b-a3b-mtp-q6 Superseded by pull request #6110. Changes were reverted to avoid breaking existing users, as a different kernel plugin implementation was merged instead. The author linked the replacement PR in the final comment.
qwen3.6-35b-a3b-mtp-q6 Superseded and closed. The author reverted the changes because a different kernel plugin was merged, which would break existing users. The work was abandoned in favor of PR #6110.

Update history

No update history recorded yet.

Related issues

Issue Project State Summary Similarity
#6116 feat: kernel|initrd plugins: extend and improve behavior snapcraft merged 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.
83%
#4302 plugins: kernel: split kernel plugin into kernel and initrd plugins snapcraft closed Splitting the kernel plugin into separate kernel and initrd components was closed as superseded by PR #5814. Review discussions addressed cross-compilation and LXD setup, but the changes were ultimately replaced by a newer implementation.
77%
#5814 feat(plugins): add kernel and initrd plugins snapcraft merged Merged into a feature branch after simplifying kernel and initrd plugin logic and addressing review feedback. Unrelated spread test failures prompted a temporary merge to prevent staleness, with full integration pending upstream fixes.
77%
#6254 feat(kernel,initrd): extend plugins with new options, stabilize snapcraft merged Merged after approval. Extended the kernel plugin with new options, stabilized the initrd plugin, improved documentation, and added tests. Resolved a temporary Resolute tarball naming divergence. Core CI checks passed.
75%
#6284 feat: merge feature/kernel initrd plugin into main snapcraft merged Merged into main following two reviewer approvals. Integrates a feature branch adding kernel and initrd plugins for base: core22 and higher. The change spans 32 files, adding 8281 lines and removing 6257.
74%
#6255 Feature/kernel initrd plugin merge snapcraft merged Merged after resolving conflicts and aligning with HEAD. Integrates kernel initrd plugin support, requires PR #6254, approved by two reviewers, and passed CI checks.
74%
#457 kernel plugin: fix decompressio of lzma initrd (and others) snapcraft closed Superseded by #463. The pull request was closed to address the lzma initrd decompression fix through an alternative PR.
73%
#6106 feat: add ubuntu core initrd plugin snapcraft closed Contributor stewarthore closed the Ubuntu Core initrd plugin pull request to avoid duplicating effort. The work was abandoned in favor of merging a separate PR from Dilyn, which will implement the same functionality.
71%