aboutsummaryrefslogtreecommitdiffstats
path: root/meta/classes/image.bbclass
diff options
context:
space:
mode:
authorRobert Yang <liezhi.yang@windriver.com>2016-01-25 00:45:59 -0800
committerRichard Purdie <richard.purdie@linuxfoundation.org>2016-01-26 22:31:09 +0000
commit155ba626b46bf71acde6c24402fce1682da53b90 (patch)
tree138701811f0554a238d1c84055b8e3c376cfd9ce /meta/classes/image.bbclass
parenta9db2b514e1f1093cd80a7793813136f26e531da (diff)
downloadopenembedded-core-155ba626b46bf71acde6c24402fce1682da53b90.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] Signed-off-by: Robert Yang <liezhi.yang@windriver.com> Signed-off-by: Ross Burton <ross.burton@intel.com>
Diffstat (limited to 'meta/classes/image.bbclass')
-rw-r--r--meta/classes/image.bbclass14
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):
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 () {