RSS feed

FreeBSD Custom Kernel

January 11th, 2010 | Posted in FreeBSD | No Comments

The following document describes how to build a custom kernel in FreeBSD.

This tutorial is NOT for upgrading your kernel, if you want to upgrade your kernel please read this tutorial.

1) Make a copy of your GENERIC kernel (never use GENERIC unless you want your changes wasted when you do a cvsup update)
root@machine# cd /usr/src/sys/i386/conf
root@machine# cp GENERIC CUSTOMEKERNEL

2. Edit the CUSTOMKERNEL to configure support for new hardware. Make sure all the required modules are loaded. If a dependancy is missing, your kernel build will fail.

3. Compile and install your new kernel.

root@machine# cd /usr/src
root@machine# make buildkernel KERNCONF=CUSTOMKERNEL
root@machine# make installkernel KERNCONF=CUSTOMKERNEL

4. Reboot and you have a fully customised kernel build.

* If you are running your system in securelevel you will need to make some changes before doing the actual kernel installation! In your /etc/rc.conf set kern_securelevel to kern_securelevel=”-1″ and reboot your machine, then proceed with the install of your custom kernel. After your custom kernel has been installed you can change the values back to whatever your requirements are.

* By doing a “make clean” on every kernel build defeats the purpose of a makefile. There are times when the build should be cleaned up, you can do it by doing a “make clean” or “config -r” to clean up obj. By doing it every time may make your kernel build run twice as long and it’s not necesary!



No Comments to “FreeBSD Custom Kernel”

There are no comments yet, add one below.


Leave a Comment






Categories