There are four categories of trouble that can occur when building a custom kernel:
config failsIf config fails, it will print the
	    line number that is incorrect.  As an example, for the
	    following message, make sure that line 17 is typed
	    correctly by comparing it to GENERIC
	    or NOTES:
config: line 17: syntax error
make failsIf make fails, it is usually due to
	    an error in the kernel configuration file which is not
	    severe enough for config to catch.
	    Review the configuration, and if the problem is not
	    apparent, send an email to the FreeBSD general questions mailing list which
	    contains the kernel configuration file.
If the new kernel does not boot or fails to recognize
	    devices, do not panic!  Fortunately, FreeBSD has an excellent
	    mechanism for recovering from incompatible kernels.
	    Simply choose the kernel to boot from at the FreeBSD boot
	    loader.  This can be accessed when the system boot menu
	    appears by selecting the “Escape to a loader
	      prompt” option.  At the prompt, type
	    boot
	      , or the
	    name of any other kernel that is known to boot
	    properly.kernel.old
After booting with a good kernel, check over the
	    configuration file and try to build it again.  One helpful
	    resource is /var/log/messages which
	    records the kernel messages from every successful boot.
	    Also, dmesg(8) will print the kernel messages from
	    the current boot.
When troubleshooting a kernel, make sure to keep
	      a copy of GENERIC, or some other
	      kernel that is known to work, as a different name that
	      will not get erased on the next build.  This is
	      important because every time a new kernel is installed,
	      kernel.old is overwritten with the
	      last installed kernel, which may or may not be bootable.
	      As soon as possible, move the working kernel by renaming
	      the directory containing the good kernel:
#mv /boot/kernel/boot/kernel.bad#mv /boot/kernel.good/boot/kernel
If the kernel version differs from the one that the system utilities have been built with, for example, a kernel built from -CURRENT sources is installed on a -RELEASE system, many system status commands like ps(1) and vmstat(8) will not work. To fix this, recompile and install a world built with the same version of the source tree as the kernel. It is never a good idea to use a different version of the kernel than the rest of the operating system.
All FreeBSD documents are available for download at https://download.freebsd.org/ftp/doc/
Questions that are not answered by the
    documentation may be
    sent to <freebsd-questions@FreeBSD.org>.
    Send questions about this document to <freebsd-doc@FreeBSD.org>.