# Reading currently running kernel configuration



## pbd (Mar 4, 2009)

Hi!

Is it possible to read configuration options for currently running kernel (without having the configuration file)? I need to find out if kernel was compiled with for example smp option.

Thanks in advance,

pbd


----------



## FBSDin20Steps (Mar 4, 2009)

look here if that is what you are searching for...http://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/kernelconfig.html
SMP is enabled by default in generic


----------



## DutchDaemon (Mar 4, 2009)

In addition to that, there are some commands to find out what's in your kernel:

strings /boot/kernel/kernel
dmesg -a

There's also a kernel option to include the entire kernel config file in the kernel itself, but I'm drawing a pre-coffee blank atm.


----------



## trev (Mar 4, 2009)

```
options INCLUDE_CONFIG_FILE
```


----------



## DutchDaemon (Mar 4, 2009)

Yeah, I knew it was something totally unrecognisable


----------



## pbd (Mar 4, 2009)

trev said:
			
		

> ```
> options INCLUDE_CONFIG_FILE
> ```



Thanks everybody. Where can I find the configuration, if I build kernel with this option? Is it just included in plain text in the kernel file?


----------



## DutchDaemon (Mar 4, 2009)

Yes, *strings* will show it. At the top, I believe.


----------



## vermaden (Mar 4, 2009)

also *kldstat -v*


----------



## Mel_Flynn (Mar 4, 2009)

From sys/conf/NOTES:

```
strings -n3 /boot/kernel/kernel |sed -n 's/^__//p'
```
though, this seems to be broken on my -CURRENT machine.


----------



## fronclynne (Mar 5, 2009)

A simple

```
> kldstat -v
```
will give you an idea of what devices are in the kernel, though if all you really want is to know if smp is on

```
> sysctl kern.smp
kern.smp.forward_roundrobin_enabled: 1
kern.smp.forward_signal_enabled: 1
kern.smp.topology: 0
kern.smp.cpus: 2
kern.smp.disabled: 0
kern.smp.active: 1
kern.smp.maxcpus: 32
kern.smp.maxid: 1
```
should suffice.


----------



## ksb (Jun 15, 2020)

I realize this is a very old thread but a search for finding out if my kernel had the `COMPAT_FREEBSD11` option on led me here. With the hints from above I've found that `sysctl kern.conftxt` yields the complete list of options and devices.


----------



## SirDice (Jun 17, 2020)

ksb said:


> With the hints from above I've found that  sysctl kern.conftxt yields the complete list of options and devices.


Only if the kernel has been compiled with this option:

```
options         INCLUDE_CONFIG_FILE     # Include this file in kernel
```


----------



## Eric A. Borisch (Nov 9, 2021)

SirDice said:


> Only if the kernel has been compiled with this option:
> 
> ```
> options         INCLUDE_CONFIG_FILE     # Include this file in kernel
> ```


Which, for the record, both GENERIC and MINIMAL set. (And has been since 2010 for "all non-embedded platforms".)


----------

