rpm: Add support for building akmod packages (2.4 branch) - #19141
Merged
behlendorf merged 1 commit intoSep 21, 2026
Merged
Conversation
Add akmod (Automatic Kernel Module) support to ZFS, providing a third packaging option alongside the existing DKMS and kmod packages. Akmod packages automatically build binary kmod RPMs when new kernels are installed, enabling: - Automatic kernel module rebuilds on kernel updates - Distribution of binary kmod RPMs without recompilation - Seamless minor version upgrades on RHEL/Fedora and clones Key changes: - rpm/generic/zfs-kmod.spec.in: Add conditional akmod support via rpmbuild --define '_enable_akmod 1'. When enabled, sets buildforkernels=akmod and repo=rpmfusion so kmodtool generates an akmod-zfs package. Add -common subpackage for shared license/doc files. Guard chmod and %files sections for empty kernel_versions. Make kmod-devel packages opt-in via %bcond_with devel to prevent akmods from installing unnecessary devel packages on every kernel update. When devel is not enabled, devel header files are cleaned from the buildroot to avoid unpackaged-files errors. - config/rpm.am: Add 'make rpm-akmod' and 'make srpm-akmod' targets. These targets use the generic spec with _enable_akmod and intentionally omit kernel-specific defines (kernels, ksrc, kobj) so kmodtool enters its akmod-only code path. The existing rpm-kmod/srpm-kmod targets pass --with devel to preserve the current behavior of producing devel packages. - config/zfs-build.m4: Update comments to document the akmod vs regular kmod distinction for RPM_DEFINE_KMOD. - scripts/kmodtool: Fix a pre-existing bug where print_rpmtemplate_kmoddevelpkg (the common kmod-NAME-devel package) was called inside the per-kernel loop in print_customrpmtemplate and print_rpmtemplate, causing duplicate %package definitions when multiple kernel-devel packages are installed. Move it outside the loop so it is emitted exactly once. The akmod infrastructure requires the 'akmods' package to be installed on the target system. When the akmod-zfs RPM is installed, it places a zfs-kmod src.rpm in /usr/src/akmods/. The akmods service then automatically rebuilds it for the running kernel via rpmbuild --define 'kernels <uname-r>' --rebuild. Usage: make rpm-akmod # Build akmod-zfs, kmod-zfs (meta), zfs-kmod-common make rpm-kmod # Build kmod with devel packages (unchanged behavior) Tested on Fedora 43 (kernel 7.1), RHEL 9.8 (kernel 5.14), and Alma Linux 10 (kernel 6.12). Verified akmods rebuilds produce only kmod-zfs (no devel packages) after kernel updates. Signed-off-by: Vincent S. Cojot <vcojot@redhat.com>
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Backport of #19099 to
zfs-2.4.5-staging.Cherry-pick applied cleanly — all modified files are identical
or trivially different across branches.
Tested on Fedora 43 (kernel 7.2.5) and RHEL 10.2 (kernel 6.12)
with ZFS 2.4.4 — full akmod lifecycle verified.
Signed-off-by: Vincent S. Cojot vcojot@redhat.com