This guide provides instructions on setting up and installing a custom kernel configuration specifically tailored for my FreeBSD home server, primarily functioning as a NAS (Network Attached Storage). The configuration has been optimized by removing unnecessary modules and adding custom modifications tailored for my machine. Note that this configuration is designed to work exclusively with my server and may not be suitable for other systems.
The custom configuration is based on the GENERIC FreeBSD kernel, with unnecessary modules marked and removed using ###.
- ZFS: A robust file system and logical volume manager designed for data integrity, scalability, and ease of administration.
- File Systems: Supports additional file systems like File Descriptor Filesystem (FDESCFS), NullFS (for mounting a null layer), and UnionFS (for combining multiple directories).
- Device Support: Adds support for various devices including AMD temperature sensors (amdtemp), AMD System Management Network (amdsmn), CPU control (cpuctl), and more.
- Networking: Adds support for network bridging (if_bridge) and various USB devices including Human Interface Devices (uhid, usbhid, hidbus). This is essential for managing jails and virtual machines (VMs).
To begin, source the FreeBSD source code by cloning the appropriate branch:
git clone -b releng/14.1 https://git.freebsd.org/src.git /usr/src
For more details on building and installing a FreeBSD kernel, refer to Chapter 9. Building and Installing a FreeBSD Kernel. For instructions on configuring the FreeBSD kernel, refer to Chapter 10. Configuring the FreeBSD Kernel.
To link the NAS configuration file to the appropriate location in your FreeBSD system, follow these steps:
-
Navigate to the FreeBSD configuration directory::
cd /usr/src/sys/amd64/conf
-
Create a symbolic link to the NAS configuration file::
ln -s /path/to/NAS_FreeBSD_kernel_conf/sys/amd64/conf/NAS NAS
-
Navigate to the FreeBSD source directory:
cd /usr/src
-
Clean the previous build environment:
make -j12 clean
-
Build the kernel with the custom configuration using parallel jobs:
make -j12 buildkernel KERNCONF=NAS
-
Install the newly built kernel:
make installkernel KERNCONF=NAS
-
Reboot the system to load the new kernel:
reboot
This guide should help set up a FreeBSD system with a custom kernel configuration optimized for NAS home server needs, including sourcing the FreeBSD source code and linking the configuration file appropriately.