diff options
author | Matt Rice <ratmice@gmail.com> | 2011-03-25 14:04:44 +0100 |
---|---|---|
committer | Koen Kooi <koen@openembedded.org> | 2011-03-25 14:04:44 +0100 |
commit | 6a40f720fc5ebbee5990f371981b14d6e46cbd6c (patch) | |
tree | 51d61764c6a10eff647103d31794dfa2d17d57e9 /contrib | |
parent | 0d9d17c9e819fbd4ad264c76c5dd34a17b2c1910 (diff) | |
download | openembedded-6a40f720fc5ebbee5990f371981b14d6e46cbd6c.tar.gz |
angstrom omap3 mkcard: improve loop mount handling
Signed-off-by: Koen Kooi <koen@openembedded.org>
Diffstat (limited to 'contrib')
-rwxr-xr-x | 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 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 |