diff options
author | Christopher Larson <chris_larson@mentor.com> | 2015-11-10 14:18:20 -0700 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2015-11-24 15:50:28 +0000 |
commit | 76d2e46211faa51b1e7853481aaa6e49d26e89f9 (patch) | |
tree | 6908d8c83ae81f15a4d6a840cc15c68ddc73fa26 | |
parent | 70ae7a67168dd81447430dd29737e02360a4bcbf (diff) | |
download | poky-76d2e46211faa51b1e7853481aaa6e49d26e89f9.tar.gz |
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.
(From OE-Core rev: 8cc7f5229f5447c2183ac319dd52c7ed737ec89b)
Signed-off-by: Christopher Larson <chris_larson@mentor.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r-- | meta/classes/image_types.bbclass | 36 |
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 () { | |||
170 | 170 | ||
171 | IMAGE_CMD_ubifs = "mkfs.ubifs -r ${IMAGE_ROOTFS} -o ${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.rootfs.ubifs ${MKUBIFS_ARGS}" | 171 | IMAGE_CMD_ubifs = "mkfs.ubifs -r ${IMAGE_ROOTFS} -o ${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.rootfs.ubifs ${MKUBIFS_ARGS}" |
172 | 172 | ||
173 | WKS_FILE ?= "${IMAGE_BASENAME}.${MACHINE}.wks" | ||
174 | WKS_FILES ?= "${WKS_FILE} ${IMAGE_BASENAME}.wks" | ||
175 | WKS_SEARCH_PATH ?= "${THISDIR}:${@':'.join('%s/scripts/lib/wic/canned-wks' % l for l in '${BBPATH}:${COREBASE}'.split(':'))}" | ||
176 | WKS_FULL_PATH = "${@wks_search('${WKS_FILES}'.split(), '${WKS_SEARCH_PATH}') or ''}" | ||
177 | |||
178 | def wks_search(files, search_path): | ||
179 | for f in files: | ||
180 | if os.path.isabs(f): | ||
181 | if os.path.exists(f): | ||
182 | return f | ||
183 | else: | ||
184 | searched = bb.utils.which(search_path, f) | ||
185 | if searched: | ||
186 | return searched | ||
187 | |||
173 | IMAGE_CMD_wic () { | 188 | IMAGE_CMD_wic () { |
174 | out=${DEPLOY_DIR_IMAGE}/${IMAGE_NAME} | 189 | out="${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}" |
175 | wks=${FILE_DIRNAME}/${IMAGE_BASENAME}.${MACHINE}.wks | 190 | wks="${WKS_FULL_PATH}" |
176 | [ -e $wks ] || wks=${FILE_DIRNAME}/${IMAGE_BASENAME}.wks | 191 | if [ -z "$wks" ]; then |
177 | [ -e $wks ] || bbfatal "Kiskstart file $wks doesn't exist" | 192 | bbfatal "No kickstart files from WKS_FILES were found: ${WKS_FILES}. Please set WKS_FILE or WKS_FILES appropriately." |
178 | BUILDDIR=${TOPDIR} wic create $wks --vars ${STAGING_DIR_TARGET}/imgdata/ -e ${IMAGE_BASENAME} -o $out/ | 193 | fi |
179 | mv $out/build/${IMAGE_BASENAME}*.direct $out.rootfs.wic | 194 | |
180 | rm -rf $out/ | 195 | BUILDDIR="${TOPDIR}" wic create "$wks" --vars "${STAGING_DIR_TARGET}/imgdata/" -e "${IMAGE_BASENAME}" -o "$out/" |
196 | mv "$out/build/$(basename "${wks%.wks}")"*.direct "$out.rootfs.wic" | ||
197 | rm -rf "$out/" | ||
181 | } | 198 | } |
199 | IMAGE_CMD_wic[vardepsexclude] = "WKS_FULL_PATH WKS_FILES" | ||
200 | |||
201 | # Rebuild when the wks file changes | ||
202 | USING_WIC = "${@bb.utils.contains_any('IMAGE_FSTYPES', 'wic ' + ' '.join('wic.%s' % c for c in '${COMPRESSIONTYPES}'.split()), '1', '', d)}" | ||
203 | do_rootfs[file-checksums] += "${@'${WKS_FULL_PATH}:%s' % os.path.exists('${WKS_FULL_PATH}') if '${USING_WIC}' else ''}" | ||
182 | 204 | ||
183 | EXTRA_IMAGECMD = "" | 205 | EXTRA_IMAGECMD = "" |
184 | 206 | ||