How to configure a Linux kernel based on the modules currently in use?

Solution 1:

If you're using Linux 2.6.32 and above, you may want to check out the "localmodconfig" make target. It does pretty much what you ask—it determines what modules you have running, and generates a .config making sure those modules are built. The "localyesconfig" target will compile those modules statically into the kernel rather than creating modules.

More info available here: Easy local kernel configuration.