From patchwork Fri Oct 7 13:53:55 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: use of kpartx in contrib/angstrom/omap3-mkcard.sh is suboptimal Date: Fri, 07 Oct 2011 13:53:55 -0000 From: Attila Kinali X-Patchwork-Id: 12871 Message-Id: <20111007155355.b7dbb67d.attila@kinali.ch> To: openembedded-devel@lists.openembedded.org 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 --- 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