Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDaniel Drake <dsd@laptop.org>2012-09-18 17:42:01 (GMT)
committer Daniel Drake <dsd@laptop.org>2012-09-18 17:43:29 (GMT)
commit012b0e3f34ca9281061de351d73cb86311263ef9 (patch)
tree384310c55d8aa3738ec7c43a438cd2c0cf4527a8
parent9f20418922d04bc6fe30b2aa1fb5daaabddf4101 (diff)
sd_card_image: work around occasional failure to probe loop partitions
On some systems, we seem particularly prone to a race condition where losetup cannot probe loop partitions because udev is probing the newly appeared loop device. Add a repeated fallback to partx to work around this situation.
-rw-r--r--modules/sd_card_image/image.50.makefs.sh10
1 files changed, 10 insertions, 0 deletions
diff --git a/modules/sd_card_image/image.50.makefs.sh b/modules/sd_card_image/image.50.makefs.sh
index 1b692f0..b259409 100644
--- a/modules/sd_card_image/image.50.makefs.sh
+++ b/modules/sd_card_image/image.50.makefs.sh
@@ -83,6 +83,16 @@ EOF
boot_loop="${disk_loop}p1"
root_loop="${disk_loop}p2"
+ # Work around occasional failure for loop partitions to appear
+ # http://marc.info/?l=linux-kernel&m=134271282127702&w=2
+ local i=0
+ while ! [ -e "$boot_loop" ]; do
+ partx -a -v $disk_loop
+ sleep 1
+ (( ++i ))
+ [ $i -ge 10 ] && break
+ done
+
echo "Create filesystems..."
mke2fs -O dir_index,^resize_inode -L Boot -F $boot_loop
mount $boot_loop $BOOT