[oe-commits] org.oe.dev storcenter: Add storcenter-image.bbclass

nail commit openembedded-commits at lists.openembedded.org
Wed Mar 21 10:38:14 UTC 2007


storcenter: Add storcenter-image.bbclass

Author: nail at nslu2-linux.org
Branch: org.openembedded.dev
Revision: 02a6624c71727e9ca8fc9cb4497b838837b84379
ViewMTN: http://monotone.openembedded.org/revision.psp?id=02a6624c71727e9ca8fc9cb4497b838837b84379
Files:
1
classes/storcenter-image.bbclass
Diffs:

#
# mt diff -r448c7bd2f430c87d1241d5485defdae27d2ac3f7 -r02a6624c71727e9ca8fc9cb4497b838837b84379
#
# 
# 
# add_file "classes/storcenter-image.bbclass"
#  content [0bb6bdfb4515717b3fc24a7a112ed42e7a9df926]
# 
============================================================
--- classes/storcenter-image.bbclass	0bb6bdfb4515717b3fc24a7a112ed42e7a9df926
+++ classes/storcenter-image.bbclass	0bb6bdfb4515717b3fc24a7a112ed42e7a9df926
@@ -0,0 +1,30 @@
+storcenter_pack_image() {
+        # find latest kernel
+        KERNEL=`ls -tr ${DEPLOY_DIR_IMAGE}/uImage* | tail -1`
+        if [ -z "$KERNEL" ]; then
+                oefatal "No kernel found in ${DEPLOY_DIR_IMAGE}. Bitbake linux-storcenter to create one."
+                exit 1
+        fi
+        ROOTFS=${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.rootfs.jffs2
+        OUTPUT=${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.flash.img
+        PADFILE=${DEPLOY_DIR_IMAGE}/padfile.zzz
+        HEX_MAX_KERN_SIZE=170000
+        DEC_MAX_KERN_SIZE=`echo "ibase=16; $HEX_MAX_KERN_SIZE" | bc `
+        HEX_MAX_ROOT_SIZE=590000
+        DEC_MAX_ROOT_SIZE=`echo "ibase=16; $HEX_MAX_ROOT_SIZE" | bc `
+        KERNEL_SIZE=`ls -l $KERNEL | awk '{print $5}'`
+        if [ $KERNEL_SIZE -gt $DEC_MAX_KERN_SIZE ]; then
+                oefatal "Kernel too large at $KERNEL_SIZE bytes.  Max is $DEC_MAX_KERN_SIZE."
+                exit 1
+        fi
+        ROOT_SIZE=`ls -l $ROOTFS | awk '{print $5}'`
+        if [ $ROOT_SIZE -gt $DEC_MAX_ROOT_SIZE ]; then
+                oefatal "Rootfs is too large at $ROOT_SIZE bytes.  Max is $DEC_MAX_ROOT_SIZE."
+                exit 1
+        fi
+        PAD_SIZE=`echo "$DEC_MAX_KERN_SIZE - $KERNEL_SIZE" | bc `
+        dd if=/dev/zero of=$PADFILE bs=$PAD_SIZE count=1 2>>/dev/null
+        cat $KERNEL $PADFILE $ROOTFS > $OUTPUT
+        rm -f $PADFILE
+        ls -l $OUTPUT
+}






More information about the Openembedded-commits mailing list