Reading currently running kernel configuration

pbd

Active Member

Thanks: 33
Messages: 199

#1
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

Thanks: 2,718
Messages: 11,257

#3
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.
 

DutchDaemon

Administrator
Staff member
Administrator
Moderator
Developer

Thanks: 2,718
Messages: 11,257

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

pbd

Active Member

Thanks: 33
Messages: 199

#6
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?
 

Mel_Flynn

Well-Known Member

Thanks: 81
Messages: 379

#9
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

Thanks: 175
Messages: 1,296

#10
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