How to reduce rootfs image size?


JH
 

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


Josef Holzmayr <holzmayr@...>
 

On Wed, Nov 27, 2019 at 10:12:13PM +1100, 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?
tar.gz ist a content-based format, not a filesystem based one. So if the
tarball is that big, then you certainly have all those things in your
rootfs. Look at the manifest files to find out that goes in there, and
use buildhistory to find out the sizes of the things.

Greetz

--
———————————————
Josef Holzmayr
Software Developer Embedded Systems

Tel: +49 8444 9204-48
Fax: +49 8444 9204-50

R-S-I Elektrotechnik GmbH & Co. KG
Woelkestrasse 11
D-85301 Schweitenkirchen
www.rsi-elektrotechnik.de
———————————————
Amtsgericht Ingolstadt – GmbH: HRB 191328 – KG: HRA 170393
Geschäftsführer: Dr.-Ing. Michael Sorg, Dipl.-Ing. Franz Sorg
Ust-IdNr: DE 128592548

_____________________________________________________________
Amtsgericht Ingolstadt - GmbH: HRB 191328 - KG: HRA 170363
Geschäftsführer: Dr.-Ing. Michael Sorg, Dipl.-Ing. Franz Sorg
USt-IdNr.: DE 128592548


Fabien Lahoudere <fabien.lahoudere@...>
 

Hi

If you want to reduce the size of your root filesystem, you have to
remove software you don't need. IMAGE_ROOTFS_SIZE has no effect on the
size of your image-rootfs.tar.gz. Putting a smaller size will just lead
to a rootfs that don't fit in the expected IMAGE_ROOTFS_SIZE.

Fabien

Le mercredi 27 novembre 2019 à 22:12 +1100, JH a écrit :
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/3618224
Group Owner: yocto+owner@...
Unsubscribe: https://lists.yoctoproject.org/g/yocto/unsub [fabien.la
houdere@...]
-=-=-=-=-=-=-=-=-=-=-=-


Rudolf J Streif
 

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


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