summaryrefslogtreecommitdiff
path: root/classes
diff options
context:
space:
mode:
authorFlorian Boor <florian.boor@kernelconcepts.de>2007-03-22 18:01:19 +0000
committerFlorian Boor <florian.boor@kernelconcepts.de>2007-03-22 18:01:19 +0000
commitb2cf68047b3775511c137b6c01545ca82ebcf714 (patch)
treeedec974bffa7b63d0c04574f9e03cac5982f0315 /classes
parent5f96bdfd284a81a45cf7999ec858287fb3d1b8be (diff)
parentc72e871b23455c2e2aec864ebb46976b943e73f3 (diff)
merge of '30ed2981d1b51e1b7515fb7bad6e1447ce6ab4e5'
and 'bbd309bb8f001be39eda61e970699d345467347c'
Diffstat (limited to 'classes')
-rw-r--r--classes/storcenter-image.bbclass30
1 files changed, 30 insertions, 0 deletions
diff --git a/classes/storcenter-image.bbclass b/classes/storcenter-image.bbclass
new file mode 100644
index 0000000000..de77f1b417
--- /dev/null
+++ b/classes/storcenter-image.bbclass
@@ -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
+}