MAINTAINERS: add vala to my recipe list
[openembedded.git] / classes / storcenter-image.bbclass
blobde77f1b417ab240173d50db7c45b3cb9d0f24c81
1 storcenter_pack_image() {
2         # find latest kernel
3         KERNEL=`ls -tr ${DEPLOY_DIR_IMAGE}/uImage* | tail -1`
4         if [ -z "$KERNEL" ]; then
5                 oefatal "No kernel found in ${DEPLOY_DIR_IMAGE}. Bitbake linux-storcenter to create one."
6                 exit 1
7         fi
8         ROOTFS=${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.rootfs.jffs2
9         OUTPUT=${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.flash.img
10         PADFILE=${DEPLOY_DIR_IMAGE}/padfile.zzz
11         HEX_MAX_KERN_SIZE=170000
12         DEC_MAX_KERN_SIZE=`echo "ibase=16; $HEX_MAX_KERN_SIZE" | bc `
13         HEX_MAX_ROOT_SIZE=590000
14         DEC_MAX_ROOT_SIZE=`echo "ibase=16; $HEX_MAX_ROOT_SIZE" | bc `
15         KERNEL_SIZE=`ls -l $KERNEL | awk '{print $5}'`
16         if [ $KERNEL_SIZE -gt $DEC_MAX_KERN_SIZE ]; then
17                 oefatal "Kernel too large at $KERNEL_SIZE bytes.  Max is $DEC_MAX_KERN_SIZE."
18                 exit 1
19         fi
20         ROOT_SIZE=`ls -l $ROOTFS | awk '{print $5}'`
21         if [ $ROOT_SIZE -gt $DEC_MAX_ROOT_SIZE ]; then
22                 oefatal "Rootfs is too large at $ROOT_SIZE bytes.  Max is $DEC_MAX_ROOT_SIZE."
23                 exit 1
24         fi
25         PAD_SIZE=`echo "$DEC_MAX_KERN_SIZE - $KERNEL_SIZE" | bc `
26         dd if=/dev/zero of=$PADFILE bs=$PAD_SIZE count=1 2>>/dev/null
27         cat $KERNEL $PADFILE $ROOTFS > $OUTPUT
28         rm -f $PADFILE
29         ls -l $OUTPUT