diff options
Diffstat (limited to 'meta')
-rw-r--r-- | meta/classes/image.bbclass | 22 | ||||
-rw-r--r-- | meta/classes/image_types.bbclass | 81 | ||||
-rw-r--r-- | meta/conf/bitbake.conf | 41 |
3 files changed, 82 insertions, 62 deletions
diff --git a/meta/classes/image.bbclass b/meta/classes/image.bbclass index eb0d970a2..aa842c78c 100644 --- a/meta/classes/image.bbclass +++ b/meta/classes/image.bbclass @@ -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 ?= "" diff --git a/meta/classes/image_types.bbclass b/meta/classes/image_types.bbclass new file mode 100644 index 000000000..5c9bcd130 --- /dev/null +++ b/meta/classes/image_types.bbclass @@ -0,0 +1,81 @@ +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} +} + +IMAGE_CMD_jffs2 = "mkfs.jffs2 --root=${IMAGE_ROOTFS} --faketime --output=${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.rootfs.jffs2 ${EXTRA_IMAGECMD}" +IMAGE_CMD_yaffs2 = "mkyaffs2image ${EXTRA_IMAGECMD} ${IMAGE_ROOTFS} ${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.rootfs.yaffs2" +IMAGE_CMD_cramfs = "mkcramfs ${IMAGE_ROOTFS} ${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.rootfs.cramfs ${EXTRA_IMAGECMD}" +IMAGE_CMD_ext2 = "genext2fs -b $ROOTFS_SIZE -d ${IMAGE_ROOTFS} ${IMAGE_EXTRA_OPTION} ${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.rootfs.ext2 ${EXTRA_IMAGECMD}" +IMAGE_CMD_ext2.gz () { + rm -rf ${DEPLOY_DIR_IMAGE}/tmp.gz && mkdir ${DEPLOY_DIR_IMAGE}/tmp.gz + genext2fs -b ${IMAGE_ROOTFS_SIZE} -d ${IMAGE_ROOTFS} ${IMAGE_EXTRA_OPTION} ${DEPLOY_DIR_IMAGE}/tmp.gz/${IMAGE_NAME}.rootfs.ext2 ${EXTRA_IMAGECMD} + gzip -f -9 ${DEPLOY_DIR_IMAGE}/tmp.gz/${IMAGE_NAME}.rootfs.ext2 + mv ${DEPLOY_DIR_IMAGE}/tmp.gz/${IMAGE_NAME}.rootfs.ext2.gz ${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.rootfs.ext2.gz + rmdir ${DEPLOY_DIR_IMAGE}/tmp.gz +} +IMAGE_CMD_ext3 () { + genext2fs -b $ROOTFS_SIZE -d ${IMAGE_ROOTFS} ${IMAGE_EXTRA_OPTION} ${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.rootfs.ext3 ${EXTRA_IMAGECMD} + tune2fs -j ${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.rootfs.ext3 +} +IMAGE_CMD_ext3.gz () { + rm -rf ${DEPLOY_DIR_IMAGE}/tmp.gz && mkdir ${DEPLOY_DIR_IMAGE}/tmp.gz + genext2fs -b ${IMAGE_ROOTFS_SIZE} -d ${IMAGE_ROOTFS} ${IMAGE_EXTRA_OPTION} ${DEPLOY_DIR_IMAGE}/tmp.gz/${IMAGE_NAME}.rootfs.ext3 ${EXTRA_IMAGECMD} + tune2fs -j ${DEPLOY_DIR_IMAGE}/tmp.gz/${IMAGE_NAME}.rootfs.ext3 + gzip -f -9 ${DEPLOY_DIR_IMAGE}/tmp.gz/${IMAGE_NAME}.rootfs.ext3 + mv ${DEPLOY_DIR_IMAGE}/tmp.gz/${IMAGE_NAME}.rootfs.ext3.gz ${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.rootfs.ext3.gz + rmdir ${DEPLOY_DIR_IMAGE}/tmp.gz +} +IMAGE_CMD_squashfs = "mksquashfs ${IMAGE_ROOTFS} ${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.rootfs.squashfs ${EXTRA_IMAGECMD} -noappend" +IMAGE_CMD_squashfs-lzma = "mksquashfs-lzma ${IMAGE_ROOTFS} ${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.rootfs.squashfs-lzma ${EXTRA_IMAGECMD} -noappend" +IMAGE_CMD_tar = "cd ${IMAGE_ROOTFS} && tar -cvf ${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.rootfs.tar ." +IMAGE_CMD_tar.gz = "cd ${IMAGE_ROOTFS} && tar -zcvf ${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.rootfs.tar.gz ." +IMAGE_CMD_tar.bz2 = "cd ${IMAGE_ROOTFS} && tar -jcvf ${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.rootfs.tar.bz2 ." +IMAGE_CMD_cpio = "cd ${IMAGE_ROOTFS} && (find . | cpio -o -H newc >${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.rootfs.cpio)" +IMAGE_CMD_cpio.gz = "cd ${IMAGE_ROOTFS} && (find . | cpio -o -H newc | gzip -c -9 >${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.rootfs.cpio.gz)" +IMAGE_CMD_ubi () { + echo \[ubifs\] > ubinize.cfg + echo mode=ubi >> ubinize.cfg + echo image=${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.rootfs.ubifs >> ubinize.cfg + echo vol_id=0 >> ubinize.cfg + echo vol_type=dynamic >> ubinize.cfg + echo vol_name=${UBI_VOLNAME} >> ubinize.cfg + echo vol_flags=autoresize >> ubinize.cfg + mkfs.ubifs -r ${IMAGE_ROOTFS} -o ${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.rootfs.ubifs ${MKUBIFS_ARGS} && ubinize -o ${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.rootfs.ubi ${UBINIZE_ARGS} ubinize.cfg +} +IMAGE_CMD_ubifs = "mkfs.ubifs -r ${IMAGE_ROOTFS} -o ${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.ubifs.img ${MKUBIFS_ARGS}" + +EXTRA_IMAGECMD = "" +EXTRA_IMAGECMD_jffs2 = "--pad --little-endian --eraseblock=0x40000" +EXTRA_IMAGECMD_yaffs2 = "1" + +IMAGE_DEPENDS = "" +IMAGE_DEPENDS_jffs2 = "mtd-utils-native" +IMAGE_DEPENDS_yaffs2 = "yaffs2-utils-native" +IMAGE_DEPENDS_cramfs = "cramfs-native" +IMAGE_DEPENDS_ext2 = "genext2fs-native" +IMAGE_DEPENDS_ext2.gz = "genext2fs-native" +IMAGE_DEPENDS_ext3 = "genext2fs-native e2fsprogs-native" +IMAGE_DEPENDS_ext3.gz = "genext2fs-native e2fsprogs-native" +IMAGE_DEPENDS_squashfs = "squashfs-tools-native" +IMAGE_DEPENDS_squashfs-lzma = "squashfs-lzma-tools-native" +IMAGE_DEPENDS_ubi = "mtd-utils-native" +IMAGE_DEPENDS_ubifs = "mtd-utils-native" + diff --git a/meta/conf/bitbake.conf b/meta/conf/bitbake.conf index 22532db7f..8e8994509 100644 --- a/meta/conf/bitbake.conf +++ b/meta/conf/bitbake.conf @@ -355,47 +355,6 @@ IMAGE_OVERHEAD_FACTOR ?= 1.3 # Comment this option if you want default genext2fs behavior (i.e. create minimal inode number) IMAGE_EXTRA_OPTION ?= "-i 8192" -IMAGE_CMD = "" -IMAGE_CMD_jffs2 = "mkfs.jffs2 --root=${IMAGE_ROOTFS} --faketime --output=${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.rootfs.jffs2 ${EXTRA_IMAGECMD}" -IMAGE_CMD_yaffs2 = "mkyaffs2image ${EXTRA_IMAGECMD} ${IMAGE_ROOTFS} ${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.rootfs.yaffs2" -IMAGE_CMD_cramfs = "mkcramfs ${IMAGE_ROOTFS} ${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.rootfs.cramfs ${EXTRA_IMAGECMD}" -IMAGE_CMD_ext2 = "genext2fs -b $ROOTFS_SIZE -d ${IMAGE_ROOTFS} ${IMAGE_EXTRA_OPTION} ${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.rootfs.ext2 ${EXTRA_IMAGECMD}" -IMAGE_CMD_ext2.gz = "rm -rf ${DEPLOY_DIR_IMAGE}/tmp.gz && mkdir ${DEPLOY_DIR_IMAGE}/tmp.gz; genext2fs -b ${IMAGE_ROOTFS_SIZE} -d ${IMAGE_ROOTFS} ${IMAGE_EXTRA_OPTION} ${DEPLOY_DIR_IMAGE}/tmp.gz/${IMAGE_NAME}.rootfs.ext2 ${EXTRA_IMAGECMD}; gzip -f -9 ${DEPLOY_DIR_IMAGE}/tmp.gz/${IMAGE_NAME}.rootfs.ext2; mv ${DEPLOY_DIR_IMAGE}/tmp.gz/${IMAGE_NAME}.rootfs.ext2.gz ${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.rootfs.ext2.gz; rmdir ${DEPLOY_DIR_IMAGE}/tmp.gz" -IMAGE_CMD_ext3 = "genext2fs -b $ROOTFS_SIZE -d ${IMAGE_ROOTFS} ${IMAGE_EXTRA_OPTION} ${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.rootfs.ext3 ${EXTRA_IMAGECMD}; tune2fs -j ${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.rootfs.ext3" -IMAGE_CMD_ext3.gz = "rm -rf ${DEPLOY_DIR_IMAGE}/tmp.gz && mkdir ${DEPLOY_DIR_IMAGE}/tmp.gz; genext2fs -b ${IMAGE_ROOTFS_SIZE} -d ${IMAGE_ROOTFS} ${IMAGE_EXTRA_OPTION} ${DEPLOY_DIR_IMAGE}/tmp.gz/${IMAGE_NAME}.rootfs.ext3 ${EXTRA_IMAGECMD}; tune2fs -j ${DEPLOY_DIR_IMAGE}/tmp.gz/${IMAGE_NAME}.rootfs.ext3; gzip -f -9 ${DEPLOY_DIR_IMAGE}/tmp.gz/${IMAGE_NAME}.rootfs.ext3; mv ${DEPLOY_DIR_IMAGE}/tmp.gz/${IMAGE_NAME}.rootfs.ext3.gz ${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.rootfs.ext3.gz; rmdir ${DEPLOY_DIR_IMAGE}/tmp.gz" -IMAGE_CMD_squashfs = "mksquashfs ${IMAGE_ROOTFS} ${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.rootfs.squashfs ${EXTRA_IMAGECMD} -noappend" -IMAGE_CMD_squashfs-lzma = "mksquashfs-lzma ${IMAGE_ROOTFS} ${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.rootfs.squashfs-lzma ${EXTRA_IMAGECMD} -noappend" -IMAGE_CMD_tar = "cd ${IMAGE_ROOTFS} && tar -cvf ${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.rootfs.tar ." -IMAGE_CMD_tar.gz = "cd ${IMAGE_ROOTFS} && tar -zcvf ${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.rootfs.tar.gz ." -IMAGE_CMD_tar.bz2 = "cd ${IMAGE_ROOTFS} && tar -jcvf ${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.rootfs.tar.bz2 ." -IMAGE_CMD_cpio = "cd ${IMAGE_ROOTFS} && (find . | cpio -o -H newc >${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.rootfs.cpio)" -IMAGE_CMD_cpio.gz = "cd ${IMAGE_ROOTFS} && (find . | cpio -o -H newc | gzip -c -9 >${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.rootfs.cpio.gz)" -IMAGE_CMD_ubi = "echo \[ubifs\] > ubinize.cfg ; echo mode=ubi >> ubinize.cfg ; echo image=${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.rootfs.ubifs >> ubinize.cfg ; echo vol_id=0 >> ubinize.cfg ; echo vol_type=dynamic >> ubinize.cfg ; echo vol_name=${UBI_VOLNAME} >> ubinize.cfg ; echo vol_flags=autoresize >> ubinize.cfg;mkfs.ubifs -r ${IMAGE_ROOTFS} -o ${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.rootfs.ubifs ${MKUBIFS_ARGS} && ubinize -o ${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.rootfs.ubi ${UBINIZE_ARGS} ubinize.cfg" -IMAGE_CMD_ubifs = "mkfs.ubifs -r ${IMAGE_ROOTFS} -o ${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.ubifs.img ${MKUBIFS_ARGS}" - -EXTRA_IMAGECMD = "" -EXTRA_IMAGECMD_jffs2 = "--pad --little-endian --eraseblock=0x40000" -EXTRA_IMAGECMD_yaffs2 = "1" -EXTRA_IMAGECMD_squashfs = "" -EXTRA_IMAGECMD_squashfs-lzma = "" -EXTRA_IMAGECMD_cpio = "" -EXTRA_IMAGECMD_cpio.gz = "" -EXTRA_IMAGECMD_ubi = "" -EXTRA_IMAGECMD_ubifs = "" - -IMAGE_DEPENDS = "" -IMAGE_DEPENDS_jffs2 = "mtd-utils-native" -IMAGE_DEPENDS_yaffs2 = "yaffs2-utils-native" -IMAGE_DEPENDS_cramfs = "cramfs-native" -IMAGE_DEPENDS_ext2 = "genext2fs-native" -IMAGE_DEPENDS_ext2.gz = "genext2fs-native" -IMAGE_DEPENDS_ext3 = "genext2fs-native e2fsprogs-native" -IMAGE_DEPENDS_ext3.gz = "genext2fs-native e2fsprogs-native" -IMAGE_DEPENDS_squashfs = "squashfs-tools-native" -IMAGE_DEPENDS_squashfs-lzma = "squashfs-lzma-tools-native" -IMAGE_DEPENDS_ubi = "mtd-utils-native" -IMAGE_DEPENDS_ubifs = "mtd-utils-native" - EXTRA_IMAGEDEPENDS = "" ################################################################## |