# Install kernel module (zfs) for a different kenel -

## Stryder0

I currently have Gentoo installed on a zfs root filesystem with kernel 4.9.16 - 

I downloaded the mainline 4.12-rc7 kernel from kernel.org and built it. I am trying to create an initramfs that is compatible with a zfs root filesystem using feared bilss' bliss-initramfs tool. Even after running "emerge zfs zfs-kmod spl" attempting to creat the initramfs causes an error saying that the module for zfs does not exist for my kernel. checking /lib/modules/4.12.0-rc7 shows that this is true - the module for zfs was not installed for this kernel. I am somewhat new to gentoo and not entirely sure how portage works, but I think installing zfs just installs it for the current kernel I have loaded. Because my system in installed on zfs I need the module for the newer kernel in order for the system to boot. Does anyone know how I can build zfs for the newer kernel that I do not have loaded?

----------

## eccerr0r

Portage should build for whatever kernel /usr/src/linux is pointing to.  You can eselect kernel to choose which which kernel to use.

----------

## Stryder0

Thank you - using eselect and setting to the newer kernel allowed me to install zfs for it and boot into it without (much) issue.

----------

## bunder

Please note that zfs 0.6.5.10 is touted to be compatible up to 4.12-rc3, if you run into any compatibility issues, please file an issue at http://github.com/zfsonlinux/zfs/issues

----------

## ScottESanDiego

 *bunder wrote:*   

> Please note that zfs 0.6.5.10 is touted to be compatible up to 4.12-rc3, if you run into any compatibility issues, please file an issue at http://github.com/zfsonlinux/zfs/issues

 

Note https://github.com/zfsonlinux/zfs/issues/6324 .  Easily solved with a pair of patches in /etc/portage/patches/sys-fs/zfs-kmod-0.6.5.10 though.

```
intrepid zfs-kmod-0.6.5.10 # cat *

--- zfs-0.6.5.10/module/zfs/zfs_vfsops.c        2017-06-14 10:09:41.000000000 -0700

+++ /tmp/zfs_vfsops.c   2017-07-07 11:54:15.017607504 -0700

@@ -1403,8 +1403,6 @@

        sb->s_time_gran = 1;

        sb->s_blocksize = recordsize;

        sb->s_blocksize_bits = ilog2(recordsize);

-       zsb->z_bdi.ra_pages = 0;

-       sb->s_bdi = &zsb->z_bdi;

        error = -zpl_bdi_setup(sb, "zfs");

        if (error)

--- zfs-0.6.5.10/include/sys/zfs_vfsops.h       2017-06-14 10:06:53.000000000 -0700

+++ /tmp/zfs_vfsops.h   2017-07-07 11:46:48.043824314 -0700

@@ -64,7 +64,6 @@

 typedef struct zfs_sb {

        struct super_block *z_sb;       /* generic super_block */

-       struct backing_dev_info z_bdi;  /* generic backing dev info */

        struct zfs_sb   *z_parent;      /* parent fs */

        objset_t        *z_os;          /* objset reference */

        zfs_mntopts_t   *z_mntopts;     /* passed mount options */

```

----------

