# Building an OpenBSD Kernel

I'm running OpenBSD-current for a while in order to support my port.
It's only one port at the moment, but that's a start, right?

Anyway... every once in a while I stumble over a patch on the OpenBSD
mailing list I want to try and this requires me to apply the patch and
build the Kernel with it. But how?

Well, the documentation is where
[where you would expect it](https://www.openbsd.org/faq/faq5.html#Custom).

*Download the kernel source*

<pre>
# cd /usr
# cvs -qd anoncvs@anoncvs.ca.openbsd.org:/cvs checkout -P src
</pre>

*Update the kernel source (if you downloaded it a while ago)*

<pre>
# cd /usr/src
# cvs -q up -Pd
</pre>

*Configure Kernel*

<pre>
# cd /usr/src/sys/arch/amd64/conf
# cp GENERIC.MP MYKERNEL
# config MYKERNEL
</pre>

*Build and install kernel (amd64)*

<pre>
# cd /sys/arch/amd64/compile/MYKERNEL
# make clean
# make
# make install # the old kernel is /obsd now
</pre>

That's it. Reboot.

This is ONLY the Kernel. If you need to build the whole system, please
consult the OpenBSD documentation. The manpage release(8) is a good start.