20th August 2015 by aegeuana_sjp_admin

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:
Step 1
Assuming that the source code of the FreeBSD is setup in /usr/src
[code language=”bash”]
cd /usr/src
make buildkernel
Step 2
Find the architecture of your setup and make a copy of GENERIC kernel config file.
[code language=”bash”]
uname -m
> amd64
cd /usr/src/sys/amd64/conf
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.
[code language=”bash”]
# 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.
[code language=”bash”]

Leave a Reply

Your email address will not be published. Required fields are marked *