User Tools

Site Tools


archive:freebsd_compile_kernel

How To Compile A 64 Bit Kernel On FreeBSD

Note: This guide will build in some core firewall options into the kernel. The kernel name SCULLY is an example, this can be anything.

cd /usr/src/sys/amd64/conf
cp GENERIC OKINAWA
vi OKINAWA

Change the Identity i.e. name from GENERIC to something else. Kernel names are always written in capital letters.

ident           GENERIC

To for example

ident           OKINAWA

Add or remove functionality to the kernel. Here we are adding some core firewall functionality. Add the following.

options         ALTQ                    # Required For Alternate Queuing
options         ALTQ_CBQ                # Class Bases Queuing (CBQ)
options         ALTQ_RED                # Random Early Detection (RED)
options         ALTQ_RIO                # RED In/Out
options         ALTQ_HFSC               # Hierarchical Packet Scheduler (HFSC)
options         ALTQ_PRIQ               # Priority Queuing (PRIQ)
options         ALTQ_NOPCC              # Required for SMP build

# Pf support
device          pf
device          pflog
device          pfsync

Kompile the new kernel.

cd /usr/src
make buildkernel KERNCONF=OKINAWA
make installkernel KERNCONF=OKINAWA
reboot now

Notes on VMware: In order to get VMXNET3 working the following line should be added to your kernel. If the line is allready present you are good if not add it and recompile your kernel. As of FreeBSD 10.x this should not be necessary.

# VMware support
device          vmx                     # VMware VMXNET3 Ethernet

Next install VMware tools by following this guide Installing VMware Tools On FreeBSD

Notes on Xen: In order to get better performance while running on Cirtix Xen it is recomended to compile a Xen Aware kernel i.e XENHVM this will add PV drivers improving performance, etc. Check your kernel configuration file and look for the following lines if they are present you are good to go if not add them and recompile your kernel. As of FreeBSD 10.x this should not be necessary.

# NOTE: XENHVM depends on xenpci.  They must be added or removed together.
options         XENHVM                  # Xen HVM kernel infrastructure
device          xenpci                  # Xen HVM Hypervisor services driver
archive/freebsd_compile_kernel.txt · Last modified: 24/11/2023 12:25 by Allan