If your running FreeBSD and need to add something to the kernel this is how its done. We will be adding ipfw firewall in this example:
(Change to the kernel config directory)
# cd /usr/src/sys/i386/conf
(rename the DEFAULT config file to a NEWNAME, For this purpose we will call it WEB)
# cp DEFAULT WEB
(we always want to make sure we dont remove the DEFAULT FILE, incase you need it in the future or want to resort to it for reference, if you mess something up)
(Lets edit the config file now, use edit, pico, vi or any text editor on your machine, for learning purposes I will use pico)
# pico WEB
(Under all the option lines towards the top of the config, add the following lines, OR EDIT the KERNEL)
options IPFIREWALL
options IPFIREWALL_VERBOSE
options IPFIREWALL_VERBOSE_LIMIT=1000
options IPFIREWALL_DEFAULT_TO_ACCEPT
options IPDIVERT
options DUMMYNET
(Now its time to CONFIG the kernel, if this errors please re-edit the config and verify its content you added is correctly added)
# /usr/sbin/config WEB
(Now lets CD to the compiled directory)
# cd ../../compile/WEB
(Ok, ALWAYS do a make depend, dont skip this step a lot of people think its wortless please take the time and run it)
# make depend
# make
(Install the new kernel.)
# make install
(If everything completed there will be NO ERRORS, now reboot the system "reboot", "shutdown -r now kernel update)
Enjoy! and be CAREFULL when editing the kernel
FAQ:
Q: The dir "cd /usr/src/sys/i386/conf" dont exsist?
A: You need to isntall cvsup and sup the src. If you have ports installed, "whereis cvsup". cd to the dir, and make install. Once completed it will create example files, goto the files and edit the proper file usally "stable-supfile". Uncomment the src-all and read the entire configuration file, then run the cvsup program (If you read the config, you will know how to run the cvsup program).
Q: Why does make depend give me errors?
A: Check the content of the file, sometimes you added something that wasn't soposed to be added, remove it and run "make clean" and "make depend", please continue the other steps as well..