title: Compile Linux Kernel Module - Cannot build simple kernel module
body: <p>I'm trying to compile a kernel module driver but I get the following errors: (the operation generate some files, but not a &quot;.ko&quot; file)</p>
  <pre><code>make -C /lib/modules/5.16.0-kali7-amd64/build M=/home/z3r0/Scrivania/kernel_modules/start_stop modules
  make[1]: ingresso nella directory «/usr/src/linux-headers-5.16.0-kali7-amd64»
  /bin/sh: 1: /usr/src/linux-headers-5.16.0-kali7-common/scripts/pahole-flags.sh: not found
  
    ERROR: Kernel configuration is invalid.
           include/generated/autoconf.h or include/config/auto.conf are missing.
           Run 'make oldconfig &amp;&amp; make prepare' on kernel src to fix it.
  
  make[1]: *** [/usr/src/linux-headers-5.16.0-kali7-common/Makefile:751: include/config/auto.conf] Errore 1
  make[1]: uscita dalla directory «/usr/src/linux-headers-5.16.0-kali7-amd64»
  make: *** [Makefile:3: all] Errore 2
  </code></pre>
  <p>When I try to execute &quot;make oldconfig &amp;&amp; make prepare&quot; I get the following error:</p>
  <pre><code>/bin/sh: 1: /usr/src/linux-headers-5.16.0-kali7-common/scripts/pahole-flags.sh: not found
    GEN     Makefile
  /bin/sh: 1: /usr/src/linux-headers-5.16.0-kali7-common/scripts/pahole-flags.sh: not found
  /usr/src/linux-headers-5.16.0-kali7-common/scripts/Makefile.build:44: /usr/src/linux-headers-5.16.0-kali7-common/scripts/basic/Makefile: File o directory non esistente
  make[1]: ***  Nessuna regola per generare l'obiettivo «/usr/src/linux-headers-5.16.0-kali7-common/scripts/basic/Makefile».  Arresto.
  make: *** [/usr/src/linux-headers-5.16.0-kali7-common/Makefile:566: scripts_basic] Errore 2
  </code></pre>
  <p>The file is really simple (hello_world.c):</p>
  <pre><code>#include &lt;linux/module.h&gt;
  #include &lt;linux/kernel.h&gt;
  #include &lt;linux/init.h&gt;
  
  static int __init hello_start(void)
  {
      printk(KERN_INFO &quot;Loading hello module...\n&quot;);
      printk(KERN_INFO &quot;Hello world\n&quot;);
      return 0;
  }
  
  static void __exit hello_end(void)
  {
      printk(KERN_INFO &quot;Goodbye Mr.\n&quot;);
  }
  
  module_init(hello_start);
  module_exit(hello_end);
  </code></pre>
  <p>makefile:</p>
  <pre><code>obj-m = foo.o
  KVERSION = $(shell uname -r)
  all:
      make -C /lib/modules/$(KVERSION)/build M=$(PWD) modules
  clean:
      make -C /lib/modules/$(KVERSION)/build M=$(PWD) clean
  </code></pre>
  <p>Can someone explain where is the error? Thank you</p>