Skip to contentSkip to conversation

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

PATCH Attila Kinali 1 participant 1 message Oct 7, 2011

lore
Share & tools
lore
#0 lore raw

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)

omap3-mkcard.sh 2011-10-07 15:29:49.000000000 +0200 renamed from omap3-mkcard.sh.orig 2011-10-07 15:52:57.000000000 +0200 +4 -3
@@ -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 

Attila Kinali

Signature · 4 lines
The trouble with you, Shev, is you don't say anything until you've saved
up a whole truckload of damned heavy brick arguments and then you dump
them all out and never look at the bleeding body mangled beneath the heap
		-- Tirin, The Dispossessed, U. Le Guin