FreeBSD Developers' Handbook
Prev |  | Next

# Chapter 9 Building and Installing a FreeBSD Kernel

Being a kernel developer requires understanding of the kernel build process. To debug the FreeBSD kernel it is required to be able to build one. There are two known ways to do so:

- The “Traditional” Way

- The “New” Way

> Note: It is supposed that the reader of this chapter is familiar with the information described in the Building and Installing a Custom Kernel chapter of the FreeBSD Handbook. If this is not the case, please read through the above mentioned chapter to understand how the build process works.

# 9.1 Building a Kernel the “Traditional” Way

Up to version 4.X of FreeBSD this was the recommended way to build a new kernel. It can still be used on newer versions (instead of the “buildkernel” target of the toplevel `/usr/src/` makefiles). Building the kernel this way may be useful when working on the kernel code and it may actually be faster than the “New” procedure when only a single option or two were tweaked in the kernel configuration file. On the other hand, it might lead to unexpected kernel build breakage when used by beginners on newer versions of FreeBSD.

1. Run config(8) to generate the kernel source code:

       # /usr/sbin/config MYKERNEL

2. Change into the build directory. config(8) will print the name of this directory after being run as above.

       # cd ../compile/MYKERNEL

3. Compile the kernel:

       # make depend
       # make

4. Install the new kernel:

       # make install

Prev | Home | Next
Kernel | Up | Building a Kernel the “New” Way