Yocto中sstate-cache目录应该如何删除?
How should the sstate-cache directory be deleted in Yocto?
我的 YoctoProject "fido" 环境的 sstate-cache
目录的大小超过 3GB。
如何删除yocto/build-dir
中的sstate-cache
目录?
是用rm -rf
保存还是有其他方法?
正确的任务是:
$ bitbake -c cleansstate <recipe-name>
还有更多清理任务,会删除 sstate 缓存甚至更多(例如 do_cleanall
)。
根据 Yocto 参考手册,删除完整的 build/tmp
目录是安全的,包括 sstate-cache
目录:
As a last resort, to clean up a build and start it from scratch
(other than the downloads), you can remove everything in the tmp
directory or get rid of the directory completely. If you do, you
should also completely remove the build/sstate-cache directory.
(see [1] and [2])
此外,您可以通过调用 do_cleansstate
为特定配方删除带有 bitbake
的 sstate-cache,如下所示(参见 do_cleansstate)。
$ bitbake -c cleansstate recipe
请注意,共享状态缓存需要大量内存,并且它会再次增长到构建图像所需的大小。
有关共享状态缓存的更多详细信息,请参阅 Yocto 参考手册的以下部分:
Shared State Cache and sstate-cache.
我将减少sstate缓存大小的命令加粗了;这是清理缓存的另一种方法。
https://old.yoctoproject.org/sites/default/files/yocto_devday_advanced_class_sandiego.pdf 幻灯片 37
Sstate: recommendations
• In complex systems it is recommended to separate sstate directories,
for example native and non-native sstate directories, and also
different BSPs and arches.
• Reusing a single directory will grow very large very quickly. Use atime to delete old files. Note: this requires the filesystem mounted
with atime/relatime which we normally recommend to disable for build
performance.
find ${sstate_dir} -name 'sstate*' -atime +3 -delete
• Rebuild sstate to new directory periodically and delete old sstate
dir to maintain bounded size. There may be packages or package
versions that are no longer used and just take up space.
• Although it is possible to use other protocols for the sstate such
as HTTP and FTP, you should avoid these. Using HTTP limits the sstate
to read-only and FTP provides poor performance.
• Additionally, a missing sstate file on http/ftp server cause wget to
hang for a long time due to the retries and timeout
删除 sstate-cache 目录是安全的,但是减小其大小的正确方法是使用 poky/scripts/sstate-cache-management.sh
中的脚本,该脚本将删除旧条目。参见 https://git.yoctoproject.org/cgit.cgi/poky/plain/scripts/sstate-cache-management.sh
您可以从构建中删除 sstate-cache,最常见的原因是,随着为每个构建添加越来越多的缓存数据,它会不断增长。有一个简单的清理方法,如下:
./scripts/sstate-cache-management.sh --remove-duplicated -d --cache-dir=<path to sstate-cached>
这将从缓存中删除重复的旧数据。
注意:当我们需要从头开始重建时,我们要么删除构建/
tmp 以便我们可以使用 sstate-cache 来加速构建或者我们
删除 build/tmp 和 sstate-cache 以便没有缓存
在构建期间重复使用。
我的 YoctoProject "fido" 环境的 sstate-cache
目录的大小超过 3GB。
如何删除yocto/build-dir
中的sstate-cache
目录?
是用rm -rf
保存还是有其他方法?
正确的任务是:
$ bitbake -c cleansstate <recipe-name>
还有更多清理任务,会删除 sstate 缓存甚至更多(例如 do_cleanall
)。
根据 Yocto 参考手册,删除完整的 build/tmp
目录是安全的,包括 sstate-cache
目录:
As a last resort, to clean up a build and start it from scratch (other than the downloads), you can remove everything in the tmp directory or get rid of the directory completely. If you do, you should also completely remove the build/sstate-cache directory. (see [1] and [2])
此外,您可以通过调用 do_cleansstate
为特定配方删除带有 bitbake
的 sstate-cache,如下所示(参见 do_cleansstate)。
$ bitbake -c cleansstate recipe
请注意,共享状态缓存需要大量内存,并且它会再次增长到构建图像所需的大小。
有关共享状态缓存的更多详细信息,请参阅 Yocto 参考手册的以下部分: Shared State Cache and sstate-cache.
我将减少sstate缓存大小的命令加粗了;这是清理缓存的另一种方法。
https://old.yoctoproject.org/sites/default/files/yocto_devday_advanced_class_sandiego.pdf 幻灯片 37
Sstate: recommendations
• In complex systems it is recommended to separate sstate directories, for example native and non-native sstate directories, and also different BSPs and arches.
• Reusing a single directory will grow very large very quickly. Use atime to delete old files. Note: this requires the filesystem mounted with atime/relatime which we normally recommend to disable for build performance.
find ${sstate_dir} -name 'sstate*' -atime +3 -delete
• Rebuild sstate to new directory periodically and delete old sstate dir to maintain bounded size. There may be packages or package versions that are no longer used and just take up space.
• Although it is possible to use other protocols for the sstate such as HTTP and FTP, you should avoid these. Using HTTP limits the sstate to read-only and FTP provides poor performance.
• Additionally, a missing sstate file on http/ftp server cause wget to hang for a long time due to the retries and timeout
删除 sstate-cache 目录是安全的,但是减小其大小的正确方法是使用 poky/scripts/sstate-cache-management.sh
中的脚本,该脚本将删除旧条目。参见 https://git.yoctoproject.org/cgit.cgi/poky/plain/scripts/sstate-cache-management.sh
您可以从构建中删除 sstate-cache,最常见的原因是,随着为每个构建添加越来越多的缓存数据,它会不断增长。有一个简单的清理方法,如下:
./scripts/sstate-cache-management.sh --remove-duplicated -d --cache-dir=<path to sstate-cached>
这将从缓存中删除重复的旧数据。
注意:当我们需要从头开始重建时,我们要么删除构建/ tmp 以便我们可以使用 sstate-cache 来加速构建或者我们 删除 build/tmp 和 sstate-cache 以便没有缓存 在构建期间重复使用。