Search code examples
yoctobitbakeimx8

Unable to get source files


I am using imx8mnevk and I was trying to rebuild an image and removed the tmp directory.

I ran bitbake core-image-minimal but now the tmp directory doesn't seem to have a work-shared folder that is supposed to have all the source files.

I want to modify device tree but cant seem to find where they are located.

Is there a way to get the sources again or do I need to redo everything?


Solution

  • Try to avoid making any modifications within the tmp directory (it's named tmp because it's internal & temporary). Specifically, avoid making source code changes there because they may get overwritten during future builds, and in some cases Yocto will fail to detect modified code under tmp and won't actually do what you expect.

    Instead, use devtool to extract and modify the source code for a package. For example:

    devtool modify virtual/kernel
    

    This will extract the kernel source into a workspace directory, and override the kernel recipe to use that source.

    You can modify that source, build, and once you're happy with your changes, devtool has some commands that automatically capture your changes as a patch file and generate a .bbappend file in your chosen layer.

    Check out Using devtool to Patch the Kernel in Yocto's kernel development guide for tips.

    In your case, I suspect the work-shared directory didn't reappear because Yocto was able to use the sstate-cache (which is outside tmp) to deliver the core-image-minimal recipe from cache, without needing to rebuild the kernel.