]> code.ossystems Code Review - openembedded-core.git/commitdiff
Empty image: filesystem allocation
authorAlex Franco <alejandro.franco@linux.intel.com>
Wed, 26 Aug 2015 21:57:35 +0000 (16:57 -0500)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Sat, 29 Aug 2015 12:32:41 +0000 (13:32 +0100)
Increase sparse image block size when ROOTFS_SIZE is smaller than
the minimum needed for ext4 to fit into it.

[YOCTO #7664]

Signed-off-by: Alex Franco <alejandro.franco@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
meta/classes/image_types.bbclass

index 8547574a1ddb52bf5acfba2f6aea0d0ef6ed9af6..2fd4c3794a1682882aa5a4abb8848153c84eb3d3 100644 (file)
@@ -49,8 +49,16 @@ oe_mkext234fs () {
                extra_imagecmd=$@
        fi
 
+       # If generating an empty image the size of the sparse block should be large
+       # enough to allocate an ext4 filesystem using 4096 bytes per inode, this is
+       # about 60K, so dd needs a minimum count of 60, with bs=1024 (bytes per IO)
+       eval local COUNT=\"0\"
+       eval local MIN_COUNT=\"60\"
+       if [ $ROOTFS_SIZE -lt $MIN_COUNT ]; then
+               eval COUNT=\"$MIN_COUNT\"
+       fi
        # Create a sparse image block
-       dd if=/dev/zero of=${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.rootfs.$fstype seek=$ROOTFS_SIZE count=0 bs=1k
+       dd if=/dev/zero of=${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.rootfs.$fstype seek=$ROOTFS_SIZE count=$COUNT bs=1024
        mkfs.$fstype -F $extra_imagecmd ${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.rootfs.$fstype -d ${IMAGE_ROOTFS}
 }