There would be many obsolote images under the deploy/images if we build the project many times, e.g.: 1.5G core-image-sato-sdk-qemumips-20130308094505.rootfs.ext3 248M core-image-sato-sdk-qemumips-20130308094505.rootfs.tar.bz2 1.5G core-image-sato-sdk-qemumips-20130320102143.rootfs.ext3 248M core-image-sato-sdk-qemumips-20130320102143.rootfs.tar.bz2 1.5G core-image-sato-sdk-qemumips-20130321070044.rootfs.ext3 248M core-image-sato-sdk-qemumips-20130321070044.rootfs.tar.bz2 1.5G core-image-sato-sdk-qemumips-20130322111701.rootfs.ext3 248M core-image-sato-sdk-qemumips-20130322111701.rootfs.tar.bz2 1.5G core-image-sato-sdk-qemumips-20130402095142.rootfs.ext3 248M core-image-sato-sdk-qemumips-20130402095142.rootfs.tar.bz2 1.5G core-image-sato-sdk-qemumips-20130402123337.rootfs.ext3 248M core-image-sato-sdk-qemumips-20130402123337.rootfs.tar.bz2 They would use much disk space when time goes on. I think that we can add a configure variable to remove them, e.g.: RM_OLD_IMAGE = "1" (defult "0") We have a symlink links to the previous current image, we can use "read link -f symlink" to remove the *old* image before we symlink the new image. The affected files might be: (from a rough investigation) bootimg.bbclass image.bbclass image_types.bbclass image-vmdk.bbclass boot-directdisk.bbclass
This should be part of the cleanup-workdir instead and not part of the bbclass files.
(In reply to comment #1) > This should be part of the cleanup-workdir instead and not part of the > bbclass files. Hi Saul, thanks for your suggestion, but it seems that it is easy to use and implement if we do it in image_types.bbclass, here is the draft patch: diff --git a/meta-yocto/conf/local.conf.sample.extended b/meta-yocto/conf/local.conf.sample.extended index d0dff80..a7979e1 100644 --- a/meta-yocto/conf/local.conf.sample.extended +++ b/meta-yocto/conf/local.conf.sample.extended @@ -211,3 +211,6 @@ # Put the following two lines in the conf file with intact. #ARCHIVER_CLASS = "${@'archive-${ARCHIVER_MODE}-source' if ARCHIVER_MODE != 'none' else ''}" #INHERIT += "${ARCHIVER_CLASS}" + +# Remove the obsolete image before the new one generated to save disk sapce +#RM_OBSOLETE_IMAGE = "1" diff --git a/meta/classes/image_types.bbclass b/meta/classes/image_types.bbclass index 94837ae..27f232e 100644 --- a/meta/classes/image_types.bbclass +++ b/meta/classes/image_types.bbclass @@ -51,7 +51,11 @@ def get_imagecmds(d): types.remove("live") if d.getVar('IMAGE_LINK_NAME', True): - cmds += "\trm -f ${DEPLOY_DIR_IMAGE}/${IMAGE_LINK_NAME}.*" + if d.getVar('RM_OBSOLETE_IMAGE', True) == "1": + # Remove the obsolete image + cmds += "\trm -f `find ${DEPLOY_DIR_IMAGE} -maxdepth 1 -type l -name ${IMAGE_LINK_NAME}'.*' -exec readlink -f {} \;`" + # Remove the symlink + cmds += "\n\trm -f ${DEPLOY_DIR_IMAGE}/${IMAGE_LINK_NAME}.*" for type in types: ccmd = [] If we do it in the cleanup-workdir script, we need consider which files should be kept when different archs and image recipes have been built, and we need to add an option for it to cleanup the DEPLOY_DIR_IMAGE directory rather than the work dir.
Merged into master: http://git.yoctoproject.org/cgit/cgit.cgi/poky/commit/?id=c51e8b4532361b11fe73c28613653c0f5aaf566b
No, not merged, it is in review.
Merged into master: http://git.yoctoproject.org/cgit/cgit.cgi/poky/commit/?id=0948a237ddfcd92dcc4a21e238a963568161f12d http://git.yoctoproject.org/cgit/cgit.cgi/poky/commit/?id=995c196f98bf3a85e73f4981cfeeacfb5b84330e
verified in yocto 1.5 master git rev: 676fd3f394a0c0576b63c77ed2184bf5f42c29b6 Test step: 1.build any type of image in poky 2.change ${POKY}/build/conf/local.conf add line: RM_OLD_IMAGE = 1 3.re-build image again 4.Last build in ${POKY}/build/tmp/deploy/images/ should be deleted