Tuesday, October 20, 2009

Building Custom Kernel for a General Server in FreeBSD




The easiest way to to compile a system kernel is by installing source through running sysinstall as root then choose Configure -> Distribution -> Src and Choose only base and sys


Once the source is installed



Lets make customization to our kernel for this we will not modify the GENERIC options files instead lets copy it to another location and link it here and make all necessary modifications


#cd/usr/src/sys/i386/conf


#mkdir /root/kernel


#cp GENERIC /root/kernel/CUSTKERNL


#ln -s /root/kernel/CUSTKERNL


Open the file and make all necessary modifications


#vi CUSTKERNL



Below is the kernel options file I used while compiling for my squid proxy ( yeah I know its not perfect, but any suggestions are always welcome)



Ok done with customizing your kernel config?


Lets start the roll


First Lets Move to /usr/src directory

# cd /usr/src

Then issue the make command to build the kernel

#make -j4 buildkernel KERNCONF=CUSTKERNL


Q. why j?


A. Why not j? when I have a quad core system at my disposal why should I take a nap after giving make buildkernel command??


Ok Now its time to grab a coffee and snacks and watch some soccer on tv or browse some crap in net


Did you get the # prompt without any error? Then You are with me on right path


Lets install the kernel!!


#make -j4 installkernel KERNCONF=CUSTKERNL


Whoa!!!!!! Thats all it takes


Now if this is not exactly you got on ur screen then  google is ur friend :) or leave me a comment and I will try to get back to you.

So thats all for for
Just my 2 cents to compiling kernel under freebsd 7.2




No comments:

Post a Comment