sdcard_image bbclass: run genex2fs directly on the loop device
[glsdk/meta-ti-glsdk.git] / classes / sdcard_image.bbclass
index 531b419230816c52220f3f94cdd9abd28459d6a0..7d1f061d0602772a0aa3ac6bae95a8b747ffb4ac 100644 (file)
@@ -130,20 +130,16 @@ IMAGE_CMD_sdimg () {
        echo "Creating rootfs loopback"
        ${LOSETUP} ${LOOPDEV_FS} ${SDIMG} -o ${FS_OFFSET}
 
-       # should use fdisk info
-       echo "Creating rootfs image"
-       touch ${WORKDIR}/${IMAGE_NAME}.rootfs.img
-
        FS_NUM_INODES=$(echo $FS_SIZE_BLOCKS / 4 | bc)
 
        case "${ROOTFSTYPE}" in
                ext3)
-                               genext2fs -z -N $FS_NUM_INODES -b $FS_SIZE_BLOCKS -d ${IMAGE_ROOTFS} ${WORKDIR}/${IMAGE_NAME}.rootfs.img
-                               tune2fs -L ${IMAGE_NAME} -j ${WORKDIR}/${IMAGE_NAME}.rootfs.img
+                               genext2fs -z -N $FS_NUM_INODES -b $FS_SIZE_BLOCKS -d ${IMAGE_ROOTFS} ${LOOPDEV_FS}
+                               tune2fs -L ${IMAGE_NAME} -j ${LOOPDEV_FS}
                                ;;
                ext4)
-                               genext2fs -z -N $FS_NUM_INODES -b $FS_SIZE_BLOCKS -d ${IMAGE_ROOTFS} ${WORKDIR}/${IMAGE_NAME}.rootfs.img
-                               tune2fs -L ${IMAGE_NAME} -j -O extents,uninit_bg,dir_index ${WORKDIR}/${IMAGE_NAME}.rootfs.img
+                               genext2fs -z -N $FS_NUM_INODES -b $FS_SIZE_BLOCKS -d ${IMAGE_ROOTFS} ${LOOPDEV_FS}
+                               tune2fs -L ${IMAGE_NAME} -j -O extents,uninit_bg,dir_index ${LOOPDEV_FS}
                                ;;
                *)
                                echo "Please set ROOTFSTYPE to something supported"
@@ -151,8 +147,6 @@ IMAGE_CMD_sdimg () {
                                ;;
        esac
 
-       dd if=${WORKDIR}/${IMAGE_NAME}.rootfs.img of=${LOOPDEV_FS}
-
        ${LOSETUP} -d ${LOOPDEV_FS} || true
 
        gzip -c ${WORKDIR}/sd.img > ${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}-${IMAGEDATESTAMP}.img.gz