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. 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. If a mistake is made in the configuration, simply boot the previous version of the 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, when running low on disk space, there are different options to reduce the size of /boot/kernel/.

To not install the symbol files, make sure the following line exists 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:

  • This line does not exist in the kernel configuration file:

    makeoptions DEBUG=-g
  • Do not run config(8) with -g.

Either of the above settings will cause the kernel to be built in debug mode.

To build and install only the specified modules, list them in /etc/make.conf:

MODULES_OVERRIDE= accf_http ipfw

Replace accf_httpd ipfw with a list of needed modules. Only the listed modules will be built. This reduces the size of the kernel directory and decreases the amount of time needed to build the kernel. For more information, read /usr/share/examples/etc/make.conf.

Unneeded devices can be removed from the kernel to further reduce the size. See Q: 7.1 for more information.

To put any of these options into effect, follow the instructions to build and install the 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:

  • The source tree is different from the one used to build the currently running system. When attempting an upgrade, read /usr/src/UPDATING, paying particular attention to the COMMON ITEMS section at the end.

  • The make buildkernel command did not complete successfuly. The make buildkernel target relies on files generated by the make buildworld target to complete its job correctly.

  • Even when building FreeBSD-STABLE, it is possible that the source tree was fetched at a time when it was either being modified or it was broken. Only releases are guaranteed to be buildable, although FreeBSD-STABLE builds fine the majority of the time. Try re-fetching the source tree and see if the problem goes away. Try using a different mirror in case the previous one is having problems.

7.4.

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.

All FreeBSD documents are available for download at http://ftp.FreeBSD.org/pub/FreeBSD/doc/

Questions that are not answered by the documentation may be sent to <[email protected]>.
Send questions about this document to <[email protected]>.