bitbake.conf/image.bbclass: Move image type information into image_types.bbclass

Image generation code in .conf files is hard to read as it needs to be
single line. By moving this to a separate class, multiline functions
can be used instead improving readability. It also declutters
bitbake.conf.

There is no real functional change with this patch but it highlights
the need for improvements in places such as the IMAGE_EXTRA_OPTION
ext* specific variable which makes no sense.

(From OE-Core rev: a5c403f0fc71f38c0669691da7f637303ea09a27)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
Richard Purdie committed 2011-03-25 16:34:23 +00:00
1 parent f8539239bc
commit ed41be01dc
3 files changed
+82 -62

No files matched your search

+1 -21
View File
@@ -64,27 +64,7 @@ def get_devtable_list(d):
str += " %s" % bb.which(bb.data.getVar('BBPATH', d, 1), devtable)
return str
def get_imagecmds(d):
cmds = "\n"
old_overrides = bb.data.getVar('OVERRIDES', d, 0)
for type in bb.data.getVar('IMAGE_FSTYPES', d, True).split():
localdata = bb.data.createCopy(d)
localdata.setVar('OVERRIDES', '%s:%s' % (type, old_overrides))
bb.data.update_data(localdata)
localdata.setVar('type', type)
cmd = localdata.getVar("IMAGE_CMD_" + type, True)
localdata.setVar('cmd', cmd)
cmds += localdata.getVar("runimagecmd", True)
return cmds
runimagecmd () {
# Image generation code for image type ${type}
ROOTFS_SIZE=`du -ks ${IMAGE_ROOTFS}|awk '{size = $1 * ${IMAGE_OVERHEAD_FACTOR}; print (size > ${IMAGE_ROOTFS_SIZE} ? size : ${IMAGE_ROOTFS_SIZE}) }'`
${cmd}
cd ${DEPLOY_DIR_IMAGE}/
rm -f ${DEPLOY_DIR_IMAGE}/${IMAGE_LINK_NAME}.${type}
ln -s ${IMAGE_NAME}.rootfs.${type} ${DEPLOY_DIR_IMAGE}/${IMAGE_LINK_NAME}.${type}
}
inherit image_types
IMAGE_POSTPROCESS_COMMAND ?= ""
MACHINE_POSTPROCESS_COMMAND ?= ""