Openembedded Core Discussions
 help / color / mirror / Atom feed
* [PATCH 0/3] meta: check IMAGE_ROOTFS_MAXSIZE and KERNEL_IMAGE_MAXSIZE (if set)
@ 2014-07-07  9:33 Robert Yang
  2014-07-07  9:33 ` [PATCH 1/3] lib/oe/image.py: check the rootfs size against IMAGE_ROOTFS_MAXSIZE Robert Yang
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Robert Yang @ 2014-07-07  9:33 UTC (permalink / raw)
  To: openembedded-core

The following changes since commit c452b098b4c021d4cbeddf5bf13f7fd9b1cc9224:

  Revert "meta-yocto-bsp: oeqa/controllers: add GrubTarget" (2014-07-04 08:45:10 +0100)

are available in the git repository at:

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

Robert Yang (3):
  lib/oe/image.py: check the rootfs size against IMAGE_ROOTFS_MAXSIZE
  kernel.bbclass: update KERNEL_IMAGE_MAXSIZE
  local.conf.sample.extended: add KERNEL_IMAGE_MAXSIZE and
    IMAGE_ROOTFS_MAXSIZE

 meta/classes/kernel.bbclass          |    9 ++++++---
 meta/conf/bitbake.conf               |    4 ++++
 meta/conf/local.conf.sample.extended |    8 ++++++++
 meta/lib/oe/image.py                 |    8 ++++++++
 4 files changed, 26 insertions(+), 3 deletions(-)

-- 
1.7.9.5



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

* [PATCH 1/3] lib/oe/image.py: check the rootfs size against IMAGE_ROOTFS_MAXSIZE
  2014-07-07  9:33 [PATCH 0/3] meta: check IMAGE_ROOTFS_MAXSIZE and KERNEL_IMAGE_MAXSIZE (if set) Robert Yang
@ 2014-07-07  9:33 ` Robert Yang
  2014-07-07  9:33 ` [PATCH 2/3] kernel.bbclass: update KERNEL_IMAGE_MAXSIZE Robert Yang
  2014-07-07  9:34 ` [PATCH 3/3] local.conf.sample.extended: add KERNEL_IMAGE_MAXSIZE and IMAGE_ROOTFS_MAXSIZE Robert Yang
  2 siblings, 0 replies; 4+ messages in thread
From: Robert Yang @ 2014-07-07  9:33 UTC (permalink / raw)
  To: openembedded-core

* Check the rootfs size against IMAGE_ROOTFS_MAXSIZE (if set)
* Add comments for IMAGE_ROOTFS_SIZE to not confuse with IMAGE_ROOTFS_MAXSIZE

[YOCTO #2610]

Signed-off-by: Robert Yang <liezhi.yang@windriver.com>
---
 meta/conf/bitbake.conf |    4 ++++
 meta/lib/oe/image.py   |    8 ++++++++
 2 files changed, 12 insertions(+)

diff --git a/meta/conf/bitbake.conf b/meta/conf/bitbake.conf
index 311e9a0..f4870d5 100644
--- a/meta/conf/bitbake.conf
+++ b/meta/conf/bitbake.conf
@@ -688,6 +688,10 @@ IMAGE_FSTYPES ?= "tar.gz"
 INITRAMFS_FSTYPES ?= "cpio.gz"
 DEFAULT_TASK_PROVIDER ?= "packagegroup-base"
 MACHINE_TASK_PROVIDER ?= "${DEFAULT_TASK_PROVIDER}"
+
+# The size in Kbytes for the generated image if it is larger than
+# the required size (du -ks IMAGE_ROOTFS * IMAGE_OVERHEAD_FACTOR),
+# and no effect if less than it.
 IMAGE_ROOTFS_SIZE ?= "65536"
 
 # Forcefully set CACHE now so future changes to things like 
diff --git a/meta/lib/oe/image.py b/meta/lib/oe/image.py
index c9b9033..354a676 100644
--- a/meta/lib/oe/image.py
+++ b/meta/lib/oe/image.py
@@ -144,6 +144,7 @@ class Image(ImageDepGraph):
         overhead_factor = float(self.d.getVar('IMAGE_OVERHEAD_FACTOR', True))
         rootfs_req_size = int(self.d.getVar('IMAGE_ROOTFS_SIZE', True))
         rootfs_extra_space = eval(self.d.getVar('IMAGE_ROOTFS_EXTRA_SPACE', True))
+        rootfs_maxsize = self.d.getVar('IMAGE_ROOTFS_MAXSIZE', True)
 
         output = subprocess.check_output(['du', '-ks',
                                           self.d.getVar('IMAGE_ROOTFS', True)])
@@ -158,6 +159,13 @@ class Image(ImageDepGraph):
         base_size += rootfs_alignment - 1
         base_size -= base_size % rootfs_alignment
 
+        # Check the rootfs size against IMAGE_ROOTFS_MAXSIZE (if set)
+        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)" % \
+                    (base_size, rootfs_maxsize_int))
+
         return base_size
 
     def _create_symlinks(self, subimages):
-- 
1.7.9.5



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

