Reading currently running kernel configuration

pbd

Active Member

Reaction score: 33
Messages: 199

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
 

DutchDaemon

Administrator
Staff member
Administrator
Moderator
Developer

Reaction score: 2,767
Messages: 11,277

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.
 
Reactions: pbd

DutchDaemon

Administrator
Staff member
Administrator
Moderator
Developer

Reaction score: 2,767
Messages: 11,277

Yeah, I knew it was something totally unrecognisable ;)
 
OP
OP
P

pbd

Active Member

Reaction score: 33
Messages: 199

trev said:
Code:
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

Administrator
Staff member
Administrator
Moderator
Developer

Reaction score: 2,767
Messages: 11,277

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

Mel_Flynn

Well-Known Member

Reaction score: 81
Messages: 379

From sys/conf/NOTES:
Code:
strings -n3 /boot/kernel/kernel |sed -n 's/^__//p'
though, this seems to be broken on my -CURRENT machine.
 

fronclynne

Daemon

Reaction score: 175
Messages: 1,296

A simple
Code:
> 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
Code:
> 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.
 
Top