Full clean build in Yocto Project

In Yocto, bitbake is used to build the recipes. For the full clean build, it needs to rebuild all recipes from scratch.
To make a full clean build in Yocto you can follow these steps:

  1. Remove the sstate cache directory

    Bitbake uses sstate cache to determine which recipes need to rebuild.

    # Delete sstate cache direcotry
    $ rm -rf sstate-cache/
  2. Delete tmp directory

    This is the output directory and bitbake generate the final image in this directory

    # Delete tmp direcotry
    $ rm -rf tmp/
  3. Run bitbake command

    Now, we are ready to start a full clean build in Yocto.

    # Run bitbake
    $ bitbake core-image-minimal

Clean build in Yocto


Note: It will take a few hours to build the image depending on the number of CPU cores and the number of parallel threads is set.


Bitbake cleanall command

Cleanall command removes recipes output files, sstate-cache and download files. so that bitbake rebuild recipe from scratch

#for complete clean the recipe
$ bitbake -fc cleanall <recipe_name>


Bitbake clean command

Clean command deleted output files from the tmp directory.

# clean the output of the recipe
$ bitbake -c clean <recipe_name>

Add comment

Security code