From a83144bac8d67704ff66f5dc0fc56f5b63979694 Mon Sep 17 00:00:00 2001 From: Laurentiu Palcu Date: Wed, 18 Dec 2013 18:02:18 +0200 Subject: Activate the new python rootfs/image creation routines This commit will: * remove old bash code common to all backends; * create a new do_rootfs() python function that will use the new rootfs/image creation routines; * allow creation of dpkg based images; * fail for rpm/opkg (not implemented yet); Signed-off-by: Laurentiu Palcu --- meta/classes/image_types.bbclass | 113 --------------------------------------- 1 file changed, 113 deletions(-) (limited to 'meta/classes/image_types.bbclass') diff --git a/meta/classes/image_types.bbclass b/meta/classes/image_types.bbclass index 48675b8794..393bfa82eb 100644 --- a/meta/classes/image_types.bbclass +++ b/meta/classes/image_types.bbclass @@ -1,122 +1,9 @@ -def get_imagecmds(d): - cmds = "\n" - old_overrides = d.getVar('OVERRIDES', 0) - - alltypes = d.getVar('IMAGE_FSTYPES', True).split() - types = [] - ctypes = d.getVar('COMPRESSIONTYPES', True).split() - cimages = {} - - # Image type b depends on a having been generated first - def addtypedepends(a, b): - if a in alltypes: - alltypes.remove(a) - if b not in alltypes: - alltypes.append(b) - alltypes.append(a) - - # The elf image depends on the cpio.gz image already having - # been created, so we add that explicit ordering here. - addtypedepends("elf", "cpio.gz") - - # jffs2 sumtool'd images need jffs2 - addtypedepends("sum.jffs2", "jffs2") - - # Filter out all the compressed images from alltypes - for type in alltypes: - basetype = None - for ctype in ctypes: - if type.endswith("." + ctype): - basetype = type[:-len("." + ctype)] - if basetype not in types: - types.append(basetype) - if basetype not in cimages: - cimages[basetype] = [] - if ctype not in cimages[basetype]: - cimages[basetype].append(ctype) - break - if not basetype and type not in types: - types.append(type) - - # Live and VMDK images will be processed via inheriting - # bbclass and does not get processed here. - # vmdk depend on live images also depend on ext3 so ensure its present - # Note: we need to ensure ext3 is in alltypes, otherwise, subimages may - # not contain ext3 and the .rootfs.ext3 file won't be created. - if "vmdk" in types: - if "ext3" not in types: - types.append("ext3") - if "ext3" not in alltypes: - alltypes.append("ext3") - types.remove("vmdk") - if "live" in types or "iso" in types or "hddimg" in types: - if "ext3" not in types: - types.append("ext3") - if "ext3" not in alltypes: - alltypes.append("ext3") - if "live" in types: - types.remove("live") - if "iso" in types: - types.remove("iso") - if "hddimg" in types: - types.remove("hddimg") - - if d.getVar('IMAGE_LINK_NAME', True): - if d.getVar('RM_OLD_IMAGE', True) == "1": - # Remove the old image - cmds += "\trm -f `find ${DEPLOY_DIR_IMAGE} -maxdepth 1 -type l -name ${IMAGE_LINK_NAME}'.*' -exec readlink -f {} \;`" - # Remove the symlink - cmds += "\n\trm -f ${DEPLOY_DIR_IMAGE}/${IMAGE_LINK_NAME}.*" - - for type in types: - ccmd = [] - subimages = [] - localdata = bb.data.createCopy(d) - localdata.setVar('OVERRIDES', '%s:%s' % (type, old_overrides)) - bb.data.update_data(localdata) - localdata.setVar('type', type) - if type in cimages: - for ctype in cimages[type]: - ccmd.append("\t" + localdata.getVar("COMPRESS_CMD_" + ctype, True)) - subimages.append(type + "." + ctype) - if type not in alltypes: - ccmd.append(localdata.expand("\trm ${IMAGE_NAME}.rootfs.${type}")) - else: - subimages.append(type) - localdata.setVar('ccmd', "\n".join(ccmd)) - localdata.setVar('subimages', " ".join(subimages)) - cmd = localdata.getVar("IMAGE_CMD", True) - localdata.setVar('cmd', cmd) - cmds += "\n" + localdata.getVar("runimagecmd", True) - return cmds # The default aligment of the size of the rootfs is set to 1KiB. In case # you're using the SD card emulation of a QEMU system simulator you may # set this value to 2048 (2MiB alignment). IMAGE_ROOTFS_ALIGNMENT ?= "1" -runimagecmd () { - # Image generation code for image type ${type} - # The base_size gets calculated: - # - initial size determined by `du -ks` of the IMAGE_ROOTFS - # - then multiplied by the IMAGE_OVERHEAD_FACTOR - # - tested against IMAGE_ROOTFS_SIZE - # - round up ROOTFS_SIZE to IMAGE_ROOTFS_ALIGNMENT - ROOTFS_SIZE=`du -ks ${IMAGE_ROOTFS} | awk '{base_size = $1 * ${IMAGE_OVERHEAD_FACTOR}; base_size = ((base_size > ${IMAGE_ROOTFS_SIZE} ? base_size : ${IMAGE_ROOTFS_SIZE}) + ${IMAGE_ROOTFS_EXTRA_SPACE}); if (base_size != int(base_size)) base_size = int(base_size + 1); base_size = base_size + ${IMAGE_ROOTFS_ALIGNMENT} - 1; base_size -= base_size % ${IMAGE_ROOTFS_ALIGNMENT}; print base_size }'` - ${cmd} - # Now create the needed compressed versions - cd ${DEPLOY_DIR_IMAGE}/ - ${ccmd} - # And create the symlinks - if [ -n "${IMAGE_LINK_NAME}" ]; then - for type in ${subimages}; do - if [ -e ${IMAGE_NAME}.rootfs.$type ]; then - ln -s ${IMAGE_NAME}.rootfs.$type ${DEPLOY_DIR_IMAGE}/${IMAGE_LINK_NAME}.$type - fi - done - fi -} - def imagetypes_getdepends(d): def adddep(depstr, deps): for i in (depstr or "").split(): -- cgit 1.2.3-korg