Fix Angstrom OVERRIDES settings
[openembedded.git] / classes / turbostation-image.bbclass
blob5a0768c6875042998a09ade910d66d9d0e23ea07
1 turbostation_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-turbostation 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=200000
12         DEC_MAX_KERN_SIZE=`echo "ibase=16; $HEX_MAX_KERN_SIZE" | bc `
13         HEX_MAX_ROOT_SIZE=D00000
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
32 IMAGE_POSTPROCESS_COMMAND += "turbostation_pack_image; "