summaryrefslogtreecommitdiff
path: root/classes/turbostation-image.bbclass
diff options
context:
space:
mode:
authorOyvind Repvik <nail@nslu2-linux.org>2007-03-18 23:27:28 +0000
committerOyvind Repvik <nail@nslu2-linux.org>2007-03-18 23:27:28 +0000
commit5fb7f282ceab4ad5655ef46c04d14fc51bc4c245 (patch)
tree408a0e97cf5367d9d25a6ec56f63a33662175370 /classes/turbostation-image.bbclass
parent2225bb697129c9be8ca2b79f7930798bf9f72167 (diff)
foonas: Move image-stuff to classes for lsppchg, lsppchd, n2100 and turbostation
Diffstat (limited to 'classes/turbostation-image.bbclass')
-rw-r--r--classes/turbostation-image.bbclass35
1 files changed, 35 insertions, 0 deletions
diff --git a/classes/turbostation-image.bbclass b/classes/turbostation-image.bbclass
new file mode 100644
index 0000000000..d82e3996d5
--- /dev/null
+++ b/classes/turbostation-image.bbclass
@@ -0,0 +1,35 @@
+EXTRA_IMAGECMD = "--big-endian"
+ERASEBLOCK_SIZE = "0x20000"
+IMAGE_FSTYPES = "jffs2"
+IMAGE_POSTPROCESS_COMMAND += '${MACHINE}_pack_image;'
+
+turbostation_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-turbostation 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=200000
+ DEC_MAX_KERN_SIZE=`echo "ibase=16; $HEX_MAX_KERN_SIZE" | bc `
+ HEX_MAX_ROOT_SIZE=D00000
+ 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
+}