If you want to compile a kernel module with the new 2.6.18 kernel, you may encounter this error message:

user$ ...
linux/config.h: No such file or directory

This may happen even if you have your kernel headers installed (having your whole kernel sources won’t help either). This is because the module you’re trying to build requires the linux/config.h file, which has been deprecated for some time now, and has been removed from the kernel tree since 2.6.18. There are a couple of solutions to this problem :

* 1) Recreate the linux/config.h file in your kernel tree. It’s just 4 lines long:

#ifndef _LINUX_CONFIG_H
#define _LINUX_CONFIG_H
#include <linux/autoconf.h>
#endif

The location of this file is, under Fedora Core, is something like /usr/src/kernels//include/linux/config.h.

* 2) Modify the source files of the module you’re trying to compile and replace any

#include <linux/config.h>

occurence by:

#include <linux/autoconf.h>

* 3) Modify the makefile to use the -imacros command line options, and remove each linux/config.h references in the source files. This is supposed to be the right thing to do, but you may prefer using one of the two first solutions: the latest is just the one that should be used by the actual kernel module developers.