]> code.ossystems Code Review - openembedded-core.git/commitdiff
kernel.bbclass: update KERNEL_IMAGE_MAXSIZE
authorRobert Yang <liezhi.yang@windriver.com>
Mon, 7 Jul 2014 09:33:59 +0000 (02:33 -0700)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Thu, 10 Jul 2014 16:37:38 +0000 (17:37 +0100)
* 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>
Signed-off-by: Saul Wold <sgw@linux.intel.com>
meta/classes/kernel.bbclass

index f5d725878f80ea74920daa188f9e9c135a5ddfd4..b2e9d4cb363150c4976c240a96bbbbea6643e1ae 100644 (file)
@@ -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
 }