]> code.ossystems Code Review - openembedded-core.git/commitdiff
kernel.bbclass: added task which check size of kernel image
authorMarcin Juszkiewicz <hrw@openedhand.com>
Thu, 6 Dec 2007 09:43:11 +0000 (09:43 +0000)
committerMarcin Juszkiewicz <hrw@openedhand.com>
Thu, 6 Dec 2007 09:43:11 +0000 (09:43 +0000)
Code was taken from linux.inc, variable with size is KERNEL_IMAGE_MAXSIZE

git-svn-id: https://svn.o-hand.com/repos/poky/trunk@3314 311d38ba-8fff-0310-9ca6-ca027cbcb966

meta/classes/kernel.bbclass

index 5976f42c7196d52a6369b2a40411ae09da0f822c..320a2cf71a97467fe0299c302d88c4763a91c7c2 100644 (file)
@@ -415,3 +415,17 @@ python populate_packages_prepend () {
        packages.append(metapkg)
        bb.data.setVar('PACKAGES', ' '.join(packages), d)
 }
+
+# Support checking the kernel size since some kernels need to reside in partitions
+# with a fixed length or there is a limit in transferring the kernel to memory
+do_sizecheck() {
+        if [ ! -z "${KERNEL_IMAGE_MAXSIZE}" ]; then
+            size=`ls -l arch/${ARCH}/boot/${KERNEL_IMAGETYPE} | awk '{ print $5}'`
+            if [ $size -ge ${KERNEL_IMAGE_MAXSIZE} ]; then
+                    rm arch/${ARCH}/boot/${KERNEL_IMAGETYPE}
+                    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."
+            fi
+        fi
+}
+
+addtask sizecheck before do_install after do_compile