News
20th August 2015 | By:

Install custom FreeBSD kernel

Install custom FreeBSD kernel

This is a simple step by step tutorial on how to install a custom kernel on FreeBSD. Basic unix/linux knowledge is required.
Before you start, make sure you have a backup of you data or alternatively you can install a FreeBSD in a virtual machine and just test the whole process there.

By default FreeBSD comes with a GENERIC kernel which should have most of the modules enabled, however in some occasions you need to enable or disable a specific kernel module.

The GENERIC kernel is built from the FreeBSD source code, in order for you to modify it you will need to first download the source code.

Full instructions are available here: https://www.freebsd.org/doc/handbook/svn.html

Step 1
Assuming that the source code of the FreeBSD is setup in /usr/src

cd /usr/src
make buildkernel

Step 2
Find the architecture of your setup and make a copy of GENERIC kernel config file.

uname -m
> amd64
cd /usr/src/sys/amd64/conf
cp GENERIC MYKERNEL1

At this stage you now have an exact copy of the GENERIC kernel file named MYKERNEL1.

Step 3
Edit the MYKERNEL1 file and add your desired options. Make sure you change the “ident”.

Here is an example of a custom option added and also a modified ident.

# ident MYKERNEL1

# CUSTOM Option
options   MAC_PORTACL # Port control

Step 4 Building and installing the custom kernel

cd /usr/src
make buildkernel KERNCONF=MYKERNEL1
make installkernel KERNCONF=MYKERNEL1

The new kernel should be now installed and will be booted once you reboot your system.

reboot
Tags: , ,

Leave a reply

Your email address will not be published. Not now, not ever. Required fields are marked *

Comments


You may use these HTML tags and attributes:

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

Name
Email
Website

This site uses Akismet to reduce spam. Learn how your comment data is processed.