YOCTO project clean

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

YOCTO project clean

Jump to solution
117,551 Views
JHY
Contributor IV

How can I clean YOCTO build directory?

I tried 'bitbake -c cleanall core-image-minimal' but it has no effect.

Labels (1)
Tags (2)
1 Solution
39,586 Views
Pavel
NXP Employee
NXP Employee

Look at the following page for “clean” commands of the YOCTO.

http://www.freescale.com/infocenter/index.jsp?topic=%2FQORIQSDK%2F3069691.html

The YOCTO deploy directory often contains the “README_-_DO_NOT_DELETE_FILES_IN_THIS_DIRECT” file.

This file contains the following:

Files in the deploy directory will not be re-created automatically if you delete them. If you do delete a file, you will need to run:

bitbake -c clean TARGET

bitbake TARGET

where TARGET is the name of the appropriate package or target e.g.

"virtual/kernel" for the kernel, an image, etc.


Have a great day,

Pavel

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

View solution in original post

0 Kudos
5 Replies
39,586 Views
leoschwab
Contributor III

Welcome to Yocto.  Here's your bottle of whiskey and Advil...

So.  When you say bitbake core-image-minimal, the dependencies required to build that system image are recursively discovered and built.  However, when you want to clean things out, the same recursion doesn't take place.  Only the package you explicitly name gets cleaned.  So all bitbake core-image-minimal -c clean -f will actually clean is the working directory where the system image was built.  All the rest of the stuff -- the kernel, the shell commands, the compilers used to build everything -- stays around.

So, alas, the question needs to be asked:  What do you want to clean out, and why?

If you want to clean out intermediate build products for the target just to recover disk space, you can delete those directories by hand.  From the build directory:

rm -fr tmp/work

If you want to clean out the various host-side tools:

rm -fr tmp/sysroots

If you want to clean out all the accumulated system images (because they're big and take a lot of space):

rm -fr tmp/deploy/images

If you want to clean out a particular component so it will get rebuilt:

bitbake <component> -c clean -f

If you think the build and/or download caches are corrupt and want bitbake to forget everything it thinks it knows about a component so it can be rebuilt from scratch:

bitbake <component> -c cleanall -f

12,531 Views
amcelroy
Contributor I

Stumbled on this thread using Yocto on a Toradex board with an iMX8X in early 2023 and your advice for completely cleaning out the Yocto build was very helpful after all these years. Thank you internet stranger.

0 Kudos
39,587 Views
daiane_angolini
NXP Employee
NXP Employee

See here Yocto Project Reference Manual  to understand the difference between clean and cleanall

"clean the build" folder is a trick question. What do you really mean?

If you want to get rid of a build folder, only rm -rf that folder and start over.

If you want to clean only one package, like a make clean stuff, the -c clean would be enough.

If you want to free HDD space, rm -rf tmp folder. The tmp folder is ~temporary~ and will be recreated during next build, and this way you remove useless big sdcard images you may have

Remember, the build/conf directory will be deleted in case you delete build directory, if you use local.conf during development, please, backup it.

39,587 Views
Pavel
NXP Employee
NXP Employee

Look at the following page for “clean” commands of the YOCTO.

http://www.freescale.com/infocenter/index.jsp?topic=%2FQORIQSDK%2F3069691.html

The YOCTO deploy directory often contains the “README_-_DO_NOT_DELETE_FILES_IN_THIS_DIRECT” file.

This file contains the following:

Files in the deploy directory will not be re-created automatically if you delete them. If you do delete a file, you will need to run:

bitbake -c clean TARGET

bitbake TARGET

where TARGET is the name of the appropriate package or target e.g.

"virtual/kernel" for the kernel, an image, etc.


Have a great day,

Pavel

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos
39,587 Views
saurabh206
Senior Contributor III

Hi

JHY

you can try bitbake -c cleanall -f core-image-minimal

Thanks

Saurabh

0 Kudos