* [PATCH 2/3] kernel.bbclass: update KERNEL_IMAGE_MAXSIZE
  2014-07-07  9:33 [PATCH 0/3] meta: check IMAGE_ROOTFS_MAXSIZE and KERNEL_IMAGE_MAXSIZE (if set) Robert Yang
  2014-07-07  9:33 ` [PATCH 1/3] lib/oe/image.py: check the rootfs size against IMAGE_ROOTFS_MAXSIZE Robert Yang
@ 2014-07-07  9:33 ` Robert Yang
  2014-07-07  9:34 ` [PATCH 3/3] local.conf.sample.extended: add KERNEL_IMAGE_MAXSIZE and IMAGE_ROOTFS_MAXSIZE Robert Yang
  2 siblings, 0 replies; 4+ messages in thread
From: Robert Yang @ 2014-07-07  9:33 UTC (permalink / raw)
  To: openembedded-core

* Make KERNEL_IMAGE_MAXSIZE and IMAGE_ROOTFS_SIZE have the same algorithm:
  - Use Kbytes as the unit since we use this in other codes.
  - Use "du" rather than "ls" to figure out the size since we use this in
    image.py.

[YOCTO #2610]

Signed-off-by: Robert Yang <liezhi.yang@windriver.com>
---
 meta/classes/kernel.bbclass |    9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/meta/classes/kernel.bbclass b/meta/classes/kernel.bbclass
index f5d7258..b2e9d4c 100644
--- a/meta/classes/kernel.bbclass
+++ b/meta/classes/kernel.bbclass
@@ -422,10 +422,13 @@ addtask do_strip before do_sizecheck after do_kernel_link_vmlinux
 # with a fixed length or there is a limit in transferring the kernel to memory
 do_sizecheck() {
 	if [ ! -z "${KERNEL_IMAGE_MAXSIZE}" ]; then
-		cd ${B}
-		size=`ls -lL ${KERNEL_OUTPUT} | awk '{ print $5}'`
+		invalid=`echo ${KERNEL_IMAGE_MAXSIZE} | sed 's/[0-9]//g'`
+		if [ -n "$invalid" ]; then
+			die "Invalid KERNEL_IMAGE_MAXSIZE: ${KERNEL_IMAGE_MAXSIZE}, should be an integerx (The unit is Kbytes)"
+		fi
+		size=`du -ks ${B}/${KERNEL_OUTPUT} | awk '{ print $1}'`
 		if [ $size -ge ${KERNEL_IMAGE_MAXSIZE} ]; then
-			die "This kernel (size=$size > ${KERNEL_IMAGE_MAXSIZE}) is too big for your device. Please reduce the size of the kernel by making more of it modular."
+			die "This kernel (size=$size(K) > ${KERNEL_IMAGE_MAXSIZE}(K)) is too big for your device. Please reduce the size of the kernel by making more of it modular."
 		fi
 	fi
 }
-- 
1.7.9.5



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

* [PATCH 3/3] local.conf.sample.extended: add KERNEL_IMAGE_MAXSIZE and IMAGE_ROOTFS_MAXSIZE
  2014-07-07  9:33 [PATCH 0/3] meta: check IMAGE_ROOTFS_MAXSIZE and KERNEL_IMAGE_MAXSIZE (if set) Robert Yang
  2014-07-07  9:33 ` [PATCH 1/3] lib/oe/image.py: check the rootfs size against IMAGE_ROOTFS_MAXSIZE Robert Yang
  2014-07-07  9:33 ` [PATCH 2/3] kernel.bbclass: update KERNEL_IMAGE_MAXSIZE Robert Yang
@ 2014-07-07  9:34 ` Robert Yang
  2 siblings, 0 replies; 4+ messages in thread
From: Robert Yang @ 2014-07-07  9:34 UTC (permalink / raw)
  To: openembedded-core

[YOCTO #2610]

Signed-off-by: Robert Yang <liezhi.yang@windriver.com>
---
 meta/conf/local.conf.sample.extended |    8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/meta/conf/local.conf.sample.extended b/meta/conf/local.conf.sample.extended
index b156319..4bd33a2 100644
--- a/meta/conf/local.conf.sample.extended
+++ b/meta/conf/local.conf.sample.extended
@@ -331,3 +331,11 @@
 # feed layout is used where package files are placed in <outdir>/<arch>/.
 #
 #IPK_HIERARCHICAL_FEED = "1"
+
+# Checks the kernel image size against KERNEL_IMAGE_MAXSIZE (The unit is
+# Kbytes)
+#KERNEL_IMAGE_MAXSIZE = "8192"
+#
+# Check the rootfs size against IMAGE_ROOTFS_MAXSIZE (The unit is
+# Kbytes)
+#IMAGE_ROOTFS_MAXSIZE = "65536"
-- 
1.7.9.5



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

end of thread, other threads:[~2014-07-07  9:34 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-07-07  9:33 [PATCH 0/3] meta: check IMAGE_ROOTFS_MAXSIZE and KERNEL_IMAGE_MAXSIZE (if set) Robert Yang
2014-07-07  9:33 ` [PATCH 1/3] lib/oe/image.py: check the rootfs size against IMAGE_ROOTFS_MAXSIZE Robert Yang
2014-07-07  9:33 ` [PATCH 2/3] kernel.bbclass: update KERNEL_IMAGE_MAXSIZE Robert Yang
2014-07-07  9:34 ` [PATCH 3/3] local.conf.sample.extended: add KERNEL_IMAGE_MAXSIZE and IMAGE_ROOTFS_MAXSIZE Robert Yang

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