Openembedded Core Discussions
 help / color / mirror / Atom feed
* [PATCH 0/1] image.bbclass: check INITRAMFS_MAXSIZE
@ 2016-01-25  8:45 Robert Yang
  2016-01-25  8:45 ` [PATCH 1/1] " Robert Yang
  0 siblings, 1 reply; 4+ messages in thread
From: Robert Yang @ 2016-01-25  8:45 UTC (permalink / raw)
  To: openembedded-core

The following changes since commit bf6372fc361e7588e95f682103332d7a7159c851:

  weston: Add missing DEPENDS on wayland-native (2016-01-24 10:55:35 +0000)

are available in the git repository at:

  git://git.openembedded.org/openembedded-core-contrib rbt/initramfs
  http://cgit.openembedded.org/cgit.cgi/openembedded-core-contrib/log/?h=rbt/initramfs

Robert Yang (1):
  image.bbclass: check INITRAMFS_MAXSIZE

 meta/classes/image.bbclass |   14 +++++++++++++-
 meta/conf/bitbake.conf     |    6 ++++++
 2 files changed, 19 insertions(+), 1 deletion(-)

-- 
1.7.9.5



^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH 1/1] image.bbclass: check INITRAMFS_MAXSIZE
  2016-01-25  8:45 [PATCH 0/1] image.bbclass: check INITRAMFS_MAXSIZE Robert Yang
@ 2016-01-25  8:45 ` Robert Yang
  2016-01-25 16:30   ` Scott Rifenbark
  0 siblings, 1 reply; 4+ messages in thread
From: Robert Yang @ 2016-01-25  8:45 UTC (permalink / raw)
  To: openembedded-core

Usually, the initramfs' maxsize can be 1/2 of ram size since modern
kernel uses tmpfs as initramfs by dafault, and tmpfs allocates 1/2 of
ram by default at boot time, which will be used to locate the initramfs.

Set INITRAMFS_MAXSIZE to 131072K (128M) by default (ram 256M), the
initramfs is small usually, for example, core-image-minimal-initramfs is
about 21M (uncompressed, 17M * 1.3) by default, but if the user add a
lot pkgs to initramfs, we can error and stop to let the user know ealier
rather than fail to boot (e.g., OOM-killer) at boot time.

Please see the bug for more info:
https://bugzilla.yoctoproject.org/show_bug.cgi?id=5963

[YOCTO #5963]

Signed-off-by: Robert Yang <liezhi.yang@windriver.com>
---
 meta/classes/image.bbclass |   14 +++++++++++++-
 meta/conf/bitbake.conf     |    6 ++++++
 2 files changed, 19 insertions(+), 1 deletion(-)

diff --git a/meta/classes/image.bbclass b/meta/classes/image.bbclass
index 3870516..30d1173 100644
--- a/meta/classes/image.bbclass
+++ b/meta/classes/image.bbclass
@@ -423,6 +423,9 @@ def get_rootfs_size(d):
     rootfs_req_size = int(d.getVar('IMAGE_ROOTFS_SIZE', True))
     rootfs_extra_space = eval(d.getVar('IMAGE_ROOTFS_EXTRA_SPACE', True))
     rootfs_maxsize = d.getVar('IMAGE_ROOTFS_MAXSIZE', True)
+    image_fstypes = d.getVar('IMAGE_FSTYPES', True) or ''
+    initramfs_fstypes = d.getVar('INITRAMFS_FSTYPES', True) or ''
+    initramfs_maxsize = d.getVar('INITRAMFS_MAXSIZE', True)
 
     output = subprocess.check_output(['du', '-ks',
                                       d.getVar('IMAGE_ROOTFS', True)])
@@ -443,8 +446,17 @@ def get_rootfs_size(d):
     if rootfs_maxsize:
         rootfs_maxsize_int = int(rootfs_maxsize)
         if base_size > rootfs_maxsize_int:
-            bb.fatal("The rootfs size %d(K) overrides the max size %d(K)" % \
+            bb.fatal("The rootfs size %d(K) overrides IMAGE_ROOTFS_MAXSIZE: %d(K)" % \
                 (base_size, rootfs_maxsize_int))
+
+    # Check the initramfs size against INITRAMFS_MAXSIZE (if set)
+    if image_fstypes == initramfs_fstypes != ''  and initramfs_maxsize:
+        initramfs_maxsize_int = int(initramfs_maxsize)
+        if base_size > initramfs_maxsize_int:
+            bb.error("The initramfs size %d(K) overrides INITRAMFS_MAXSIZE: %d(K)" % \
+                (base_size, initramfs_maxsize_int))
+            bb.error("You can set INITRAMFS_MAXSIZE a larger value. Usually, it should")
+            bb.fatal("be less than 1/2 of ram size, or you may fail to boot it.\n")
     return base_size
 
 python set_image_size () {
diff --git a/meta/conf/bitbake.conf b/meta/conf/bitbake.conf
index 7451eb8..e80ee18 100644
--- a/meta/conf/bitbake.conf
+++ b/meta/conf/bitbake.conf
@@ -712,7 +712,13 @@ require conf/sanity.conf
 DL_DIR ?= "${TOPDIR}/downloads"
 SSTATE_DIR ?= "${TOPDIR}/sstate-cache"
 IMAGE_FSTYPES ?= "tar.gz"
+
 INITRAMFS_FSTYPES ?= "cpio.gz"
+# The maximum size in Kbytes for the generated initramfs image size.
+# Usually, it should be less than 1/2 of ram size, or you may fail to
+# boot it.
+INITRAMFS_MAXSIZE ??= "131072"
+
 DEFAULT_TASK_PROVIDER ?= "packagegroup-base"
 MACHINE_TASK_PROVIDER ?= "${DEFAULT_TASK_PROVIDER}"
 
-- 
1.7.9.5



^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH 1/1] image.bbclass: check INITRAMFS_MAXSIZE
  2016-01-25  8:45 ` [PATCH 1/1] " Robert Yang
