SOLVED: Compiling custum kernel with ZFS support

FuriousGeorge

Renowned Member
Sep 25, 2012
84
2
73
UPDATE: This is solved. See a few posts down for how I did it. The purpose was to revert a patch applied to the intel-iommu driver, breaking it for many X58 boards, pending the official bugfix.





I need to patch the pve-kernel due to a bug concerning my mb and iommu.

I check out the pve-kernel package with git and try a dry run with just a regular 'make' and it fails::

Code:
CC [M]  drivers/gpu/drm/nouveau/dispnv04/tvnv17.o
  LD [M]  drivers/gpu/drm/nouveau/nouveau.o
  LD      drivers/gpu/drm/built-in.o
  LD      drivers/gpu/built-in.o
Makefile:960: recipe for target 'drivers' failed
make[2]: *** [drivers] Error 2
scripts/package/Makefile:91: recipe for target 'deb-pkg' failed
make[1]: *** [deb-pkg] Error 2
Makefile:1250: recipe for target 'deb-pkg' failed
make: *** [deb-pkg] Error 2

The odd thing is, I was just able to compile and install a vanilla 4.7 kernel in order to test a fix for the aforementioned bug. The test 'worked' when the OS did not hardlock on boot, but there is no ZFS support in the mainline kernel, or I would just use that.

I assume I cannot simply apply the ZFS patches that came with the pve-kernel source to the mainline kernel.

Before I move on to trying to build a different kernel, and trying to get that to work with ZFS, I was hoping some one may have an idea as to why the compile is failing.

Thanks,
Brian
 
Last edited:
Pardon me if I'm misunderstanding you, but isn't the 4.4 ubuntu-lts kernel the same one that I check out from the proxmox repository (ubuntu-xenial)?

I went ahead and checked it out out anyway as per this page: https://wiki.ubuntu.com/Kernel/Dev/KernelGitGuide

make kernelversion also returns 4.4.13, and the build fails the same way.

Let me know if I'm not getting something.

I'm thinking of following these docs with the 4.7 kernel that fixes my iommu problem: https://github.com/zfsonlinux/zfs/wiki/Building-ZFS

Isn't the patch just for ZFS support? I know there are other patches, but I think the ZFS patch is the only one I need for this HW.
 
You are trying to apply a patch to kernel-4.4 which is prepared for kernel-4.7 if I understand correctly what you are trying to do.
 
You are trying to apply a patch to kernel-4.4 which is prepared for kernel-4.7 if I understand correctly what you are trying to do.

The pve-kernel sources I checked out come with ubuntu-xenial kernel sources, and a ZFS patch for the same.

When I try to manually build that kernel it fails with the error in OP.

Short of being able to determine why this is, what are my options? I have to build a kernel manually with ZFS support.

I know I can compile a 4.7 mainline kernel, because I've done it on this system (in order to test the fix in current 4.7 for my mb and iommu, which is the whole reason I'm doing this), so I may as well try to add ZFS support to that kernel and use it.

However, in following https://github.com/zfsonlinux/zfs/wiki/Building-ZFS I am only able to make modules for 4.4.13 kernel (which I cannot compile). I pass --with-linux=/root/src/linux/kernel (4.7 sources), and it still builds modules for 4.4.13.

That's where I'm at right now, but I'm working on it, so I'll update this thread as soon as anything changes.
 
Just to be clear, there are two patches in question:

There is the ZFS patch that comes with pve-kernel sources.

There is a patch to intel-iommu.c which I need to apply for iommu to work on my motherboard.

If I use kernel 4.7, I don't need the second patch, but I always need to add ZFS root support to my kernel.
 
I don't use ZOL so I cannot help you any further. Try opening a support ticket with proxmox or wait for other users to chime in.
 
I finally got it going. The procedure not pretty, but effective:

  1. Bork system trying to build zfs for 4.7 kernel,
  2. Reinstall from backup
  3. git clone pve-kernel
  4. Start compile, allow it to unpack tarball and patch source
  5. Ctrl+C
  6. Replace the .config with native 4.4.13-r2 config file from /boot
  7. Fix the intel-iommu.c file pending newer kernel with fix (whole reason I'm doing this)
  8. Remove native pve-kernel-4.4.13-2 package
  9. make -j13 deb-pkg
  10. Install linux-image-4.4.13-2.blah.deb
  11. at this point, the initrd still won't work with zfs, not sure why
  12. so i just used the initrd from the native pve-kernel-4.4.13 package, i assume it only works because the versions match
I realize this is unsupported, but there should probably be something on the wiki with a correct method. There are plenty of good reasons to want to recompile your kernel, e.g. mine.

I'm really curious as to what the official packages do differently than my custom kernel package that results in a working initrd.
 

About

The Proxmox community has been around for many years and offers help and support for Proxmox VE, Proxmox Backup Server, and Proxmox Mail Gateway.
We think our community is one of the best thanks to people like you!

Get your subscription!

The Proxmox team works very hard to make sure you are running the best software and getting stable updates and security enhancements, as well as quick enterprise support. Tens of thousands of happy customers have a Proxmox subscription. Get yours easily in our online shop.

Buy now!