summaryrefslogtreecommitdiff
path: root/meta
diff options
context:
space:
mode:
authorChristopher Larson <chris_larson@mentor.com>2015-11-10 14:18:20 -0700
committerRichard Purdie <richard.purdie@linuxfoundation.org>2015-11-24 15:49:30 +0000
commit8cc7f5229f5447c2183ac319dd52c7ed737ec89b (patch)
treed64b429d8c8a6b8485688ed9efa67e4d2528c0cc /meta
parentf18a917c1493d4107c7f9db1d9ba19ec368f9b48 (diff)
downloadopenembedded-core-8cc7f5229f5447c2183ac319dd52c7ed737ec89b.tar.gz
openembedded-core-8cc7f5229f5447c2183ac319dd52c7ed737ec89b.tar.bz2
openembedded-core-8cc7f5229f5447c2183ac319dd52c7ed737ec89b.zip
image_types: improve wks path specification
Hardcoding a full input path with zero flexibility goes against everything the Yocto Project is about. Rework it to let the user specify the wks base filename with WKS_FILE and it'll search the layers for the wks file and use it. Signed-off-by: Christopher Larson <chris_larson@mentor.com> Signed-off-by: Ross Burton <ross.burton@intel.com>
Diffstat (limited to 'meta')
-rw-r--r--meta/classes/image_types.bbclass36
1 files changed, 29 insertions, 7 deletions
diff --git a/meta/classes/image_types.bbclass b/meta/classes/image_types.bbclass
index 50369197c5..afe8d0cd8f 100644
--- a/meta/classes/image_types.bbclass
+++ b/meta/classes/image_types.bbclass
@@ -170,15 +170,37 @@ IMAGE_CMD_ubi () {
IMAGE_CMD_ubifs = "mkfs.ubifs -r ${IMAGE_ROOTFS} -o ${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.rootfs.ubifs ${MKUBIFS_ARGS}"
+WKS_FILE ?= "${IMAGE_BASENAME}.${MACHINE}.wks"
+WKS_FILES ?= "${WKS_FILE} ${IMAGE_BASENAME}.wks"
+WKS_SEARCH_PATH ?= "${THISDIR}:${@':'.join('%s/scripts/lib/wic/canned-wks' % l for l in '${BBPATH}:${COREBASE}'.split(':'))}"
+WKS_FULL_PATH = "${@wks_search('${WKS_FILES}'.split(), '${WKS_SEARCH_PATH}') or ''}"
+
+def wks_search(files, search_path):
+ for f in files:
+ if os.path.isabs(f):
+ if os.path.exists(f):
+ return f
+ else:
+ searched = bb.utils.which(search_path, f)
+ if searched:
+ return searched
+
IMAGE_CMD_wic () {
- out=${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}
- wks=${FILE_DIRNAME}/${IMAGE_BASENAME}.${MACHINE}.wks
- [ -e $wks ] || wks=${FILE_DIRNAME}/${IMAGE_BASENAME}.wks
- [ -e $wks ] || bbfatal "Kiskstart file $wks doesn't exist"
- BUILDDIR=${TOPDIR} wic create $wks --vars ${STAGING_DIR_TARGET}/imgdata/ -e ${IMAGE_BASENAME} -o $out/
- mv $out/build/${IMAGE_BASENAME}*.direct $out.rootfs.wic
- rm -rf $out/
+ out="${DEPLOY_DIR_IMAGE}/${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_TARGET}/imgdata/" -e "${IMAGE_BASENAME}" -o "$out/"
+ mv "$out/build/$(basename "${wks%.wks}")"*.direct "$out.rootfs.wic"
+ rm -rf "$out/"
}
+IMAGE_CMD_wic[vardepsexclude] = "WKS_FULL_PATH WKS_FILES"
+
+# Rebuild when the wks file changes
+USING_WIC = "${@bb.utils.contains_any('IMAGE_FSTYPES', 'wic ' + ' '.join('wic.%s' % c for c in '${COMPRESSIONTYPES}'.split()), '1', '', d)}"
+do_rootfs[file-checksums] += "${@'${WKS_FULL_PATH}:%s' % os.path.exists('${WKS_FULL_PATH}') if '${USING_WIC}' else ''}"
EXTRA_IMAGECMD = ""