@ 2016-01-25 16:30   ` Scott Rifenbark
  2016-01-26  1:20     ` Robert Yang
  0 siblings, 1 reply; 4+ messages in thread
From: Scott Rifenbark @ 2016-01-25 16:30 UTC (permalink / raw)
  To: Robert Yang; +Cc: openembedded-core

[-- Attachment #1: Type: text/plain, Size: 3834 bytes --]

Hi,

I noticed we do not document INITRAMFS_MAXSIZE in the ref-manual.  Should
we be?

Thanks,
Scott

On Mon, Jan 25, 2016 at 12:45 AM, Robert Yang <liezhi.yang@windriver.com>
wrote:

> Usually, the initramfs' maxsize can be 1/2 of ram size since modern
> kernel uses tmpfs as initramfs by dafault, and tmpfs allocates 1/2 of
> ram by default at boot time, which will be used to locate the initramfs.
>
> Set INITRAMFS_MAXSIZE to 131072K (128M) by default (ram 256M), the
> initramfs is small usually, for example, core-image-minimal-initramfs is
> about 21M (uncompressed, 17M * 1.3) by default, but if the user add a
> lot pkgs to initramfs, we can error and stop to let the user know ealier
> rather than fail to boot (e.g., OOM-killer) at boot time.
>
> Please see the bug for more info:
> https://bugzilla.yoctoproject.org/show_bug.cgi?id=5963
>
> [YOCTO #5963]
>
> Signed-off-by: Robert Yang <liezhi.yang@windriver.com>
> ---
>  meta/classes/image.bbclass |   14 +++++++++++++-
>  meta/conf/bitbake.conf     |    6 ++++++
>  2 files changed, 19 insertions(+), 1 deletion(-)
>
> diff --git a/meta/classes/image.bbclass b/meta/classes/image.bbclass
> index 3870516..30d1173 100644
> --- a/meta/classes/image.bbclass
> +++ b/meta/classes/image.bbclass
> @@ -423,6 +423,9 @@ def get_rootfs_size(d):
>      rootfs_req_size = int(d.getVar('IMAGE_ROOTFS_SIZE', True))
>      rootfs_extra_space = eval(d.getVar('IMAGE_ROOTFS_EXTRA_SPACE', True))
>      rootfs_maxsize = d.getVar('IMAGE_ROOTFS_MAXSIZE', True)
> +    image_fstypes = d.getVar('IMAGE_FSTYPES', True) or ''
> +    initramfs_fstypes = d.getVar('INITRAMFS_FSTYPES', True) or ''
> +    initramfs_maxsize = d.getVar('INITRAMFS_MAXSIZE', True)
>
>      output = subprocess.check_output(['du', '-ks',
>                                        d.getVar('IMAGE_ROOTFS', True)])
> @@ -443,8 +446,17 @@ def get_rootfs_size(d):
>      if rootfs_maxsize:
>          rootfs_maxsize_int = int(rootfs_maxsize)
>          if base_size > rootfs_maxsize_int:
> -            bb.fatal("The rootfs size %d(K) overrides the max size %d(K)"
> % \
> +            bb.fatal("The rootfs size %d(K) overrides
> IMAGE_ROOTFS_MAXSIZE: %d(K)" % \
>                  (base_size, rootfs_maxsize_int))
> +
> +    # Check the initramfs size against INITRAMFS_MAXSIZE (if set)
> +    if image_fstypes == initramfs_fstypes != ''  and initramfs_maxsize:
> +        initramfs_maxsize_int = int(initramfs_maxsize)
> +        if base_size > initramfs_maxsize_int:
> +            bb.error("The initramfs size %d(K) overrides
> INITRAMFS_MAXSIZE: %d(K)" % \
> +                (base_size, initramfs_maxsize_int))
> +            bb.error("You can set INITRAMFS_MAXSIZE a larger value.
> Usually, it should")
> +            bb.fatal("be less than 1/2 of ram size, or you may fail to
> boot it.\n")
>      return base_size
>
>  python set_image_size () {
> diff --git a/meta/conf/bitbake.conf b/meta/conf/bitbake.conf
> index 7451eb8..e80ee18 100644
> --- a/meta/conf/bitbake.conf
> +++ b/meta/conf/bitbake.conf
> @@ -712,7 +712,13 @@ require conf/sanity.conf
>  DL_DIR ?= "${TOPDIR}/downloads"
>  SSTATE_DIR ?= "${TOPDIR}/sstate-cache"
>  IMAGE_FSTYPES ?= "tar.gz"
> +
>  INITRAMFS_FSTYPES ?= "cpio.gz"
> +# The maximum size in Kbytes for the generated initramfs image size.
> +# Usually, it should be less than 1/2 of ram size, or you may fail to
> +# boot it.
> +INITRAMFS_MAXSIZE ??= "131072"
> +
>  DEFAULT_TASK_PROVIDER ?= "packagegroup-base"
>  MACHINE_TASK_PROVIDER ?= "${DEFAULT_TASK_PROVIDER}"
>
> --
> 1.7.9.5
>
> --
> _______________________________________________
> Openembedded-core mailing list
> Openembedded-core@lists.openembedded.org
> http://lists.openembedded.org/mailman/listinfo/openembedded-core
>

[-- Attachment #2: Type: text/html, Size: 5084 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH 1/1] image.bbclass: check INITRAMFS_MAXSIZE
  2016-01-25 16:30   ` Scott Rifenbark
@ 2016-01-26  1:20     ` Robert Yang
  0 siblings, 0 replies; 4+ messages in thread
From: Robert Yang @ 2016-01-26  1:20 UTC (permalink / raw)
  To: Scott Rifenbark; +Cc: openembedded-core



On 01/26/2016 12:30 AM, Scott Rifenbark wrote:
> Hi,
>
> I noticed we do not document INITRAMFS_MAXSIZE in the ref-manual.  Should we be?

Yes, I will update the doc after the patch is merged.

// Robert

>
> Thanks,
> Scott
>
> On Mon, Jan 25, 2016 at 12:45 AM, Robert Yang <liezhi.yang@windriver.com
> <mailto:liezhi.yang@windriver.com>> wrote:
>
>     Usually, the initramfs' maxsize can be 1/2 of ram size since modern
>     kernel uses tmpfs as initramfs by dafault, and tmpfs allocates 1/2 of
>     ram by default at boot time, which will be used to locate the initramfs.
>
>     Set INITRAMFS_MAXSIZE to 131072K (128M) by default (ram 256M), the
>     initramfs is small usually, for example, core-image-minimal-initramfs is
>     about 21M (uncompressed, 17M * 1.3) by default, but if the user add a
>     lot pkgs to initramfs, we can error and stop to let the user know ealier
>     rather than fail to boot (e.g., OOM-killer) at boot time.
>
>     Please see the bug for more info:
>     https://bugzilla.yoctoproject.org/show_bug.cgi?id=5963
>
>     [YOCTO #5963]
>
>     Signed-off-by: Robert Yang <liezhi.yang@windriver.com
>     <mailto:liezhi.yang@windriver.com>>
>     ---
>       meta/classes/image.bbclass |   14 +++++++++++++-
>       meta/conf/bitbake.conf     |    6 ++++++
>       2 files changed, 19 insertions(+), 1 deletion(-)
>
>     diff --git a/meta/classes/image.bbclass b/meta/classes/image.bbclass
>     index 3870516..30d1173 100644
>     --- a/meta/classes/image.bbclass
>     +++ b/meta/classes/image.bbclass
>     @@ -423,6 +423,9 @@ def get_rootfs_size(d):
>           rootfs_req_size = int(d.getVar('IMAGE_ROOTFS_SIZE', True))
>           rootfs_extra_space = eval(d.getVar('IMAGE_ROOTFS_EXTRA_SPACE', True))
>           rootfs_maxsize = d.getVar('IMAGE_ROOTFS_MAXSIZE', True)
>     +    image_fstypes = d.getVar('IMAGE_FSTYPES', True) or ''
>     +    initramfs_fstypes = d.getVar('INITRAMFS_FSTYPES', True) or ''
>     +    initramfs_maxsize = d.getVar('INITRAMFS_MAXSIZE', True)
>
>           output = subprocess.check_output(['du', '-ks',
>                                             d.getVar('IMAGE_ROOTFS', True)])
>     @@ -443,8 +446,17 @@ def get_rootfs_size(d):
>           if rootfs_maxsize:
>               rootfs_maxsize_int = int(rootfs_maxsize)
>               if base_size > rootfs_maxsize_int:
>     -            bb.fatal("The rootfs size %d(K) overrides the max size %d(K)" % \
>     +            bb.fatal("The rootfs size %d(K) overrides IMAGE_ROOTFS_MAXSIZE:
>     %d(K)" % \
>                       (base_size, rootfs_maxsize_int))
>     +
>     +    # Check the initramfs size against INITRAMFS_MAXSIZE (if set)
>     +    if image_fstypes == initramfs_fstypes != ''  and initramfs_maxsize:
>     +        initramfs_maxsize_int = int(initramfs_maxsize)
>     +        if base_size > initramfs_maxsize_int:
>     +            bb.error("The initramfs size %d(K) overrides INITRAMFS_MAXSIZE:
>     %d(K)" % \
>     +                (base_size, initramfs_maxsize_int))
>     +            bb.error("You can set INITRAMFS_MAXSIZE a larger value.
>     Usually, it should")
>     +            bb.fatal("be less than 1/2 of ram size, or you may fail to boot
>     it.\n")
>           return base_size
>
>       python set_image_size () {
>     diff --git a/meta/conf/bitbake.conf b/meta/conf/bitbake.conf
>     index 7451eb8..e80ee18 100644
>     --- a/meta/conf/bitbake.conf
>     +++ b/meta/conf/bitbake.conf
>     @@ -712,7 +712,13 @@ require conf/sanity.conf
>       DL_DIR ?= "${TOPDIR}/downloads"
>       SSTATE_DIR ?= "${TOPDIR}/sstate-cache"
>       IMAGE_FSTYPES ?= "tar.gz"
>     +
>       INITRAMFS_FSTYPES ?= "cpio.gz"
>     +# The maximum size in Kbytes for the generated initramfs image size.
>     +# Usually, it should be less than 1/2 of ram size, or you may fail to
>     +# boot it.
>     +INITRAMFS_MAXSIZE ??= "131072"
>     +
>       DEFAULT_TASK_PROVIDER ?= "packagegroup-base"
>       MACHINE_TASK_PROVIDER ?= "${DEFAULT_TASK_PROVIDER}"
>
>     --
>     1.7.9.5
>
>     --
>     _______________________________________________
>     Openembedded-core mailing list
>     Openembedded-core@lists.openembedded.org
>     <mailto:Openembedded-core@lists.openembedded.org>
>     http://lists.openembedded.org/mailman/listinfo/openembedded-core
>
>


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2016-01-26  1:20 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-01-25  8:45 [PATCH 0/1] image.bbclass: check INITRAMFS_MAXSIZE Robert Yang
2016-01-25  8:45 ` [PATCH 1/1] " Robert Yang
2016-01-25 16:30   ` Scott Rifenbark
2016-01-26  1:20     ` Robert Yang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox