title: How to do a clean rebuild of Linux kernel modules in Yocto?
body: <p>I can <code>rm -rf tmp/ sstate-cache/ cache/</code> and run a whole Yocto build from scratch just fine, but I'd rather not rebuild everything (especially as packages like Qt can take some time).</p>
  
  <p>I've tried: </p>
  
  <p><code>bitbake -c cleansstate linux-iwg15 kernel-module-imx-gpu-viv cryptodev-module</code></p>
  
  <p>Note: I've also tried <code>cleanall</code>, but it has the same result:</p>
  
  <p>Either one of the kernel modules end up throwing this error once they get to <code>do_compile</code>:</p>
  
  <pre><code>  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.
  </code></pre>
  
  <p>The <code>{build_dir}/tmp/work-shared/{MACHINE}/kernel-build-artifacts</code> folder actually contains <code>include/generated/autoconf.h</code></p>
  
  <p>I tried copying the contents of <code>kernel-build-artifacts</code> to <code>{build_dir}/tmp/work-shared/{MACHINE}/kernel-source</code> but still get the errors.</p>
  
  <p>The <code>linux-iwg15</code> BitBake recipe is <a href="https://github.com/cpboyd/meta-iwave/blob/thud/recipes-kernel/linux/linux-iwg15_4.14.78.bb" rel="nofollow noreferrer">here</a>.</p>
  
  <p>Is there anything else that I should be cleaning before rebuilding the Linux kernel modules?</p>
  
  <p>After a clean build, I did notice that <code>kernel-build-artifacts</code> contains <code>kernel</code> and <code>scripts</code> folders (as well as a symlink of <code>source</code> to <code>..\kernel-source</code>) that I don't remember being there when attempting to rebuild after running <code>bitbake -c cleansstate</code>.</p>