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

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. Either:

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


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

2) Or modify the source files of the module you’re trying to compile and replace any occurence of:




3) Or modify the makefile to use the -imacros command line option, 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.