Since wic image creation will temporarily update rootfs/etc/fstab (*temporarily* means the fstab will be recovered after wic image creation), there is still racing risk during the temporarily time for other image creation (such as tar, ext)
Make a copy of rootfs(as rootfs_wic), and create wic image based on the copy. Signed-off-by: Hongxu Jia <[email protected]> --- meta/classes/image_types_wic.bbclass | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/meta/classes/image_types_wic.bbclass b/meta/classes/image_types_wic.bbclass index f350dc2..2a93143 100644 --- a/meta/classes/image_types_wic.bbclass +++ b/meta/classes/image_types_wic.bbclass @@ -26,15 +26,20 @@ def wks_search(files, search_path): WIC_CREATE_EXTRA_ARGS ?= "" IMAGE_CMD_wic () { + [ -d "${IMAGE_ROOTFS}_wic" ] && rm -rf "${IMAGE_ROOTFS}_wic" + # Refer oe.path.copytree(src, dst): ${WORKDIR}/rootfs -> ${WORKDIR}/rootfs_wic + mkdir -p "${IMAGE_ROOTFS}_wic" + tar --xattrs --xattrs-include="*" -cf - -S -C "${IMAGE_ROOTFS}" -p . | tar --xattrs --xattrs-include="*" -xf - -C "${IMAGE_ROOTFS}_wic" + out="${IMGDEPLOYDIR}/${IMAGE_NAME}" wks="${WKS_FULL_PATH}" if [ -z "$wks" ]; then bbfatal "No kickstart files from WKS_FILES were found: ${WKS_FILES}. Please set WKS_FILE or WKS_FILES appropriately." fi - BUILDDIR="${TOPDIR}" wic create "$wks" --vars "${STAGING_DIR}/${MACHINE}/imgdata/" -e "${IMAGE_BASENAME}" -o "$out/" ${WIC_CREATE_EXTRA_ARGS} + BUILDDIR="${TOPDIR}" wic create "$wks" --vars "${STAGING_DIR}/${MACHINE}/imgdata/" -e "${IMAGE_BASENAME}" -r "${IMAGE_ROOTFS}_wic" -o "$out/" ${WIC_CREATE_EXTRA_ARGS} mv "$out/$(basename "${wks%.wks}")"*.direct "$out${IMAGE_NAME_SUFFIX}.wic" - rm -rf "$out/" + rm -rf "$out/" "${IMAGE_ROOTFS}_wic" } IMAGE_CMD_wic[vardepsexclude] = "WKS_FULL_PATH WKS_FILES TOPDIR" -- 2.7.4 -- _______________________________________________ Openembedded-core mailing list [email protected] http://lists.openembedded.org/mailman/listinfo/openembedded-core
