Patchwork use of kpartx in contrib/angstrom/omap3-mkcard.sh is suboptimal

login
register
mail settings
Submitter Attila Kinali
Date Oct. 7, 2011, 1:53 p.m.
Message ID <20111007155355.b7dbb67d.attila@kinali.ch>
Download mbox | patch
Permalink /patch/12871/
State New, archived
Headers show

Comments

Attila Kinali - Oct. 7, 2011, 1:53 p.m.
Moin

the script contrib/angstrom/omap3-mkcard.sh uses kpartx to create the
device files for the partitions just created, if kpartx is available.
Unfortunately, kpartx does not work here as intended, it binds the
device files in a way that prevents the script from running properly
(mkfs fails due to the "partition in use" check, as kpartx makes
the kernel to keep them in use). As most systems do not have
kpartx installed, this bug isn't triggered for most people.
(kpartx is only needed if you want to create "partiton device files"
for block devices that are not usually partitioned, like lvm volumes or
disk images)

The right thing to do would be to use sfdisk to reload the partition
table and let udev handle the rest. (Actually this isn't really necessary,
as sfdisk reloads the partition table anyways after writing the changes)




			Attila Kinali

Patch

--- omap3-mkcard.sh.orig        2011-10-07 15:52:57.000000000 +0200
+++ omap3-mkcard.sh     2011-10-07 15:29:49.000000000 +0200
@@ -33,9 +33,10 @@ 
 sleep 1
 
 
-if [ -x `which kpartx` ]; then
-       kpartx -a ${DRIVE}
-fi
+#if [ -x `which kpartx` ]; then
+#      kpartx -a ${DRIVE}
+#fi
+sfdisk -R $DRIVE
 
 # handle various device names.
 # note something like fdisk -l /dev/loop0 | egrep -E '^/dev' | cut -d' ' -f1