CONFIG(8)

πŸ“¦
version 15.1 Β· 2 versions
, in freebsd 15.1, nixpkgs unstable

πŸ’… CONFIG(8) β€” like, the whole manual page, bestie

okay so real quick β€” this is the config page from section 8 of the System Manager's Manual, and it's genuinely one of those "quietly runs everything" tools. bucket get it.


✨ NAME ✨

config β€” builds system configuration files πŸ› οΈ


🌸 SYNOPSIS 🌸

config [-CVgpv] [-I path] [-d destdir] [-s srcdir] SYSTEM_NAME
config [-x kernel]

πŸŽ€ DESCRIPTION πŸŽ€

So config takes the file SYSTEM_NAME β€” which is literally the file describing the system you're trying to configure β€” and builds a whole set of system configuration files out of it. iconic behaviour honestly.

Then there's a second file that tells config which files are needed to generate a system, and that one can be augmented by a configuration-specific set of files that give alternate files for a specific machine (peep the β€œFILES” section below, iykyk πŸ‘€).

Here's everything it takes β€” options and operands, no skips:

  • -V β€” prints the config version number. cute little flex.
  • -C β€” if INCLUDE_CONFIG_FILE is present in a configuration file, the kernel image will contain the full configuration files included literally (preserving comments). heads up though: this flag is kept for backward compatibility. legacy queen πŸ’€
  • -I path β€” searches in path for any file included by the include directive. and yes bestie, you can pass this more than once. stack 'em.
  • -d destdir β€” uses destdir as the output directory instead of the default one. ⚠️ important: config does not append SYSTEM_NAME to the directory you give it. so like, don't expect it to.
  • -s srcdir β€” uses srcdir as the source directory instead of the default one.
  • -m β€” prints the MACHINE and MACHINE_ARCH values for this kernel and exits. in and out, no small talk.
  • -g β€” configures a system for debugging. we love a debugging moment.
  • -x kernel β€” prints the kernel configuration file embedded into a kernel file. this only makes sense if the options INCLUDE_CONFIG_FILE entry was present in your configuration file. no entry, no dice.
  • -v β€” turns on verbose output. yap mode: enabled πŸ—£οΈ
  • SYSTEM_NAME β€” specifies the name of the system configuration file containing device specifications, configuration options and other system parameters for one system configuration. that's the main character argument.

Right, so where do you run this? config should be run from the conf subdirectory of the system source β€” usually /sys/ARCH/conf β€” where ARCH represents one of the architectures supported by FreeBSD.

The utility creates the directory ../compile/SYSTEM_NAME, or the one you gave it with -d, as necessary, and places all the output files there. the output of config is a number of files; for the i386, they are: Makefile, used by make(1) in building the system, and header files β€” definitions of the number of various devices that will be compiled into the system. πŸ“βœ¨

config looks for kernel sources in the directory ../.., or the one given with the -s option.

after running config, you have to run make depend in the directory where the new makefile was created. config prints a reminder of this when it completes, so don't say nobody told you 🫢

And if config throws any other error messages? fix the problems in the configuration file and run config again. attempts to compile a system that had configuration errors are likely to fail β€” like, likely fail. don't do that to yourself 😭


πŸ¦‹ DEBUG KERNELS πŸ¦‹

okay history lesson, buckle up. traditional BSD kernels are compiled without symbols, because of the heavy load on the system when compiling a β€œdebug” kernel. a debug kernel contains complete symbols for all the source files, and lets an experienced kernel programmer analyse the cause of a problem. the debuggers available prior to 4.4BSD-Lite could find some information from a normal kernel; gdb(1) (ports/devel/gdb) provides very little support for normal kernels, so a debug kernel is needed for any meaningful analysis. no cap.

for reasons of history, time and space, building a debug kernel is not the default with FreeBSD. here's the receipts:

  • a debug kernel takes up to 30% longer to build ⏳
  • and requires about 30 MB of disk storage in the build directory, compared to about 6 MB for a non-debug kernel
  • a debug kernel is about 11 MB in size, compared to about 2 MB for a non-debug kernel
  • this space is used both in the root file system and at run time in memory πŸ’€

use the -g option to build a debug kernel. with this option, config causes two kernel files to be built in the kernel build directory:

  • kernel.debug is the complete debug kernel. the full deluxe edition πŸ‘‘
  • kernel is a copy of the kernel with the debug symbols stripped off. this is equivalent to the normal non-debug kernel.

there is currently little sense in installing and booting from a debug kernel, since the only tools available which use the symbols do not run on-line. so you've got two options for installing a debug kernel:

  • β€œmake install” installs kernel in the root file system.
  • β€œmake install.debug” installs kernel.debug in the root file system.

pick your fighter πŸ₯Š


πŸ“‚ FILES πŸ“‚

  • /sys/conf/files β€” list of common files system is built from
  • /sys/conf/Makefile.ARCH β€” generic makefile for the ARCH
  • /sys/conf/files.ARCH β€” list of ARCH specific files
  • /sys/ARCH/compile/SYSTEM_NAME β€” default kernel build directory for system SYSTEM_NAME on ARCH.

πŸ‘€ SEE ALSO πŸ‘€

  • config(5)
  • The β€œSYNOPSIS” portion of each device in section 4.
  • S. J. Leffler and M. J. Karels, β€œBuilding 4.3 BSD UNIX System with Config”, 4.4BSD System Manager's Manual (SMM).

⭐ HISTORY ⭐

config appeared in 4.1BSD. ancestor behaviour fr.

before support for -x was introduced, options INCLUDE_CONFIG_FILE included the entire configuration file that used to be embedded in the new kernel. this meant strings(1) could be used to extract it from a kernel. to extract the configuration information, you had to use this command:

strings -n 3 kernel | sed -n 's/^___//p'

look at that little pipeline. vintage πŸ“


πŸ’€ BUGS πŸ’€

the line numbers reported in error messages are usually off by one. that's it, that's the bug. not me getting gaslit by an off-by-one πŸ˜­πŸ™ˆ


okay that's the whole page, bestie β€” every flag, every path, every number, every bug, preserved and slayed. this one's from the Debian crew, dated April 9, 2021, and it's the CONFIG(8) page from the System Manager's Manual. mwah πŸ’–

πŸ“¦ where this page comes from