Chapter 7 Kernel Configuration

7.1. I would like to customize my kernel. Is it difficult?
7.2. Why is my kernel so big?
7.3. Why does every kernel I try to build fail to compile, even GENERIC?
7.4. How can I verify which scheduler is in use on a running system?
7.5. What is kern.sched.quantum?

7.1. I would like to customize my kernel. Is it difficult?

Not at all! Check out the kernel config section of the Handbook.

Note: The new kernel will be installed to the /boot/kernel directory along with its modules, while the old kernel and its modules will be moved to the /boot/kernel.old directory, so if you make a mistake the next time you play with your configuration you can boot the previous version of your kernel.

7.2. Why is my kernel so big?

GENERIC kernels shipped with FreeBSD and later are compiled in debug mode. Kernels built in debug mode contain many symbols in separate files that are used for debugging, thus greatly increasing the size of /boot/kernel/. Note that there will be little or no performance loss from running a debug kernel, and it is useful to keep one around in case of a system panic.

However, if you are running low on disk space, there are different options to reduce the size of /boot/kernel/.

If you do not want the symbol files to be installed, make sure you have the following line present in /etc/src.conf:

WITHOUT_KERNEL_SYMBOLS=yes

For more information see src.conf(5).

If you do not want to build a debug kernel, make sure that both of the following are true:

  • You do not have a line in your kernel configuration file that reads:

    makeoptions DEBUG=-g
    
  • You are not running config(8) with -g.

Either of the above settings will cause your kernel to be built in debug mode. As long as you make sure you follow the steps above, you can build your kernel normally.

If you want only the modules you use to be built and installed, make sure you have a line like below in /etc/make.conf:

MODULES_OVERRIDE= accf_http ipfw

Replace accf_httpd ipfw with a list of modules you need. Only these modules will be built. This does not only reduce the size of the kernel directory but also decreases the amount of time needed to build your kernel. For more information see /usr/share/examples/etc/make.conf.

You can also remove unneeded devices from your kernel to further reduce the size. See Q: 7.1. for more information.

To put any of these options into effect you will have to build and install your new kernel.

Most kernels (/boot/kernel/kernel) tend to be around 12 MB to 16 MB.

7.3. Why does every kernel I try to build fail to compile, even GENERIC?

There are a number of possible causes for this problem. They are, in no particular order:

  • You are not using the make buildkernel and make installkernel targets, and your source tree is different from the one used to build the currently running system (e.g., you are compiling 9.1-RELEASE on a 8.3-RELEASE system). If you are attempting an upgrade, please read /usr/src/UPDATING, paying particular attention to the “COMMON ITEMS” section at the end.

  • You are using the make buildkernel and make installkernel targets, but you failed to assert the completion of the make buildworld target. The make buildkernel target relies on files generated by the make buildworld target to complete its job correctly.

  • Even if you are trying to build FreeBSD-STABLE, it is possible that you fetched the source tree at a time when it was either being modified, or broken for other reasons; only releases are absolutely guaranteed to be buildable, although FreeBSD-STABLE builds fine the majority of the time. If you have not already done so, try re-fetching the source tree and see if the problem goes away. Try using a different server in case the one you are using is having problems.

7.4. How can I verify which scheduler is in use on a running system?

The name of the scheduler currently being used is directly available as the value of the kern.sched.name sysctl:

% sysctl kern.sched.name
kern.sched.name: ULE

7.5. What is kern.sched.quantum?

kern.sched.quantum is the maximum number of ticks a process can run without being preempted in the 4BSD scheduler.