The directory recipe-sysroot-native takes 200MB+ disk space, I find it exists in every WORKDIR
and I think they all have the save contents. It's a waste of disk space to have so many copies, and it may slow down the build time. Could it just be placed in a fixed place and every WORKDIR
accesss it through symbol link??
As mentioned here in staging.bbclass, the files in recipe-sysroot
and recipe-sysroot-native
are not copies always. Yocto tries to create hard links to actual file (i.e. only increasing the reference count to the file).
So all the files in recipe-sysroot
and recipe-sysroot-native
are hard links referring to one source file in your disk. So there isn't any duplicate space occupied on your disk.
Here you can see the actual implementation of the staging.bbclass
where it tries to create hard links and if not allowed, then it makes a copy.
You can always check it using ls -i
to see the reference count of the files.
Below text is copied from yocto mega meanual,
The second stage addresses recipes that want to use something from another recipe and declare a dependency on that recipe through the DEPENDS variable. The recipe will have a do_prepare_recipe_sysroot task and when this task executes, it creates the recipe-sysroot and recipe-sysroot-native in the recipe work directory (i.e. WORKDIR). The OpenEmbedded build system creates hard links to copies of the relevant files from sysroots-components into the recipe work directory.
Note: If hard links are not possible, the build system uses actual copies.