Re: How to reduce rootfs image size?


JH
 

Thanks Josef, Fabien and Rudolf, it's been great help to clarify it,
very appreciated.

On 11/28/19, Rudolf J Streif <rudolf.streif@...> wrote:
Hi JH,

The image root file system size is based on the actual content of the
root file system. Besides ROOTFS_SIZE there are other variables that
control how the root file system is sized:

IMAGE_ROOTFS_SIZE: Defines the size in kilobytes of the created root
filesystem image. The
build system uses this value as a request or recommendation. The final
root filesystem
image size may be larger depending on the actual space required. The
default value is
65536.

IMAGE_ROOTFS_ALIGNMENT: Defines the alignment of the root filesystem
image in
kilobytes. If the final size of the root filesystem image is not a
multiple of this value, it is
rounded up to the nearest multiple of it. The default value is 1.

IMAGE_ROOTFS_EXTRA_SPACE: Adds extra free space to the root filesystem
image. The
variable specifies the value in kilobytes. For example, to add an
additional 4 GB of space, set
the variable to IMAGE_ROOTFS_EXTRA_SPACE = "4194304". The default value
is 0.

IMAGE_OVERHEAD_FACTOR: This variable specifies a multiplicator for the
root filesystem
image. The factor is applied after the actual space required by the root
filesystem has been
determined. The default value is 1.3.


Here is some pseudo code on how these variables are used to determine
the final root file system size:

_get_rootfs_size():
ROOTFS_SIZE =`du -ks IMAGE_ROOTFS`
BASE_SIZE = ROOTFS_SIZE * IMAGE_OVERHEAD_FACTOR

if (BASE_SIZE < IMAGE_ROOTFS_SIZE):
IMG_SIZE = IMAGE_ROOTFS_SIZE + IMAGE_ROOTFS_EXTRA_SPACE
else:
IMG_SIZE = BASE_SIZE + IMAGE_ROOTFS_EXTRA_SPACE

IMG_SIZE = IMG_SIZE + IMAGE_ROOTFS_ALIGNMENT – 1
IMG_SIZE = IMG_SIZE % IMAGE_ROOTFS_ALIGNMENT

return IMG_SIZE


:rjs

On 11/27/19 3:12 AM, JH wrote:
Hi,

Does the Yocto rootfs image size is based on real contents included in
the image-rootfs.tar.gz?

When I build the image with very large size of applications and
libraries such as boost, I have my image-rootfs.tr.gz about 44 MB,
then I removed all large size of applications and libraries, I changed
IMAGE_ROOTFS_SIZE to a small size IMAGE_ROOTFS_SIZE = 20000, I thought
the image-rootfs.tar.gz should be reduced to a small size, but it is
still 43 MB I don't believe it is that big, which variable I should
use to reduce the image size?

Thank you.

Kind regards,

- jh

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.

View/Reply Online (#47433):
https://lists.yoctoproject.org/g/yocto/message/47433
Mute This Topic: https://lists.yoctoproject.org/mt/62495609/3617932
Group Owner: yocto+owner@...
Unsubscribe: https://lists.yoctoproject.org/g/yocto/unsub
[rudolf.streif@...]
-=-=-=-=-=-=-=-=-=-=-=-
--
-----
Rudolf J Streif
CEO/CTO ibeeto
+1.855.442.3386 x700

Join {yocto@lists.yoctoproject.org to automatically receive all group messages.