2

I can rm -rf tmp/ sstate-cache/ cache/ 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).

I've tried:

bitbake -c cleansstate linux-iwg15 kernel-module-imx-gpu-viv cryptodev-module

Note: I've also tried cleanall, but it has the same result:

Either one of the kernel modules end up throwing this error once they get to do_compile:

  ERROR: Kernel configuration is invalid.
         include/generated/autoconf.h or include/config/auto.conf are missing.
         Run 'make oldconfig && make prepare' on kernel src to fix it.

The {build_dir}/tmp/work-shared/{MACHINE}/kernel-build-artifacts folder actually contains include/generated/autoconf.h

I tried copying the contents of kernel-build-artifacts to {build_dir}/tmp/work-shared/{MACHINE}/kernel-source but still get the errors.

The linux-iwg15 BitBake recipe is here.

Is there anything else that I should be cleaning before rebuilding the Linux kernel modules?

After a clean build, I did notice that kernel-build-artifacts contains kernel and scripts folders (as well as a symlink of source to ..\kernel-source) that I don't remember being there when attempting to rebuild after running bitbake -c cleansstate.

Christopher Boyd
  • 335
  • 4
  • 10
  • 1
    Check this answer https://stackoverflow.com/a/44585113/795910 . bitback -c cleanall should help you. – Ottavio Campana Apr 26 '19 at 07:43
  • @OttavioCampana Thanks for the response. Unfortunately, as I mentioned, I've tried `bitbake -c cleanall linux-iwg15 kernel-module-imx-gpu-viv cryptodev-module` but still get the same error (it just has the added disadvantage of forcing a re-download of the source for each). – Christopher Boyd Apr 27 '19 at 19:48
  • I see the same problem. If I build from scratch, the modules build cleanly, but if I just try to cleansstate the modules and rebuild, the kernel fails as you say. Have you been able to solve this? – PhilBot Aug 03 '20 at 13:04
  • @PhilBot I haven't been making as many kernel-specific changes recently and I've updated to Yocto 3.1 Dunfell. It does seem like recent Yocto releases have improved the process for rebuilds, so it may be worth trying to use Dunfell if possible. Granted, a lot of BSPs don't provide official support for the most recent release, so I've also been using the "community" version of `meta-freescale` rather than my manufacturer's official BSP which is several years behind. – Christopher Boyd Aug 04 '20 at 18:04

1 Answers1

3

Is there anything else that I should be cleaning before rebuilding the Linux kernel modules?

Yes. bitbake -c cleansstate make-mod-scripts

Any kernel module recipe will contain inherit module. This references meta/classes/module.bbclass which contains inherit module-base. This references meta/classes/module-base.bbclass which contains:

# We do the dependency this way because the output is not preserved
# in sstate, so we must force do_compile to run (once).
do_configure[depends] += "make-mod-scripts:do_compile"

The make-mod-scripts recipe (at meta/recipes-kernel/make-mod-scripts/make-mod-scripts.bb) adds files to the {build_dir}/tmp/work-shared/{MACHINE}/kernel-build-artifacts directory. (This is referenced as STAGING_KERNEL_BUILDDIR which is set in conf/bitbake.conf.)

Unfortunately, the kernel recipe will remove everything in the STAGING_KERNEL_BUILDDIR directory, since that directory is added to the do_shared_workdir[cleandirs] variable in meta/classes/kernel.bbclass. This ends up removing files that make-mod-scripts put there as well.

kroylar
  • 126
  • 1
  • 9
  • 1
    You're welcome! This is actually a bug so I also submitted a bug report and it looks like its targeted to be fixed soon. https://bugzilla.yoctoproject.org/show_bug.cgi?id=14317 – kroylar Mar 25 '21 at 19:04