summaryrefslogtreecommitdiff
path: root/classes/magicbox-image.bbclass
diff options
context:
space:
mode:
authorStelios Koroneos <skoroneos@digital-opsis.com>2007-05-04 08:43:23 +0000
committerStelios Koroneos <skoroneos@digital-opsis.com>2007-05-04 08:43:23 +0000
commit42ddc315311e58bb3bbb75db06ef5743466a62a5 (patch)
treefb91c52a47dab680ba5fd339ddd477390e1178b4 /classes/magicbox-image.bbclass
parentbafa9b3ec1bd91cd710d587a31b58db4c1e2a503 (diff)
classes/magicbox-image.bbclass: Add a class that handles the generation of flash images for Magicbox
It creates "ready-to-burn" squashfs and squashfs-lza images and a single file kernel+jffs2 image
Diffstat (limited to 'classes/magicbox-image.bbclass')
-rw-r--r--classes/magicbox-image.bbclass37
1 files changed, 37 insertions, 0 deletions
diff --git a/classes/magicbox-image.bbclass b/classes/magicbox-image.bbclass
new file mode 100644
index 0000000000..05de28b76b
--- /dev/null
+++ b/classes/magicbox-image.bbclass
@@ -0,0 +1,37 @@
+magicbox_gen_images() {
+ # find latest kernel
+ KERNEL=`ls -tr ${DEPLOY_DIR_IMAGE}/uImage* | tail -1`
+ if [ -z "$KERNEL" ]; then
+ oefatal "No kernel found in ${DEPLOY_DIR_IMAGE}. Exiting !"
+ exit 1
+ fi
+
+ #squashfs
+ #We need to prep the image so that u-boot recognizes it
+ mv ${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.rootfs.squashfs ${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.squashfs.bin
+ ${STAGING_BINDIR_NATIVE}/mkimage -A ppc -O linux -T ramdisk -C none -n "OPLinux-uclibc-squashfs" \
+ -d ${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.squashfs.bin ${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.rootfs.squashfs
+ rm -f ${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.squashfs.bin
+
+
+ #squashfs-lzma
+ #same as squashfs
+ mv ${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.rootfs.squashfs-lzma ${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.squashfs-lzma.bin
+ ${STAGING_BINDIR_NATIVE}/mkimage -A ppc -O linux -T ramdisk -C none -n "OPLinux-uclibc-squashfs-lzma" \
+ -d ${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.squashfs-lzma.bin ${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.rootfs.squashfs-lzma
+ rm -f ${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.squashfs-lzma.bin
+
+ #kernel+jffs2 in a single image
+ #Add jffs2 marker at the end of the rootfs file
+ echo -ne '\xde\xad\xc0\xde' >> ${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.rootfs.jffs2
+
+
+ ( dd if=$KERNEL bs=65536 conv=sync; \
+ dd if=${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.rootfs.jffs2 bs=65536 conv=sync; \
+ ) > ${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.jffs2.flash.bin
+
+}
+
+
+
+IMAGE_POSTPROCESS_COMMAND += "magicbox_gen_images; "