summaryrefslogtreecommitdiff
path: root/classes/magicbox-image.bbclass
diff options
context:
space:
mode:
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; "