diff options
author | Rolf Leggewie <oe-devel@rolf.leggewie.biz> | 2007-03-21 23:22:30 +0000 |
---|---|---|
committer | Rolf Leggewie <oe-devel@rolf.leggewie.biz> | 2007-03-21 23:22:30 +0000 |
commit | aae9de2a89a3b6464ba893df30e711b574aa1467 (patch) | |
tree | 1097aac5849b0d58bf0b8c290d7cfba421d92bcf /classes/storcenter-image.bbclass | |
parent | a0c00ff8342e3b41f3feb60b3710665ea7879546 (diff) | |
parent | df30e95c8af93e2fafac7cc7bca7ef0f4c27e035 (diff) |
merge of '6c7f9afdafc67f5e5a8263301ca0cfce430be173'
and '8ee01e7aef977a6c51cf71b7d11f65f42e0dc413'
Diffstat (limited to 'classes/storcenter-image.bbclass')
-rw-r--r-- | classes/storcenter-image.bbclass | 30 |
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 +} |