Skip to content

Add zfs kernel module package - #4220

Open
mwaionos wants to merge 2 commits into
linuxkit:masterfrom
mwaionos:pkg-zfs
Open

Add zfs kernel module package#4220
mwaionos wants to merge 2 commits into
linuxkit:masterfrom
mwaionos:pkg-zfs

Conversation

@mwaionos

@mwaionos mwaionos commented Jul 31, 2026

Copy link
Copy Markdown

- What I did

Added a ZFS kernel module package (ZFS 2.2.9) built against a given kernel's headers, wired into the same per-kernel-series tool-build mechanism already used by perf and bcc.

- How I did it

kernel/common/Dockerfile.zfs existed but was orphaned (still ZFS 0.8.1, using the old ARG IMAGE convention, and not referenced by any current build target since the perf/bcc tool-build refactor). I rewrote it to:

  • ZFS 2.2.9, with the fuller Alpine dependency list and --with-linux=/usr/src/linux kernel-source extraction needed to build against current kernels
  • The current ARG BUILD_IMAGE/ARG KERNEL_VERSION/ARG PKG_HASH + FROM linuxkit/kernel:${KERNEL_VERSION}-${PKG_HASH} convention shared with Dockerfile.perf/Dockerfile.bcc

Added kernel/common/build-zfs.yml (same shape as build-perf.yml/build-bcc.yml) and added zfs to kernel/Makefile's TOOLS list, so make build-<version> builds it for every supported kernel series automatically.

- How to verify it

```
cd kernel
make buildtool-6.12.59PARTzfs
make buildtool-6.6.71PARTzfs
```
I build-tested both currently non-deprecated series (6.12.59 and 6.6.71) directly via docker build --build-arg KERNEL_VERSION=... --build-arg PKG_HASH=... -f kernel/common/Dockerfile.zfs kernel/common against the real published linuxkit/kernel images, and confirmed spl.ko/zfs.ko are present in /lib/modules/<version>-linuxkit/extra/ in both resulting images.

- Description for the changelog

Add a ZFS (2.2.9) kernel module package, buildable per supported kernel series alongside perf/bcc.

- A picture of a cute animal (not mandatory but encouraged)

🦭

mwaionos added 2 commits July 29, 2026 08:25
Builds spl.ko and zfs.ko against a kernel's headers, extracted from
the kernel image via the existing kernel-dev.tar/kernel.tar/
linux.tar.xz convention shared with kernel/common/Dockerfile.perf and
Dockerfile.bcc. The zfs source version is parameterized via the
ZFS_VERSION build arg (default 2.2.9). Final stage is FROM scratch,
containing only the built kernel modules.

Wired up via kernel/common/build-zfs.yml and added to kernel/Makefile's
TOOLS list, so `make build-<version>` builds it for every supported
kernel series (currently 6.12.59 and 6.6.71).

Includes kmod in the build image's apk install list: Alpine's default
depmod is a BusyBox reimplementation that doesn't support
/etc/depmod.d overrides, which kernel/common/Dockerfile.drbd relies on
to resolve a real module-naming collision — kept consistent here even
though zfs/spl have no such collision to resolve.

Ported from ionos-cloud/paas-image.

Signed-off-by: mwaionos <moritz.wagner@ionos.com>
test/cases/040_packages/027_zfs boots a kernel with the package's
spl.ko/zfs.ko, modprobes zfs, and does a real zpool create/list/
destroy cycle against a loop-backed file — not just a module-load
smoke check.

Requires linuxkit/kernel-zfs:test-local to already exist in the local
docker image store (build it from kernel/common/build-zfs.yml); not
pulled from any registry, so the test is labeled skip and is meant to
be run manually.

Build-tested locally: zpool create/list/destroy and zfs list all
succeed against a real ZFS 2.2.9 pool created by the module.

Signed-off-by: mwaionos <moritz.wagner@ionos.com>
@mwaionos

Copy link
Copy Markdown
Author

Hey,

just wanted to ask if you guys have interest in that PR. We use and maintain it internally anyways.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant