Compiling ZFS Against Different Kernels
January 26, 2016. 418 words.
./configure are often counter-intuitively named.
Oh no! Counter-intuitive naming? In information technology? Really? Since when?
ZFS dkms packages are on Debian only available for jessie and wheezy. The ZFS on Linux package “maintainer” has made it very clearError while upgrading debian testing “Unknown Debian GNU/Linux version!”. zfsonlinux/pkg-zfs, #160. that he will not support any messing around with the dmks packages.
It it sometimes a healthy exercise to compile and package oneself. Compiling ZFS On LinuxZFS On Linux. is quickly done, although not quite devoid of any risk. Beware: This breaks grub-pc on my system. I do not care and write grub.cfg myself. If you do, leave it alone.
Compile packages for your system according to the instructions for your distribution.ZFS on Linux Wiki: Custom Packages.
When upgrading or preparing another system, it is not practical to compile for the currently running kernel alone. It is not (at least to me) immediately clear how to compile against a different target kernel. Having finally understood that object files referenced it the documentation actually are included in the header package, it, it is very easy:
cd $SPLSRC ./autogen.sh ./configure \ --with-linux=$LINUX_SOURCES \ --with-linux-obj=$LINUX_HEADERS make clean && rm *deb *rpm *tar.gz make deb-utils deb-kmod dpkg -i *.deb cd $ZFSSRC ./autogen.sh ./configure \ --with-linux=$LINUX_SOURCES \ --with-linux-obj=$LINUX_HEADERS make clean && rm *deb *rpm *tar.gz make deb-utils deb-kmod dpkg -i *.deb
When you just update kernels, it is sufficient to install the kmod-* packages.
The resulting packages do not update module dependencies, so you need to run
sudo depmod -A $VERSION-$ARCH afterwards.
Doing this on Debian as I or on other distributions is a kind of Frankenstein configuration. It is safe if you know what you are doing. It is not if you do not and are not able to pull yourself out and together if things go wrong on your own. Nobody will help you.