[oe-commits] Matt Rice : angstrom omap3 mkcard: improve loop mount handling

git version control git at git.openembedded.org
Fri Mar 25 13:10:08 UTC 2011


Module: openembedded.git
Branch: org.openembedded.dev
Commit: 6a40f720fc5ebbee5990f371981b14d6e46cbd6c
URL:    http://gitweb.openembedded.net/?p=openembedded.git&a=commit;h=6a40f720fc5ebbee5990f371981b14d6e46cbd6c

Author: Matt Rice <ratmice at gmail.com>
Date:   Fri Mar 25 14:04:44 2011 +0100

angstrom omap3 mkcard: improve loop mount handling

Signed-off-by: Koen Kooi <koen at openembedded.org>

---

 contrib/angstrom/omap3-mkcard.sh |   57 ++++++++++++++++++++++++++------------
 1 files changed, 39 insertions(+), 18 deletions(-)

diff --git a/contrib/angstrom/omap3-mkcard.sh b/contrib/angstrom/omap3-mkcard.sh
index 72dce06..743b36d 100755
--- a/contrib/angstrom/omap3-mkcard.sh
+++ b/contrib/angstrom/omap3-mkcard.sh
@@ -32,27 +32,48 @@ echo ,,,-
 
 sleep 1
 
-if [ -b ${DRIVE}1 ]; then
-	umount ${DRIVE}1
-	mkfs.vfat -F 32 -n "boot" ${DRIVE}1
+
+if [ -x `which kpartx` ]; then
+	kpartx -a ${DRIVE}
+fi
+
+# handle various device names.
+# note something like fdisk -l /dev/loop0 | egrep -E '^/dev' | cut -d' ' -f1 
+# won't work due to https://bugzilla.redhat.com/show_bug.cgi?id=649572
+
+PARTITION1=${DRIVE}1
+if [ ! -b ${PARTITION1} ]; then
+	PARTITION1=${DRIVE}p1
+fi
+
+DRIVE_NAME=`basename $DRIVE`
+DEV_DIR=`dirname $DRIVE`
+
+if [ ! -b ${PARTITION1} ]; then
+	PARTITION1=$DEV_DIR/mapper/${DRIVE_NAME}p1
+fi
+
+PARTITION2=${DRIVE}2
+if [ ! -b ${PARTITION2} ]; then
+	PARTITION2=${DRIVE}p2
+fi
+if [ ! -b ${PARTITION2} ]; then
+	PARTITION2=$DEV_DIR/mapper/${DRIVE_NAME}p2
+fi
+
+
+# now make partitions.
+if [ -b ${PARTITION1} ]; then
+	umount ${PARTITION1}
+	mkfs.vfat -F 32 -n "boot" ${PARTITION1}
 else
-	if [ -b ${DRIVE}p1 ]; then
-		umount ${DRIVE}p1
-		mkfs.vfat -F 32 -n "boot" ${DRIVE}p1
-	else
-		echo "Cant find boot partition in /dev"
-	fi
+	echo "Cant find boot partition in /dev"
 fi
 
-if [ -b ${DRIVE}2 ]; then
-	umount ${DRIVE}2
-	mke2fs -j -L "Angstrom" ${DRIVE}2
+if [ -b ${PARITION2} ]; then
+	umount ${PARTITION2}
+	mke2fs -j -L "Angstrom" ${PARTITION2} 
 else
-	if [ -b ${DRIVE}p2 ]; then
-		umount ${DRIVE}p2
-		mke2fs -j -L "Angstrom" ${DRIVE}p2
-	else
-		echo "Cant find rootfs partition in /dev"
-	fi
+	echo "Cant find rootfs partition in /dev"
 fi
 





More information about the Openembedded-commits mailing list