compiling the kernel faster

ray at redshift.com ray at redshift.com
Thu Oct 27 05:14:47 PDT 2005


At 04:54 AM 10/27/2005 -0700, kamal kc wrote:
| hello everybody,
| 
| i am new to kernel programming.
| i am developing a compression/decompression
| functionality in the ip layer.
| 
| i want to compile the kernel faster.
| 
|  it would
| be ok if the kernel doesn't have support for sound
| devices, or other devices like scsi,usb etc. because
| i would be using the compiled kernel for 
| network data compression only. 
| 
| how could i do that. which source files and where in
| the makefiles do i make modifications ????
| 
| thanks for any suggestions
| 
| kamal

Kamal,

  The files you modify to drop stuff out of the kernel are in /sys/i386/conf/
(assuming you are on an Intel platform).  Copy the GENERIC file in there to
something else (e.g DEVKERNEL), then edit that file.  

Comment out any drivers you don't need using # (check your dmesg output when you
boot to see what drivers the OS is loading for your hardware).  Don't comment
out anything unless it's obviously something you don't need - doublt check the
dmesg for stuff like network drivers, hard drive stuff, etc.)

Once you comment out the drivers, you will need to re-compile the kernel.  Go
into /sys/i386/conf/ directory type this:

config DEVKERNEL  (using the example above)

then change into the directory it shows you (should be something like
../compile/DEVKERNEL or something like that) and type this:

make depend && make all install clean

that will compile the new kernel and leave it in /boot/kernel (it will also
backup your old kernel into kernel.old)

go into /boot/kernel/ and type this:

strip -s *

then reboot using shutdown -r now

If all goes well, you should boot to the new kernel.  You can use the uname -a
command to make sure you are on the new kernel okay.  If the machine won't boot,
you can boot into single user mode and copy the old kernel back in place.

An excellent book on the subject is:

Absolute BSD: The Ultimate Guide to FreeBSD (Paperback)

good luck.

Ray





More information about the freebsd-net mailing list