<div dir="ltr"><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Nov 12, 2015 at 4:40 PM, Christopher Larson <span dir="ltr">&lt;<a href="mailto:kergoth@gmail.com" target="_blank">kergoth@gmail.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div id=":2d1" class="a3s" style="overflow:hidden">From: Christopher Larson &lt;<a href="mailto:chris_larson@mentor.com">chris_larson@mentor.com</a>&gt;<br>
<br>
Hardcoding a full input path with zero flexibility goes against everything the<br>
Yocto Project is about. Rework it to let the user specify the wks base<br>
filename with WKS_FILE and it&#39;ll search the layers for the wks file and use<br>
it.<br>
<br>
Signed-off-by: Christopher Larson &lt;<a href="mailto:chris_larson@mentor.com">chris_larson@mentor.com</a>&gt;<br>
---<br>
 meta/classes/image_types.bbclass | 22 +++++++++++++++-------<br>
 1 file changed, 15 insertions(+), 7 deletions(-)<br>
<br>
diff --git a/meta/classes/image_types.bbclass b/meta/classes/image_types.bbclass<br>
index 5036919..431df3a 100644<br>
--- a/meta/classes/image_types.bbclass<br>
+++ b/meta/classes/image_types.bbclass<br>
@@ -170,15 +170,23 @@ IMAGE_CMD_ubi () {<br>
<br>
 IMAGE_CMD_ubifs = &quot;mkfs.ubifs -r ${IMAGE_ROOTFS} -o ${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.rootfs.ubifs ${MKUBIFS_ARGS}&quot;<br>
<br>
+WKS_FILE ?= &quot;${FILE_DIRNAME}/${IMAGE_BASENAME}.${MACHINE}.wks&quot;<br>
+WKS_FULL_PATH = &quot;${@bb.utils.which(&#39;${WKS_SEARCH_PATH}&#39;, &#39;${WKS_FILE}&#39;) if not os.path.isabs(&#39;${WKS_FILE}&#39;) else &#39;${WKS_FILE}&#39;}&quot;<br>
+WKS_FULL_PATH[vardepvalue] = &quot;${WKS_FULL_PATH}&quot;<br>
+WKS_SEARCH_PATH ?= &quot;${@&#39;:&#39;.join(&#39;%s/scripts/lib/wic/canned-wks&#39; % l for l in &#39;${BBLAYERS}&#39;.split())}&quot;<br>
+<br>
 IMAGE_CMD_wic () {<br>
-       out=${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}<br>
-       wks=${FILE_DIRNAME}/${IMAGE_BASENAME}.${MACHINE}.wks<br>
-       [ -e $wks ] || wks=${FILE_DIRNAME}/${IMAGE_BASENAME}.wks<br>
-       [ -e $wks ] || bbfatal &quot;Kiskstart file $wks doesn&#39;t exist&quot;<br>
-       BUILDDIR=${TOPDIR} wic create $wks --vars ${STAGING_DIR_TARGET}/imgdata/ -e ${IMAGE_BASENAME} -o $out/<br>
-       mv $out/build/${IMAGE_BASENAME}*.direct $out.rootfs.wic<br>
-       rm -rf $out/<br>
+       out=&quot;${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}&quot;<br>
+       wks=&quot;${WKS_FULL_PATH}&quot;<br>
+       if [ ! -e &quot;$wks&quot; ]; then<br>
+               bbfatal &quot;Kickstart file $wks doesn&#39;t exist&quot;<br>
+       fi<br>
+<br>
+       BUILDDIR=&quot;${TOPDIR}&quot; wic create &quot;$wks&quot; --vars &quot;${STAGING_DIR_TARGET}/imgdata/&quot; -e &quot;${IMAGE_BASENAME}&quot; -o &quot;$out/&quot;<br>
+       mv &quot;$out/build/$(basename &quot;${wks%.wks}&quot;)&quot;*.direct &quot;$out.rootfs.wic&quot;<br>
+       rm -rf &quot;$out/&quot;<br>
 }<br>
+IMAGE_CMD_wic[file-checksums] += &quot;${WKS_FULLPATH}&quot;</div></blockquote></div><br>Gah, I&#39;ll have to fix this and re-submit if needed, the varname is typoed, missing _. Also, it might be worth excluding WKS_FULL_PATH from vardeps entirely -- having to rerun the image build if a layer is moved isn&#39;t ideal, and we already have it in file-checksums. <br>-- <br><div class="gmail_signature"><div dir="ltr">Christopher Larson<br>kergoth at gmail dot com<br>Founder - BitBake, OpenEmbedded, OpenZaurus<br>Maintainer - Tslib<br>Senior Software Engineer, Mentor Graphics</div></div>
</div></div>