May 8, 2017

FreeBSD recompile kernel

Download:
ftp://ftp.freebsd.org/pub/FreeBSD/releases/amd64/amd64/10.3-RELEASE/src.txz

untar this to /usr/src

Go to the kernel source directory which contains the configurations.
cd /usr/src/sys/amd64/conf
Create a folder named kernel in the home directory of root user i.e. /root.
mkdir /root/kernels

config -x /root/kernels/MYKERNEL

The above command generates the current configuration of the kernel

Now you can add the options you want to change.

Create a soft link in the /usr/src/sys/amd64/conf named “MYKERNEL” which links to /root/kernels/MYKERNEL file.

ln -s /root/kernels/MYKERNEL

Goto the folder created above.
cd /root/kernels/

To build a file which contains all available options, run the following commands.
cd /usr/src/sys/amd64/conf
make LINT
Goto the main source folder.
cd /usr/src
Build and Install the new kernel with reference from the file “MYKERNEL”.
make buildkernel KERNCONF=MYKERNEL
make installkernel KERNCONF=MYKERNEL
Now reboot the machine to boot into the new kernel you just created now.

use "uname -a" and "sysctl -a" to check


Enable multi routing table in the kernel:
https://www.mmacleod.ca/2011/06/source-based-routing-with-freebsd-using-multiple-routing-table/


No comments:

Post a Comment