Packetwatch.net

Building and Installing a OpenBSD Kernel



Last modified: Jan. 20, 2007

Here are the steps you must follow to build and install a new OpenBSD 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=OPENBSD_X_X
*default host=cvsup.usa.openbsd.org
*default prefix=/usr
*default base=/usr/local/etc/cvsup
*default release=cvs delete use-rel-suffix compress
OpenBSD-src
# sudo cvsup -g -L 2 /usr/local/etc/cvsup/sup/src-supfile

2) Apply any patches to the system sources.

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

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

When editing the kernel you will notice there is an include file option. The
include file also has a lot of kernel configuration options. You can can edit
this file as well, but to me it's easier to have one kernel configuration file.
In order to have one file we need to first, remove the include line, then copy
all of the kernel options from /usr/src/sys/conf/GENERIC into our new kernel
file located at /usr/src/sys/arch/i386/conf/CUSTOM.

5) Build the new kernel.
# cd /usr/src/sys/arch/i386/conf
# sudo config CUSTOM
# cd ../compile/CUSTOM
# sudo make clean
# sudo make depend
# sudo make

6) Backup the current kernel.
# sudo cp /bsd /bsd.old

7) Install the new kernel.
# sudo cp bsd /bsd

8) 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.