Compiling Statically Linked Kernel

Dear All,

I was wondering if it's possible to compile a FreeBSD kernel that is statically linked (i.e., all device drivers and modules are compiled into the kernel as opposed to being loaded dynamically).

I've assumed that listing devices in the kernel configuration file compiles the device driver as a separate, dynamically loadable module. Is this assumption incorrect?

Thanks in advance for any advice,

-- John T.
 
Anything that can exist as a loadable kernel module is first compiled as a module. Listing a driver in the kernel configuration file then causes it to be linked statically into the kernel binary and it can not be unloaded at run time. If you want a monolithic kernel that doesn't need loadable modules you just list all needed drivers in the configuration file.
 
criswell said:
I've assumed that listing devices in the kernel configuration file compiles the device driver as a separate, dynamically loadable module. Is this assumption incorrect?
It's the other way around. Anything that is not in the kernel configuration file is compiled as a module.
 
SirDice said:
It's the other way around. Anything that is not in the kernel configuration file is compiled as a module.

Just a curiosity: this also means that the whole code base is compiled (either as module or statically), and therefore the only way to avoid the compilation of an unwanted and unused feature is to remove the code from the codebase?
 
Back
Top