[oe] [PATCH] Auto resizing ext2/ext3 images (from Poky)

Denys Dmytriyenko denis at denix.org
Fri Dec 5 17:48:06 UTC 2008


On Fri, Dec 05, 2008 at 05:15:41PM +0100, Marcin Juszkiewicz wrote:
> 
> During my work for OpenedHand I wrote one usefull thing which we used for
> ext2/ext3 images - autosizing.

Great! I often face this issue of not fitting everything in a predefined image 
size. This patch should be very helpful!

> In few words: it checks how big rootfs is, adds IMAGE_EXTRA_SPACE amount
> of kilobytes to it and gives that size to genext2fs.
> 
> Below is a patch with code changes. Check it and say what You think about
> it. One thing is missing - support for fixed size ext2/3 images big enough
> to fit resulting rootfs.
> 
> diff --git a/classes/image.bbclass b/classes/image.bbclass
> index e9c0ecd..901ab34 100644
> --- a/classes/image.bbclass
> +++ b/classes/image.bbclass
> @@ -107,6 +107,7 @@ fakeroot do_rootfs () {
>  
>  	${IMAGE_PREPROCESS_COMMAND}
>  
> +	ROOTFS_SIZE=`du -ks ${IMAGE_ROOTFS}|awk '{print ${IMAGE_EXTRA_SPACE} + $1}'`

Can it be done like this:

ROOTFS_SIZE=`du -ks ${IMAGE_ROOTFS}|awk '{size = ${IMAGE_EXTRA_SPACE} + $1; \
 print (size > ${IMAGE_ROOTFS_SIZE} ? size : ${IMAGE_ROOTFS_SIZE}) }'`

>  	${@get_imagecmds(d)}
>  
>  	${IMAGE_POSTPROCESS_COMMAND}

-- 
Denys




More information about the Openembedded-devel mailing list