Packetwatch.net

Building and Installing a FreeBSD Kernel



Last modified: Jan. 20, 2007

Here are the steps you must follow to build and install a new FreeBSD kernel.

1) Update your system sources. This can be done by using cvsup. Here is an
example supfile.
# sudo cat /usr/local/etc/cvsup/sup/src-supfile
*default tag=RELENG_X_X
*default host=cvsup3.us.freebsd.org
*default prefix=/usr
*default base=/usr/local/etc/cvsup
*default release=cvs delete use-rel-suffix compress
src-all
# sudo cvsup -g -L 2 /usr/local/etc/cvsup/sup/src-supfile

2) Apply any patches to the system sources.

3) Read /usr/src/UPDATING for any additional steps or commands.

4) Edit your /etc/make.conf for customizations.

If you don't have /etc/make.conf copy it from the system sources. It can be
found in your system sources by typing the following.
# sudo find /usr/src -name make.conf
/usr/src/share/examples/etc/make.conf

5) Create a new kernel configuration file by copying GENERIC.
# cd /usr/src/sys/i386/conf
# sudo cp GENERIC CUSTOM

6) A lot of kernel options can be found in the file named LINT. If you
don't have that file, you can create it by typing the following.
# cd /usr/src/sys/i386/conf
# sudo make LINT

7) Edit the new kernel configuration.
# sudo vi /usr/src/sys/i386/conf/CUSTOM

8) Build the new kernel.
# cd /usr/src
# sudo make buildkernel KERNCONF=CUSTOM

9) Backup the current kernel and modules.
# sudo cp -Rp /boot/kernel/ /boot/kernel.old/

10) Install the new kernel.
# sudo make installkernel KERNCONF=CUSTOM

11) Finally, shutdown the system and reboot to use the new kernel.
# sudo shutdown -r now


Last modified: Thu Jan 1 00:00:00 1970 UTC
Packetwatch Research 2002-2024.