Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

We're trying to build a piece of software that demands the kernel source, not just the headers. So we downloaded the kernel source via the centos src rpm.

However the autoconf.h is missing.

We tried

  • Put the .config in place (copied the one from /boot).

  • run make oldconfig

So what is creating the autoconf.h file? Do we actually have to build the kernel?

share|improve this question
In case someone is using Kconfig as build architecture for a project not related to Linux, the answer to this question is a bit different: to generate autoconf.h you need ./kconfig-frontends/frontends/conf/conf --silentoldconfig Kconfig – Étienne Aug 14 '14 at 15:49
up vote 5 down vote accepted

The file include/generated/autoconf.h is generated in the make prepare step. If you are trying to build a kernel module, you will also need the make scripts step:

gunzip < /proc/config.gz > .config
make oldconfig
make prepare
make scripts

Usually the kernel is accompied with a headers package, have you tried installing that first? For CentOS, try installing the kernel-devel package. Details can be found on

share|improve this answer
Thanks! Yes, we had the headers package installed, but for some reasons the configure script was demanding the full source. We used the wiki page you linked. – Stefan Jan 20 '14 at 16:22
Just for completeness: on CentOS the kernel config is located in /boot (compare with uname -r to select the right one). – Stefan Jan 20 '14 at 16:25
@Stefan On some distros (like Arch Linux) it is located in /lib/modules/$(uname -r)/build/.config (build usually symlinks to /usr/src/linux-$(uname -r)), others use /boot/config-$(uname -r) (such as Ubuntu, Debian and apparently CentOS). If enabled during compilation, it is also available from /proc/config.gz. – Lekensteyn Jan 20 '14 at 19:56

The file autoconf.h is automatically generated during the build process from the .conf file. Many kernel source files use autoconf.h.

share|improve this answer
Welcome to Server Fault! We prefer additional answers to address the question in a way that previous answers did not, or provide a better solution. – Falcon Momot Aug 31 '15 at 2:28

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.