For the complete documentation index, see llms.txt. This page is also available as Markdown.

40.2 FreeBSD Kernel File Structure

FreeBSD kernel configuration options are stored in directories organized by architecture. This section uses the GENERIC file as an example to explain configuration directive syntax.

Kernel Configuration Option Paths

The configuration paths for each architecture are as follows:

Architecture
Path

amd64

sys/amd64/conf

arm64

sys/arm64/conf

RISC-V

sys/riscv/conf

Kernel Configuration File Descriptions (amd64)

The following describes the main kernel configuration files in the freebsd-src/main/sys/amd64/conf directory:

Configuration File
Description

DEFAULTS

The default kernel configuration file for FreeBSD/amd64, serving as the basis for GENERIC and other configurations, with fewer than 30 lines

FIRECRACKER

Kernel configuration file for the Firecracker virtual machine environment

GENERIC

The generic kernel configuration file for FreeBSD/amd64. All amd64 architecture system images are built based on this configuration by default. Approximately 350 lines, suitable for most hardware and use cases

GENERIC-KASAN

For debugging and development. Used for the Kernel Address Sanitizer (KASAN). Fewer than ten lines

GENERIC-KCSAN

For debugging and development. Kernel Concurrency Sanitizer (KCSAN). Over 30 lines

GENERIC-KMSAN

For debugging and development. Used for the Kernel Memory SANitizer (KMSAN). Fewer than ten lines

GENERIC-MMCCAM

For debugging and development. Used to replace the MMC stack with MMCCAM. Fewer than twenty lines

GENERIC-NODEBUG

This file only exists in the main branch and is used for benchmarking. Built from the GENERIC configuration file but removes WITNESS(4) (which tracks locks acquired and released by each thread) and KASSERT(9) (kernel expression verification macro). GENERIC in CURRENT has these debug features enabled by default via the inclusion of std.debug, which impacts system performance. Production environments may consider using this configuration. Over thirty lines

GENERIC.hints

Contains several device.hints(5) parameters for setting driver parameters. Over twenty lines

LINT

Configuration file for kernel compilation integrity checks. Fewer than five lines

LINT-NOINET

LINT variant file, fewer than five lines, disables INET(4)(IPv4)

LINT-NOINET6

LINT variant file, fewer than five lines, disables INET6(4)(IPv6)

LINT-NOIP

LINT variant file, fewer than thirty lines, disables IP protocol-related features (IPv4, IPv6, TLS, etc.)

LINT-NOVIMAGE

For debugging and development. LINT variant file, fewer than five lines, disables VIMAGE(9) (a kernel option based on the VNET(9) network subsystem virtualization infrastructure)

MINIMAL

A commonly used minimal kernel configuration option for FreeBSD/amd64, containing over 160 lines, suitable for resource-constrained environments

MINIMAL-NODEBUG

Functionally equivalent to GENERIC-NODEBUG, but built from the MINIMAL configuration. Fewer than 15 lines

Kernel Option Description Files

In addition to kernel configuration files, there are corresponding description files used to explain various kernel options. These description files are distributed across different architecture and common configuration directories:

Path
Description

sys/amd64/conf/NOTES

Machine-dependent kernel configuration notes for amd64, fewer than 200 lines

sys/x86/conf/NOTES

Machine-dependent kernel configuration notes shared by x86 (amd64 and i386), over 650 lines

sys/arm64/conf/NOTES

Machine-dependent kernel configuration notes for arm64 (aarch64), fewer than 270 lines

sys/riscv/conf/NOTES

Machine-dependent kernel configuration notes for riscv64 (64-bit RISC-V), 100 lines

sys/conf/NOTES

Machine-independent notes, nearly 2900 lines

Directory structure:

Debug Features in CURRENT

FreeBSD-CURRENT (main branch) serves as the development mainline, aiming to provide comprehensive debugging infrastructure to support kernel and driver development and testing. All FreeBSD systems on the main branch (i.e., CURRENT) have debug features enabled by default, and this configuration has a noticeable impact on system performance.

The default kernel GENERIC in CURRENT has all debug features enabled as described in the include "std.debug" file (arm64 specifies this in the file sys/arm64/conf/std.arm64, which is indirectly referenced by GENERIC).

The std.debug file was introduced by sys/amd64/conf: unify MINIMAL and GENERIC debug.

The actual text content of the std.debug file is located at sys/conf/std.debug. At the time of this writing, the std.debug file contains approximately 20 lines.

If you need to disable debug features for higher performance, you can use the GENERIC-NODEBUG configuration, or create a custom configuration file and remove the std.debug reference.

References

Last updated