diff options
author | Jerry <jvonau@shaw.ca> | 2013-02-28 15:21:42 (GMT) |
---|---|---|
committer | Jerry <jvonau@shaw.ca> | 2013-02-28 15:21:42 (GMT) |
commit | caed33fbf194f497a2a1c557894baeee45043fe1 (patch) | |
tree | f84dbac660d2477b0fff9a940a5bcb00e54d5094 | |
parent | 9a6e0a92ee59d4a0becee265e7f8eb66379d8ba3 (diff) |
Revert "revert kparted to losetup"
This reverts commit 9a6e0a92ee59d4a0becee265e7f8eb66379d8ba3.
-rw-r--r-- | modules/sd_card_image/image.50.makefs.sh | 24 |
1 files changed, 10 insertions, 14 deletions
diff --git a/modules/sd_card_image/image.50.makefs.sh b/modules/sd_card_image/image.50.makefs.sh index b259409..7f907ad 100644 --- a/modules/sd_card_image/image.50.makefs.sh +++ b/modules/sd_card_image/image.50.makefs.sh @@ -79,20 +79,15 @@ make_image() $ROOT_PARTITION_START_BLOCK,,, EOF - disk_loop=$(losetup --show --find --partscan $img) - 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 + loop=$(kpartx -l $img | head -n1 | awk '{print $5}' | sed -e 's:.*/::' ) + disk_loop=/dev/$loop + boot_loop="/dev/mapper/${loop}p1" + root_loop="/dev/mapper/${loop}p2" + kpartx -a -v $img + + echo "mke2fs -O dir_index,^resize_inode -L Boot -F $boot_loop" + echo "Create filesystems..." mke2fs -O dir_index,^resize_inode -L Boot -F $boot_loop mount $boot_loop $BOOT @@ -132,8 +127,9 @@ EOF umount $ROOT umount $BOOT - losetup -d $disk_loop || : + kpartx -d $disk_loop || : + losetup -d $disk_loop || : # FIXME: any value to running e2fsck now? maybe with -D ? } |