aboutsummaryrefslogtreecommitdiffstats
path: root/meta/classes/image_types.bbclass
diff options
context:
space:
mode:
authorAlex Franco <alejandro.franco@linux.intel.com>2015-08-26 16:57:35 -0500
committerRichard Purdie <richard.purdie@linuxfoundation.org>2015-08-29 13:32:41 +0100
commit6938791ff97a23430afb4aa16d71aa8729a12ead (patch)
tree1f1917548448f86448dbb8bf99d31e1fc44ccae0 /meta/classes/image_types.bbclass
parenta902e98c5938f52ec960e0518e0ceaf8f5ee610c (diff)
downloadopenembedded-core-contrib-6938791ff97a23430afb4aa16d71aa8729a12ead.tar.gz
Empty image: filesystem allocation
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>
Diffstat (limited to 'meta/classes/image_types.bbclass')
-rw-r--r--meta/classes/image_types.bbclass10
1 files changed, 9 insertions, 1 deletions
diff --git a/meta/classes/image_types.bbclass b/meta/classes/image_types.bbclass
index 8547574a1d..2fd4c3794a 100644
--- a/meta/classes/image_types.bbclass
+++ b/meta/classes/image_types.bbclass
@@ -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}
}