diff options
author | Robert Yang <liezhi.yang@windriver.com> | 2016-01-25 00:45:59 -0800 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2016-01-26 22:31:59 +0000 |
commit | 8a2dfa16917aca821caf1a1d9b53faa3b025656c (patch) | |
tree | d4546ab82f37795e26075c12497365210f93e4b5 /meta/classes | |
parent | 962cc37c534cfbd23febe494d1c5f07de2e154ae (diff) | |
download | poky-8a2dfa16917aca821caf1a1d9b53faa3b025656c.tar.gz |
image.bbclass: check INITRAMFS_MAXSIZE
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]
(From OE-Core rev: 155ba626b46bf71acde6c24402fce1682da53b90)
Signed-off-by: Robert Yang <liezhi.yang@windriver.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/classes')
-rw-r--r-- | meta/classes/image.bbclass | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/meta/classes/image.bbclass b/meta/classes/image.bbclass index 797f342521..56a49e7dd4 100644 --- a/meta/classes/image.bbclass +++ b/meta/classes/image.bbclass | |||
@@ -423,6 +423,9 @@ def get_rootfs_size(d): | |||
423 | rootfs_req_size = int(d.getVar('IMAGE_ROOTFS_SIZE', True)) | 423 | rootfs_req_size = int(d.getVar('IMAGE_ROOTFS_SIZE', True)) |
424 | rootfs_extra_space = eval(d.getVar('IMAGE_ROOTFS_EXTRA_SPACE', True)) | 424 | rootfs_extra_space = eval(d.getVar('IMAGE_ROOTFS_EXTRA_SPACE', True)) |
425 | rootfs_maxsize = d.getVar('IMAGE_ROOTFS_MAXSIZE', True) | 425 | rootfs_maxsize = d.getVar('IMAGE_ROOTFS_MAXSIZE', True) |
426 | image_fstypes = d.getVar('IMAGE_FSTYPES', True) or '' | ||
427 | initramfs_fstypes = d.getVar('INITRAMFS_FSTYPES', True) or '' | ||
428 | initramfs_maxsize = d.getVar('INITRAMFS_MAXSIZE', True) | ||
426 | 429 | ||
427 | output = subprocess.check_output(['du', '-ks', | 430 | output = subprocess.check_output(['du', '-ks', |
428 | d.getVar('IMAGE_ROOTFS', True)]) | 431 | d.getVar('IMAGE_ROOTFS', True)]) |
@@ -443,8 +446,17 @@ def get_rootfs_size(d): | |||
443 | if rootfs_maxsize: | 446 | if rootfs_maxsize: |
444 | rootfs_maxsize_int = int(rootfs_maxsize) | 447 | rootfs_maxsize_int = int(rootfs_maxsize) |
445 | if base_size > rootfs_maxsize_int: | 448 | if base_size > rootfs_maxsize_int: |
446 | bb.fatal("The rootfs size %d(K) overrides the max size %d(K)" % \ | 449 | bb.fatal("The rootfs size %d(K) overrides IMAGE_ROOTFS_MAXSIZE: %d(K)" % \ |
447 | (base_size, rootfs_maxsize_int)) | 450 | (base_size, rootfs_maxsize_int)) |
451 | |||
452 | # Check the initramfs size against INITRAMFS_MAXSIZE (if set) | ||
453 | if image_fstypes == initramfs_fstypes != '' and initramfs_maxsize: | ||
454 | initramfs_maxsize_int = int(initramfs_maxsize) | ||
455 | if base_size > initramfs_maxsize_int: | ||
456 | bb.error("The initramfs size %d(K) overrides INITRAMFS_MAXSIZE: %d(K)" % \ | ||
457 | (base_size, initramfs_maxsize_int)) | ||
458 | bb.error("You can set INITRAMFS_MAXSIZE a larger value. Usually, it should") | ||
459 | bb.fatal("be less than 1/2 of ram size, or you may fail to boot it.\n") | ||
448 | return base_size | 460 | return base_size |
449 | 461 | ||
450 | python set_image_size () { | 462 | python set_image_size () { |