10.0-BETA3: how to build kernel with ZFS?

What does one have to do to get a kernel with zfs.ko build these days?

I am trying to build my own kernel, as the NKPT value of the stock kernel is too low to be suitable for PXE network booting a mfsroot ramdisk image.
However I noticed that when I build my own kernel, it does not have ZFS support.

- based on another forum post I added WITH_ZFS=YES to /etc/make.conf and did buildkernel/installkernel again, but no difference. There is no zfs.ko and calling the zfs command line tools results in internal error: failed to initialize ZFS library
- my kernel configuration is just a copy of GENERIC with options NKPT=100 added.
 
make.conf is the wrong place, that would normally be /etc/src.conf. Check the contents of that file first, building of ZFS may be disabled in there.
 
As far as I know you cannot build ZFS into the kernel yet. And src.conf only supports WITHOUT_ZFS. A normal build should produce the correct modules.
 
It's certainly there on my system, GENERIC kernel and nothing in make.conf or src.conf.
Code:
freebsd10 ~ % uname -a
FreeBSD freebsd10.rdnzl.info 10.0-BETA3 FreeBSD 10.0-BETA3 #0 r257735: Wed Nov  6 17:31:33 EET 2013     toor@freebsd10.rdnzl.info:/usr/obj/usr/src/sys/GENERIC  i386
freebsd10 ~ % ls -l /boot/kernel/zfs.ko
-r-xr-xr-x  1 root  wheel  1737081 Nov  6 19:37 /boot/kernel/zfs.ko
freebsd10 ~ %
 
SirDice said:
As far as I know you cannot build ZFS into the kernel yet. And src.conf only supports WITHOUT_ZFS. A normal build should produce the correct modules.

Do not have a /etc/src.conf, so did not exclude it there.

It does not produce the correct modules with FreeBSD 10.0 beta 3 when I do a build like this:

Code:
make buildkernel KERNCONF=MYKERNCONF
make installkernel KERNCONF=MYKERNCONF

Code:
# find /boot |grep zfs.ko
#

Stock kernel/installation CD does have a zfs.ko.

Code:
# find /mnt/cd |grep zfs.ko
/mnt/cd/boot/kernel/zfs.ko
 
Since ZFS support can only be provided using a kernel module (at the time of writing obviously) you should check how you've configured your kernel modules to be build. Check make.conf and look for any module build parameters.

Something in the likes of MODULES_OVERRIDE or maybe you even have something like NO_MODULES or WITHOUT_MODULES in place.

If so then it could explain something, see make.conf(5) for more details on this.
 
Max_nl said:
What does one have to do to get a kernel with zfs.ko build these days?

I am trying to build my own kernel, as the NKPT value of the stock kernel is too low to be suitable for PXE network booting a mfsroot ramdisk image.
However I noticed that when I build my own kernel, it does not have ZFS support.

- based on another forum post I added WITH_ZFS=YES to /etc/make.conf and did buildkernel/installkernel again, but no difference. There is no zfs.ko and calling the zfs command line tools results in internal error: failed to initialize ZFS library
- my kernel configuration is just a copy of GENERIC with options NKPT=100 added.

What I usually do is:

1) pull source from SVN and update it
2) create a new kernel configuration file (say MYCUSTOMKERNEL) in related arch like /usr/src/sys/amd64/conf/MYCUSTOMKERNEL for amd64
3) In the above file, start with:

Code:
include GENERIC
ident MYCUSTOMKERNEL

options NKPT=100

and add whateeer you need to include in the kernel.

4) Compile:
Code:
#make -s -j8 buildworld; make -s -j8 buildkernel KERNCONF=MYCUSTOMKERNEL
#make installkernel KERNCONF=MYCUSTOMKERNEL
#reboot
 
Back
Top