According to FreeBSD Handbook, there are two ways of building a custom kernel: The Traditional Way and The New Way.

Either way, we should create a custom kernel configuration file, Then we use this custom kernel configuration for building the new kernel:

$ cd /usr/src
$ cp sys/amd64/config/GENERIC …