summaryrefslogtreecommitdiff
path: root/contrib
diff options
context:
space:
mode:
authorMichael Lauer <mickey@vanille-media.de>2008-02-06 16:42:44 +0000
committerMichael Lauer <mickey@vanille-media.de>2008-02-06 16:42:44 +0000
commit8f29644efce44f9059fb290b644047caf9146c1b (patch)
tree48988acb0aae4225fb1ef2c5599dba659ad6744d /contrib
parent670cceb7f604c6ad6edf47431326434574fbf114 (diff)
parent1b7fb667944736d86e8b483727f87998083e8972 (diff)
merge of '298797d86056bd55b8e0191685cb8ae42de55f7d'
and 'e3a17e2ff263cac6d4b035034dc79a0e05fc548d'
Diffstat (limited to 'contrib')
-rw-r--r--contrib/image-convert/.mtn2git_empty0
-rw-r--r--contrib/image-convert/README5
-rwxr-xr-xcontrib/image-convert/cpio2tar9
-rwxr-xr-xcontrib/image-convert/tar2ext225
-rwxr-xr-xcontrib/image-convert/tar2ext2.mount25
-rwxr-xr-xcontrib/image-convert/tar2jffs8
6 files changed, 72 insertions, 0 deletions
diff --git a/contrib/image-convert/.mtn2git_empty b/contrib/image-convert/.mtn2git_empty
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/contrib/image-convert/.mtn2git_empty
diff --git a/contrib/image-convert/README b/contrib/image-convert/README
new file mode 100644
index 0000000000..9daca60703
--- /dev/null
+++ b/contrib/image-convert/README
@@ -0,0 +1,5 @@
+This directory contains scripts to convert (root) filesystem images from one
+format to another. While OpenEmbedded has extensive support for generating
+images in various formats, sometimes it may be useful/needed to convert
+already existing image.
+
diff --git a/contrib/image-convert/cpio2tar b/contrib/image-convert/cpio2tar
new file mode 100755
index 0000000000..7f2c92fe26
--- /dev/null
+++ b/contrib/image-convert/cpio2tar
@@ -0,0 +1,9 @@
+#!/bin/sh
+
+STAGING= #~/linux-ppc/build-oe-angstrom/tmp/staging/i686-linux/bin/
+
+${STAGING}fakeroot bash -c " \
+rm -rf scratch; mkdir scratch; \
+cd scratch; gzip -d -c ../$1 | cpio -i --make-directories; \
+cd ..; \
+tar -cj -C scratch -f $(basename $1 .cpio.gz).tar.bz2 ."
diff --git a/contrib/image-convert/tar2ext2 b/contrib/image-convert/tar2ext2
new file mode 100755
index 0000000000..d5756a4733
--- /dev/null
+++ b/contrib/image-convert/tar2ext2
@@ -0,0 +1,25 @@
+#!/bin/sh
+
+if [ $# -ne 2 ]; then
+ echo "Usage: $0 <tarball> <ext2 size>"
+ exit
+fi
+
+ext=`echo $1 | sed -r -e 's/.+\.([^.]+\.[^.]+)/\1/'`
+base=$(basename $1 .$ext)
+dir=$(dirname $1)
+
+if [ "$ext" == "tar.bz2" ]; then
+ uncompress=j
+else
+ uncompress=z
+fi
+
+rm -rf mnt
+mkdir -p mnt
+
+fakeroot bash -c "\
+tar -x$uncompress -f $1 -C mnt; \
+genext2fs -d mnt -b $(($2 * 1024)) $dir/$base.img; \
+rm -rf mnt; \
+"
diff --git a/contrib/image-convert/tar2ext2.mount b/contrib/image-convert/tar2ext2.mount
new file mode 100755
index 0000000000..7e23098c4d
--- /dev/null
+++ b/contrib/image-convert/tar2ext2.mount
@@ -0,0 +1,25 @@
+#!/bin/sh
+
+if [ $# -ne 2 ]; then
+ echo "Usage: $0 <tarball> <ext2 size>"
+ exit
+fi
+
+ext=`echo $1 | sed -r -e 's/.+\.([^.]+\.[^.]+)/\1/'`
+base=$(basename $1 .$ext)
+if [ "$ext" == "tar.bz2" ]; then
+ uncompress=j
+else
+ uncompress=z
+fi
+
+dd if=/dev/zero of=$base.img bs=1M count=$2
+mkfs.ext2 -F -m1 $base.img
+
+mkdir -p mnt
+mount -o loop $base.img mnt
+
+tar -x$uncompress -f $1 -C mnt
+
+umount mnt
+rm -rf mnt
diff --git a/contrib/image-convert/tar2jffs b/contrib/image-convert/tar2jffs
new file mode 100755
index 0000000000..7bf158e4a5
--- /dev/null
+++ b/contrib/image-convert/tar2jffs
@@ -0,0 +1,8 @@
+#!/bin/sh
+
+STAGING= #~/linux-ppc/build-oe-angstrom/tmp/staging/i686-linux/bin/
+
+${STAGING}fakeroot bash -c " \
+rm -rf scratch; mkdir scratch; \
+tar -xj -f $1 -C scratch; \
+${STAGING}mkfs.jffs2 -x lzo --root=scratch --faketime --output=$(dirname $1)/$(basename $1 .tar.bz2).jffs2"