title: Compile a kernel module (error stage 2, MODPOST 0)
body: <p>I'm trying to compile a sample kernel module (test.c) on my Arch linux just typing <em>make</em> in the directory with source and Makefile.</p>
  
  <p>It creates empty folder <em>.tmp_versions</em> and empty files <em>Module.symvers</em> and <em>modules.order</em>, but no <em>.ko</em></p>
  
  <p>I also tried to compile it under virtual machine with Ubuntu, but I have absolutely the same output. Samples were from the Internet (2 ones).</p>
  
  <p>What I should do else to compile it?</p>
  
  <p>Makefile:</p>
  
  <pre><code>obj−m += test.o
  default:
   $(MAKE) -C /lib/modules/$(shell uname -r)/build SUBDIRS=$(PWD) modules
  clean:
   $(MAKE) -C $(KDIR) M=$(PWD) clean
  </code></pre>
  
  <p>But it shows me:</p>
  
  <pre><code>make -C /lib/modules/4.18.14-arch1-1-ARCH/build SUBDIRS=/home/hime/Documents/module modules
  make[1]: Entering directory '/usr/lib/modules/4.18.14-arch1-1-ARCH/build'
  Building modules, stage 2.
  MODPOST 0 modules
  make[1]: Leaving directory '/usr/lib/modules/4.18.14-arch1-1-ARCH/build'
  </code></pre>
  
  <p>or (verbose):</p>
  
  <pre><code>make    -C  "/lib/modules/4.18.14-arch1-1-ARCH/build"   SUBDIRS="/home/hime/Documents/module"   modules V=1
  make[1]: Entering directory '/usr/lib/modules/4.18.14-arch1-1-ARCH/build'
  test -e include/generated/autoconf.h -a -e include/config/auto.conf || (        \
  echo &gt;&amp;2;                           \
  echo &gt;&amp;2 "  ERROR: Kernel configuration is invalid.";       \
  echo &gt;&amp;2 "         include/generated/autoconf.h or include/config/auto.conf are missing.";\
  echo &gt;&amp;2 "         Run 'make oldconfig &amp;&amp; make prepare' on kernel src to fix it.";  \
  echo &gt;&amp;2 ;                          \
  /bin/false)
  mkdir -p /home/hime/Documents/module/.tmp_versions ; rm -f /home/hime/Documents/module/.tmp_versions/*
  make -f ./scripts/Makefile.build obj=/home/hime/Documents/module
  (cat /dev/null; ) &gt; /home/hime/Documents/module/modules.order
  make -f ./scripts/Makefile.modpost
  find /home/hime/Documents/module/.tmp_versions -name '*.mod' | xargs -r grep -h '\.ko$' | sort -u | sed 's/\.ko$/.o/' | scripts/mod/modpost -m -a -i ./Module.symvers -I /home/hime/Documents/module/Module.symvers  -o /home/hime/Documents/module/Module.symvers -S  -w  -s -T -
  make[1]: Leaving directory '/usr/lib/modules/4.18.14-arch1-1-ARCH/build'
  </code></pre>