Compiling kernel
cd /usr/src/sys/i386/conf cp GENERIC MYKERNEL # Edit MYKERNEL with a text editor. e.g adding ipfw support, add the followings: options QUOTA options IPFIREWALL options IPFIREWALL_VERBOSE options IPFIREWALL_VERBOSE_LIMIT=1000 options IPFIREWALL_FORWARD # SMP options SMP options APIC_IO # on freebsd 7, already in GENERIC config options SMP device apic
Build and install
cd /usr/src make buildkernel KERNCONF=MYKERNEL make installkernel KERNCONF=MYKERNEL
The new kernel will be copied to the /boot/kernel directory as /boot/kernel/kernel and the old kernel will be moved to /boot/kernel.old/kernel. Reboot to use the new kernel. If your new kernel does not boot, choose the kernel you want to boot from at the FreeBSD boot loader. You can access this when the system boot menu appears. Select the “Escape to a loader prompt” option, number six. At the prompt, type unload kernel and then type boot /boot/kernel.old/kernel.
Rolling back to previous kernel
at the boot prompt, do theseok unload ok boot kernel.old
Then if your box is not in secure mode, you can do these to rename /kernel.old to /kernel:
# check securelevel
sysctl kern.securelevel
# remove secure flag
chflags noschg /kernel
# rename the kernel and modules
mv kernel.old kernel
mv modules.old modules
sysctl kern.securelevel
# remove secure flag
chflags noschg /kernel
# rename the kernel and modules
mv kernel.old kernel
mv modules.old modules
There are no comments on this page. [Add comment]