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?

  • 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, 2014 at 15:49

2 Answers 2


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 http://wiki.centos.org/HowTos/I_need_the_Kernel_Source

  • 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, 2014 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, 2014 at 16:25
  • 1
    @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, 2014 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.

  • 1
    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. Aug 31, 2015 at 2:28

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .