Preparing for Kernel Customization

Before customizing the kernel, back up the known-good GENERIC kernel on your system by copying /bsd to /bsd.GENERIC. That way, if your custom kernel doesn’t boot, you can recover by booting the backup kernel.

You’ll need the kernel source code in order to build a custom kernel. You can just grab sys.tar.gz from your OpenBSD installation media. If you installed from an Internet mirror, make sure to get the source code for your version of OpenBSD. The OpenBSD mirror root directory usually contains a snapshot of fairly recent source code, but check the directory for your release for its source code. Expand this directory under /usr/src.

# cd /usr/src
# tar -xzvpf sys.tar.gz

Now that you have a backup (you did ...

Get Absolute OpenBSD, 2nd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.