> For the complete documentation index, see [llms.txt](https://book.bsdcn.org/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://book.bsdcn.org/ask/flat/chapter-40-freebsd-kernel-architecture/di-40.2-jie-freebsd-nei-he-wen-jian-jie-gou.md).

# 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](https://github.com/freebsd/freebsd-src/tree/main/sys/amd64/conf) |
| arm64        | [sys/arm64/conf](https://github.com/freebsd/freebsd-src/tree/main/sys/arm64/conf) |
| RISC-V       | [sys/riscv/conf](https://github.com/freebsd/freebsd-src/tree/main/sys/riscv/conf) |

## Kernel Configuration File Descriptions (amd64)

The following describes the main kernel configuration files in the [freebsd-src/main/sys/amd64/conf](https://github.com/freebsd/freebsd-src/tree/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](https://github.com/freebsd/freebsd-src/blob/main) branch and is used for benchmarking. Built from the GENERIC configuration file but removes [WITNESS(4)](https://man.freebsd.org/cgi/man.cgi?query=witness\&sektion=4) (which tracks locks acquired and released by each thread) and [KASSERT(9)](https://man.freebsd.org/cgi/man.cgi?query=KASSERT\&sektion=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)](https://man.freebsd.org/cgi/man.cgi?query=device.hints\&sektion=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](https://github.com/freebsd/freebsd-src/blob/main/sys/amd64/conf/NOTES) | Machine-dependent kernel configuration notes for amd64, fewer than 200 lines                |
| [sys/x86/conf/NOTES](https://github.com/freebsd/freebsd-src/blob/main/sys/x86/conf/NOTES)     | Machine-dependent kernel configuration notes shared by x86 (amd64 and i386), over 650 lines |
| [sys/arm64/conf/NOTES](https://github.com/freebsd/freebsd-src/blob/main/sys/arm64/conf/NOTES) | Machine-dependent kernel configuration notes for arm64 (aarch64), fewer than 270 lines      |
| [sys/riscv/conf/NOTES](https://github.com/freebsd/freebsd-src/blob/main/sys/riscv/conf/NOTES) | Machine-dependent kernel configuration notes for riscv64 (64-bit RISC-V), 100 lines         |
| [sys/conf/NOTES](https://github.com/freebsd/freebsd-src/blob/main/sys/conf/NOTES)             | Machine-independent notes, nearly 2900 lines                                                |

Directory structure:

```sh
sys/
├── amd64/
│   └── conf/
│       ├── DEFAULTS
│       ├── FIRECRACKER
│       ├── GENERIC
│       ├── GENERIC-KASAN
│       ├── GENERIC-KCSAN
│       ├── GENERIC-KMSAN
│       ├── GENERIC-MMCCAM
│       ├── GENERIC-NODEBUG
│       ├── GENERIC.hints
│       ├── LINT
│       ├── LINT-NOINET
│       ├── LINT-NOINET6
│       ├── LINT-NOIP
│       ├── LINT-NOVIMAGE
│       ├── MINIMAL
│       ├── MINIMAL-NODEBUG
│       └── NOTES
├── x86/
│   └── conf/
│       └── NOTES
├── arm64/
│   └── conf/
│       └── NOTES
├── riscv/
│   └── conf/
│       └── NOTES
└── conf/
    ├── NOTES
    └── std.debug
```

## 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](https://github.com/freebsd/freebsd-src/blob/main/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](https://github.com/freebsd/freebsd-src/pull/1124).

The actual text content of the `std.debug` file is located at [sys/conf/std.debug](https://github.com/freebsd/freebsd-src/blob/main/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

* Firecracker\[EB/OL]. \[2026-03-26]. <https://firecracker-microvm.github.io>; amd64: Add FIRECRACKER kernel configuration\[EB/OL]. \[2026-03-26]. <https://reviews.freebsd.org/D36672>.
* amd64: Add MD bits for KASAN\[EB/OL]. \[2026-03-26]. <https://reviews.freebsd.org/D29455>.
* kasan(9)\[EB/OL]. \[2026-03-26]. <https://man.freebsd.org/cgi/man.cgi?query=kasan&sektion=9>.
* KMSAN(9)\[EB/OL]. \[2026-03-26]. <https://man.freebsd.org/cgi/man.cgi?query=kmsan&sektion=9>.
* Port the NetBSD KCSAN runtime to FreeBSD\[EB/OL]. \[2026-03-26]. <https://reviews.freebsd.org/D22315>.
* MMC stack on top of CAM framework\[EB/OL]. \[2026-03-26]. <https://reviews.freebsd.org/D4761>.
* Eliminate building LINT makefiles\[EB/OL]. \[2026-03-26]. <https://reviews.freebsd.org/D26540>.
* sys: add LINT-NOVIMAGE\[EB/OL]. \[2026-03-26]. <https://reviews.freebsd.org/D50780>.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://book.bsdcn.org/ask/flat/chapter-40-freebsd-kernel-architecture/di-40.2-jie-freebsd-nei-he-wen-jian-jie-gou.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
