Building the FreeBSD kernel

tested on FreeBSD 12.1

We are here adding ZFS to the MINIMAL template, as FreeBSD XEN/PVH doesn’t have a loader hence doesn’t know how to load modules (and zfs.ko is a module).

cd /usr/src/sys/amd64/conf/
cp -pi GENERIC GENERIC-ZFS
cp -pi MINIMAL MINIMAL-ZFS
vi GENERIC-ZFS
vi MINIMAL-ZFS

options     ZFS

#config MINIMAL-ZFS
#cd ../compile/MINIMAL-ZFS/
#make cleandepend && make depend
#make > /root/kernel.log && echo BUILT

cd /usr/src/
dmesg | grep cpu
ls -lF /etc/make.conf #noexist
echo NO_MODULES=1 > /etc/make.conf
time make buildkernel KERNCONF=GENERIC-ZFS > /root/kernel.log && echo BUILT
make installkernel KERNCONF=GENERIC-ZFS > /root/kernel.install.log && echo INSTALLED
ls -lhF /boot/kernel/kernel
strings /boot/kernel/kernel | grep -i zfs

Troubleshooting

while building MINIMAL-ZFS

ld: error: undefined symbol: xdrmem_create
>>> referenced by opensolaris_nvpair.c:0 (../../../cddl/contrib/opensolaris/common/nvpair/opensolaris_nvpair.c:0)
>>>               opensolaris_nvpair.o:(nvlist_common)

==> …

Resources

make.conf – system build information https://www.freebsd.org/cgi/man.cgi?make.conf(5)

8.3 Building and Installing a Custom Kernel https://docs.freebsd.org/doc/6.1-RELEASE/usr/share/doc/handbook/kernelconfig-building.html

8.5. Building and Installing a Custom Kernel https://www.freebsd.org/doc/handbook/kernelconfig-building.html


HOME | GUIDES | BENCHMARKS | html