summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaul Barker <pbarker@konsulko.com>2020-01-08 11:25:45 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2020-01-10 21:18:22 +0000
commitab6e8dae1e9e3c96cd003b21825df61f553ebdc8 (patch)
tree2b6954248343fcbd7fe71dd4fd033e0fd7965020
parent4ea31c2ea45ef00754871a17ed7f5705d36f7cc1 (diff)
downloadpoky-ab6e8dae1e9e3c96cd003b21825df61f553ebdc8.tar.gz
wic: Preserve intermediate files
When debugging issues or trying to add new features in wic it's useful to examine the intermediate files created by the tool such as images of the individual partitions. Previously these files were created in a subdirectory of IMGDEPLOYDIR and, deleted by wic itself and then the working subdirectory completely removed at the end of IMAGE_CMD_wic. Instead we should work in a staging directory named build-wic and leave behind intermediate files for analysis if necessary. This has the added benefit of allowing individual partition images to be preserved by adding commands to IMAGE_CMD_wic_append() in an image recipe if needed. This is useful where an update system requires exact sized and pre-formatted partition images for deployment. (From OE-Core rev: 07b6b284204e912b5d08bdd0ca51b766ab7dd9c1) Signed-off-by: Paul Barker <pbarker@konsulko.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r--meta/classes/image_types_wic.bbclass7
-rw-r--r--scripts/lib/wic/plugins/imager/direct.py4
2 files changed, 5 insertions, 6 deletions
diff --git a/meta/classes/image_types_wic.bbclass b/meta/classes/image_types_wic.bbclass
index 7d5ebe1cb0..fc9b106a9a 100644
--- a/meta/classes/image_types_wic.bbclass
+++ b/meta/classes/image_types_wic.bbclass
@@ -27,16 +27,17 @@ WIC_CREATE_EXTRA_ARGS ?= ""
27 27
28IMAGE_CMD_wic () { 28IMAGE_CMD_wic () {
29 out="${IMGDEPLOYDIR}/${IMAGE_NAME}" 29 out="${IMGDEPLOYDIR}/${IMAGE_NAME}"
30 build_wic="${WORKDIR}/build-wic"
30 wks="${WKS_FULL_PATH}" 31 wks="${WKS_FULL_PATH}"
31 if [ -z "$wks" ]; then 32 if [ -z "$wks" ]; then
32 bbfatal "No kickstart files from WKS_FILES were found: ${WKS_FILES}. Please set WKS_FILE or WKS_FILES appropriately." 33 bbfatal "No kickstart files from WKS_FILES were found: ${WKS_FILES}. Please set WKS_FILE or WKS_FILES appropriately."
33 fi 34 fi
34 35
35 BUILDDIR="${TOPDIR}" wic create "$wks" --vars "${STAGING_DIR}/${MACHINE}/imgdata/" -e "${IMAGE_BASENAME}" -o "$out/" ${WIC_CREATE_EXTRA_ARGS} 36 BUILDDIR="${TOPDIR}" wic create "$wks" --vars "${STAGING_DIR}/${MACHINE}/imgdata/" -e "${IMAGE_BASENAME}" -o "$build_wic/" ${WIC_CREATE_EXTRA_ARGS}
36 mv "$out/$(basename "${wks%.wks}")"*.direct "$out${IMAGE_NAME_SUFFIX}.wic" 37 mv "$build_wic/$(basename "${wks%.wks}")"*.direct "$out${IMAGE_NAME_SUFFIX}.wic"
37 rm -rf "$out/"
38} 38}
39IMAGE_CMD_wic[vardepsexclude] = "WKS_FULL_PATH WKS_FILES TOPDIR" 39IMAGE_CMD_wic[vardepsexclude] = "WKS_FULL_PATH WKS_FILES TOPDIR"
40do_image_wic[cleandirs] = "${WORKDIR}/build-wic"
40 41
41# Rebuild when the wks file or vars in WICVARS change 42# Rebuild when the wks file or vars in WICVARS change
42USING_WIC = "${@bb.utils.contains_any('IMAGE_FSTYPES', 'wic ' + ' '.join('wic.%s' % c for c in '${CONVERSIONTYPES}'.split()), '1', '', d)}" 43USING_WIC = "${@bb.utils.contains_any('IMAGE_FSTYPES', 'wic ' + ' '.join('wic.%s' % c for c in '${CONVERSIONTYPES}'.split()), '1', '', d)}"
diff --git a/scripts/lib/wic/plugins/imager/direct.py b/scripts/lib/wic/plugins/imager/direct.py
index 2441cc33ad..c50645ff76 100644
--- a/scripts/lib/wic/plugins/imager/direct.py
+++ b/scripts/lib/wic/plugins/imager/direct.py
@@ -580,9 +580,7 @@ class PartitionedImage():
580 self.native_sysroot) 580 self.native_sysroot)
581 581
582 def cleanup(self): 582 def cleanup(self):
583 # remove partition images 583 pass
584 for image in set(self.partimages):
585 os.remove(image)
586 584
587 def assemble(self): 585 def assemble(self):
588 logger.debug("Installing partitions") 586 logger.debug("Installing partitions")