[yocto] [meta-raspberrypi][PATCH 3/3] sdcard-image: Use the size of the generated rootfs

Andrei Gherzan andrei at gherzan.ro
Fri Jan 25 16:19:48 PST 2013


On Fri, Jan 25, 2013 at 3:33 PM, Jan Schmidt <thaytan at noraisin.net> wrote:

> When constructing the SD card image, the code was using
> the inherited ROOTFS_SIZE, which is the size of the
> rootfs contents. When building (for example) a compressed
> rootfs, this allocates a partition much larger than necessary.
>
> Instead, take the size of the generated rootfs file that is
> about to be written into the generated image.
>
> Signed-off-by: Jan Schmidt <thaytan at noraisin.net>
> ---
>  classes/sdcard_image-rpi.bbclass |    5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/classes/sdcard_image-rpi.bbclass
> b/classes/sdcard_image-rpi.bbclass
> index 421f561..355ff9c 100644
> --- a/classes/sdcard_image-rpi.bbclass
> +++ b/classes/sdcard_image-rpi.bbclass
> @@ -60,7 +60,8 @@ IMAGE_CMD_rpi-sdimg () {
>         # Align partitions
>         BOOT_SPACE_ALIGNED=$(expr ${BOOT_SPACE} +
> ${IMAGE_ROOTFS_ALIGNMENT} - 1)
>         BOOT_SPACE_ALIGNED=$(expr ${BOOT_SPACE_ALIGNED} -
> ${BOOT_SPACE_ALIGNED} % ${IMAGE_ROOTFS_ALIGNMENT})
> -       SDIMG_SIZE=$(expr ${IMAGE_ROOTFS_ALIGNMENT} +
> ${BOOT_SPACE_ALIGNED} + $ROOTFS_SIZE + ${IMAGE_ROOTFS_ALIGNMENT})
> +       ROOTFS_SIZE=`du -ks ${SDIMG_ROOTFS} | awk '{print $1}'`
>

This is a good idea but you will have to align the new ROOTFS_SIZE
to IMAGE_ROOTFS_ALIGNMENT.


> +       SDIMG_SIZE=$(expr ${IMAGE_ROOTFS_ALIGNMENT} +
> ${BOOT_SPACE_ALIGNED} + ${ROOTFS_SIZE})


So you are actually removing IMAGE_ROOTFS_ALIGNMENT space at the end of the
sd image. Why are you doing this? Nothing stated in the comment.

ag
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.yoctoproject.org/pipermail/yocto/attachments/20130126/7bb19147/attachment.html>


More information about the yocto mailing list