Luckily I found a script by Steven Rostedt that did
almost what was needed – it did the hard part of mapping from module names to config settings –
and I adapted it to buildin_used_mods.pl (local copy). Run this at
the root of your kernel tree; it will write the new .config to stdout.
really nice script