Kernel 2.6.18 linux/config.h problem
Post
Cancel

Kernel 2.6.18 linux/config.h problem

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

1
2
...
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:

1
2
3
4
5
#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/<kernelversion>/include/linux/config.h.

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

1
2
#include
<linux/config.h>

by:

1
2
#include
<linux/autoconf.h>

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.

This post is licensed under CC BY 4.0 by the author.