# Building an OpenBSD Kernel

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

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

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

Download the kernel source
```
cd /usr
cvs -qd anoncvs@anoncvs.ca.openbsd.org:/cvs checkout -P src
```

Update the kernel source
```
cd /usr/src
cvs -q up -Pd
```

Configure Kernel
```
cd /usr/src/sys/arch/amd64/conf
cp GENERIC.MP MYKERNEL
config MYKERNEL
```

Build and install kernel (amd64)
```
cd /sys/arch/amd64/compile/MYKERNEL
make clean
make
make install # the old kernel is /obsd now
```

That's it. Reboot.

This is ONLY the kernel. If you need to build the whole system, please
consult the OpenBSD documentation (hint: release(8)).
