![]() |
|
| Daemon News Ezine | BSD News | BSD Mall | BSD Support Forum | BSD Advocacy | BSD Updates |
Rebuilding the OpenBSD kernelby Brad SchonhorstThe kernel is the core of the operating system. It is the binary file that the computer loads first and stores in memory. Because it is stored in memory, the kernel needs to be as small as possible. The kernel usually lives in the root directory ('/') and by default is called 'bsd'. Users who want their OpenBSD machine to perform specific functions or need additional device drivers might want to customize their kernel. In other OS's, like some types of Linux, it is very popular to rebuild the kernel because the default is so bloated. For most users, the default OpenBSD kernel is sufficient; however, you should still apply kernel patches, which will require rebuilding and installing a fresh kernel. You will need the system source code and patches. I will assume both of these have been installed. If not, check out my Patching OpenBSD instructions. You can apply many patches to the kernel source before rebuilding, but make sure you apply them in order! Building a new kernel1. Using the appropriate working directoryFirst you'll need to get into the appropriate working directory. This depends on the platform you are using. This example is for a macppc, but you should use your platform's directory instead (e.g., i386, alpha, etc...). $ cd /usr/src/sys/arch/macppc/conf 2. ConfiguringNow we can configure it with the generic macppc configuration file. $ sudo /usr/sbin/config GENERIC 3. BuildingNext we will build the new kernel using make(1). The make program simplifies the maintenance and compiling of other programs. We will first change to the correct directory and then run the make program. The second step will take a while. $ cd /usr/src/sys/arch/macppc/compile/GENERIC $ sudo make clean && sudo make depend && sudo make Installing the new kernelWe have now created a new kernel, but it is not in the right place yet. If you reboot your computer, it will launch the existing kernel in '/'. The one we just built is still in /usr/src/sys/arch/macppc/compile/GENERIC/. We need to move it so that it loads when we reboot. 4. Making a backupWe make a backup copy of our old kernel in case the new one won't boot. $ sudo cp /bsd /bsd.old 5. Putting the kernel in placeNow we can copy our new kernel to '/' and try it out. It is a good idea to make sure the permissions are set correctly, too. $ sudo cp /usr/src/sys/arch/macppc/compile/GENERIC/bsd /bsd $ sudo chown root:wheel /bsd All doneNow that the kernel is built and installed, you can reboot and load it! $ sudo reboot For clarification or corrections, contact bschonhorst@gmail.com. |