Is there a neat way of stripping the Linux kernel to only support the devices that are currently in use. After NVIDIA complaining about GCC version mismatch, I decided to recompile the kernel with the current version of GCC. Now, since it is known which modules the current kernel actually uses, can I automatically generate a .config file which is customized for this machine. That would booth save some space and time. Something like

lsmod [options] | sed [a good regexp] > .config

1 Answer 1


That's what make localmodconfig is for.

Excerpt from /usr/src/linux/README:

"make localmodconfig" Create a config based on current config and
                      loaded modules (lsmod). Disables any module
                      option that is not needed for the loaded modules.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .