aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/angstrom/omap3-mkcard.sh
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/angstrom/omap3-mkcard.sh')
-rwxr-xr-xcontrib/angstrom/omap3-mkcard.sh57
1 files changed, 39 insertions, 18 deletions
diff --git a/contrib/angstrom/omap3-mkcard.sh b/contrib/angstrom/omap3-mkcard.sh
index 72dce06cab..743b36db2e 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