auto-generating kernel .config files?

Alexander E. Patrakov patrakov at
Mon Oct 31 03:52:48 PST 2005

John Gay wrote:
> I just had a quick thought and since this list has the best and most helpful 
> programmer I know, I thought I toss it around and see what you think.
> Many distro's now have pretty good auto-detect features and can detect most 
> hardware and load the appropriate modules. Yet, most people like to build 
> their own kernels tuned to their hardware without a lot of extra cruft.
> Shouldn't it be possible to boot with a generic kernel, scan the system logs 
> and create a basic kernel .config file based on the hardware present in the 
> system? Now I don't expect it to be compete, or even useable directly, but it 
> could reduce the amount of searching and guessing when you do generate your 
> kernel .config. 
> I've read many articles on kernel configuring, but they all suffer from the 
> fact that there's just too many possible variations to cover everything.
> Just a thought.

One could just rely upon hardware detection programs, and then make the 
list of modules that are actually loaded after this (with lsmod). Then 
map the module names to CONFIG_* parameters. Then  merge that with 
CONFIG_*=y in /proc/config.gz.

The second task is what's non-trivial. The idea is to search for 
statements like "obj-$(CONFIG_AGP_INTEL) += intel-agp.o", so that if 
intel.agp.ko is loaded, then you want to define CONFIG_AGP_INTEL=m 
(beware of false positives, e.g. for cdrom.ko).

Alexander E. Patrakov

More information about the lfs-chat mailing list