[OE-core] [PATCH 3/3] Empty image: filesystem allocation

Benjamin Esquivel benjamin.esquivel at linux.intel.com
Fri Sep 11 17:26:14 UTC 2015


Hi Alejandro,

On Wed, 2015-08-26 at 16:57 -0500, Alex Franco wrote:
> 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 at linux.intel.com>
> ---
>  meta/classes/image_types.bbclass | 10 +++++++++-
>  1 file changed, 9 insertions(+), 1 deletion(-)
> 
> diff --git a/meta/classes/image_types.bbclass
> b/meta/classes/image_types.bbclass
> index 35ceb7b..61ce222 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
Variable references enclosed in {} are less prone to misinterpretation.
>  	mkfs.$fstype -F $extra_imagecmd
> ${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.rootfs.$fstype -d ${IMAGE_ROOTFS}
>  }
>  
> -- 
> 2.5.0
> 



More information about the Openembedded-core mailing list