Yocto Project Discussions
 help / color / mirror / Atom feed
From: "Mikko Rapeli" <mikko.rapeli@bmw.de>
To: <ajama@hcl.com>
Cc: <yocto@lists.yoctoproject.org>
Subject: Re: [yocto] Fw: Reducing rootfs size in yocto
Date: Mon, 30 Mar 2020 06:57:50 +0000	[thread overview]
Message-ID: <20200330065748.GS104502@korppu> (raw)
In-Reply-To: <HK0PR04MB291491325C57709CD3461BB9B4CD0@HK0PR04MB2914.apcprd04.prod.outlook.com>

Hi,

Generic approaches for reducing yocto target image size where buildhistory
is an important source of information:

 * review and minimize distro features, enable only what you need
   https://www.yoctoproject.org/docs/latest/mega-manual/mega-manual.html#ref-features-distro

 * review and minimize image recipe, install only those image features and packages
   which you need
   https://www.yoctoproject.org/docs/latest/mega-manual/mega-manual.html#ref-features-image

 * review the needed binary packages: traverse the tree of dependencies what you need,
   review every single recipe and change PACKAGECONFIG or build flags to remove
   features which you do not need. This it may be possible to remove large set
   of dependencies from images, e.g. language bindings, debug tools. In some cases
   one just needs a single binary executable or shared library but it is bundled
   in a larger binary package with more complex dependencies. For these cases
   add a bbappend to custom layers to change the packaging to only include what
   you need.
   https://www.yoctoproject.org/docs/latest/mega-manual/mega-manual.html#var-PACKAGECONFIG

 * change compiler flags from default O2 to Os optimization. This can work for
   some recipes which are not prerformance critical or to the whole build. Note
   that many SW components break this in their own build scripts by adding
   O2 or even O3 by default. Check from buildhistory that binary sizes go smaller
   after switch from O2 to Os and review every important recipe which did not.
   You may be able to save up to 15% in rootfs size this way, but all depends
   on the details of SW components and image contents.
   see poky/meta/conf/bitbake.conf

I've followed this for multiple products and found out that poky is nice to work with
but BSP layers add or depend on all kinds of extra things that products do not need.
Thus I have ended by BBMASK'ing away large parts of BSP layer recipes in distro
configs. This with multiple x86 and ARM BSP layers from various SoC vendors.

Also, RTFM :)

https://www.yoctoproject.org/docs/latest/mega-manual/mega-manual.html#building-a-tiny-system

Hope this helps,

-Mikko

  parent reply	other threads:[~2020-03-30  6:58 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <HK0PR04MB29144DAFD598E96154278145B4CD0@HK0PR04MB2914.apcprd04.prod.outlook.com>
2020-03-28 13:25 ` Fw: Reducing rootfs size in yocto ajama
2020-03-28 14:08   ` [yocto] " Konrad Weihmann
2020-03-28 18:36     ` Ajam Ali
2020-03-28 19:45       ` Konrad Weihmann
2020-03-29 14:46   ` Oliver Westermann
2020-03-30  4:59     ` [yocto] " Ajam Ali
2020-03-30  6:57   ` Mikko Rapeli [this message]
2020-04-08 22:12     ` Randy MacLeod

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200330065748.GS104502@korppu \
    --to=mikko.rapeli@bmw.de \
    --cc=ajama@hcl.com \
    --cc=yocto@lists.yoctoproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox