This can be done very easy. First of all, you’ll need kernel sources installed, using, of course, sysinstall. You’ll have to get to “Configure” menu, then “Distribution“, then “src” and then you’ll have to check “base” and “sys“.
After all that crap is done, you’ll need to get to /usr/src/sys/i386/conf/ and then copy the default GENERIC configuration to a custom config file, which I called CUSTOM 😛
cp GENERIC CUSTOM
Then you’ll have to edit the CUSTOM file using your favorite editor (nano in my case), and disable everything you don’t need. You can use FreeBSD handbook to see which can be safely disabled and what not.
To compile your custom kernel, using the CUSTOM file, you’ll need to get back to /usr/src folder and run:
make buildkernel KERNCONF=CUSTOM
make installkernel KERNCONF=CUSTOM
..seriously…all done! You have your custom kernel booting up at next reboot. BUT, if you’ll have any problems with booting up this new kernel, like ..kernel panic, well, DON’T PANIC! That’s because there’s an easy way to revert to your old working kernel:
– at boot menu, choose option 6 – “Escape to a loader prompt”
– type unload kernel
– type boot /boot/kernel.old/kernel (after successfully installed a new kernel, the old kernel can be found there)
– you can also check what exactly went wrong (missing module, or whatever) by checking /var/log/messages file.
For safety reasons, there should always be a backup of the GENERIC working kernel in some place like /boot/kernel.working/kernel.