|
Prerequisites: |
FreeBSD (Base + Autoconf, Automake, Bash and GCC) |
Building and Installing a Custom Kernel – Adapted from the FreeBSD Handbook
# Part I. Customize your make.conf (Optional)
vi /etc/make.conf
# Part II. Customize your kernel
# Make sure you have a copy of the kernel source
code! Let's find out:
# Change to the Kernel configuration file directory
cd /usr/src/sys/i386/conf
# If you don't have that directory with code, go get it using
sysinstall tool:
# sysinstall --> configure --> Distributions --> src --> sys
# Make a copy of the GENERIC kernel file
and edit the copy
(Typically copy it to your computer's name)
cd /usr/src/sys/i386/conf
cp GENERIC NMS
# Learn about the hardware found on the
machine you are about to compile (see what was detected etc.)
dmesg | more
# Edit your new configuration file (adds,
removes, comment stuff out etc.)
# Comment (#) out all unwanted options
(refer to kernel config as your guide) example (then save and exit):
# Here are
some options you will need (and want) built-in to your kernel -
Add these:
vi
/usr/src/sys/i386/conf/NMS
# Add this line to the end of /etc/sysctl.conf
vi
/etc/sysctl.conf
# Optional information and examples:
#Here is an example Kernel config from a Dell 670
Setup: 3.8Ghz Zeon, 2GB RAM, 2 SATA Drives, Intel Ethernet
Disabled via BIOS: Sound, Serial, Parallel, USB, Firewire and SCSI
vi /usr/src/sys/i386/conf/NMS
# You can see every possible kernel option (most likely you don't need this) by:
cd /usr/src/sys/i386/conf
make LINT
more /usr/src/sys/i386/conf/LINT
You will need to look through the handbook to understand all those options!
# Prepare your Kernel by using the config command:
/usr/sbin/config NMS
# Change to the newly created config
directory and set the dependencies:
cd ../compile/NMS
make cleandepend
make depend
# Compile the new Kernel
make
# Install the new Kernel only if you
compiled without errors:
make install
#
WARNING: DO NOT
REBOOT YET!
# You need to complete the firewall settings
since your new kernel has a firewall!