On Thu, 2013-03-14 at 10:40 -0300, Esteban Bordón wrote:
> Hi, I'm trying to make a custom build for XO-1.75 using oob and
> image.50.makefs.sh throws an error. 
> 
> 
> Anyone know how to solve it?
> 
> 

Hey I ran into this one while using DX's version of OOB, and had the
same problem. Try this attached patch.

Jerry



> Thakns,
> Esteban.
> 
> 
> Re-reading the partition table ...
> BLKRRPART: Inappropriate ioctl for device
> 
> 
> If you created or changed a DOS partition, /dev/foo7, say, then use
> dd(1)
> to zero the first 512 bytes:  dd if=/dev/zero of=/dev/foo7 bs=512
> count=1
> (See fdisk(8).)
> ++ head -n1
> ++ kpartx
> -l /home/builder/dx3-osbuilder-uy/build/intermediates/40015UY2.zd.disk.img
> ++ sed -e 's:.*/::'
> ++ awk '{print $5}'
> + loop=loop3
> + disk_loop=/dev/loop3
> + boot_loop=/dev/mapper/loop3p1
> + root_loop=/dev/mapper/loop3p2
> + kpartx -a
> -v /home/builder/dx3-osbuilder-uy/build/intermediates/40015UY2.zd.disk.img
> add map loop3p1 (253:2): 0 131072 linear /dev/loop3 8192
> add map loop3p2 (253:3): 0 5773056 linear /dev/loop3 139264
> + echo 'mke2fs -O dir_index,^resize_inode -L Boot
> -F /dev/mapper/loop3p1'
> mke2fs -O dir_index,^resize_inode -L Boot -F /dev/mapper/loop3p1
> + echo 'Create filesystems...'
> Create filesystems...
> + mke2fs -O 'dir_index,^resize_inode' -L Boot -F /dev/mapper/loop3p1
> mke2fs 1.42.5 (29-Jul-2012)
> mke2fs: No such file or directory while trying to determine filesystem
> size
>  * Caught error, cleanup and then bail out.
>  * Running part cleanup base cleanup.50.cleanup.sh...
>  * Running part cleanup buildnr_from_file
> cleanup.50.write_buildnr.sh...
> ERROR: Failure in ImageStage: module sd_card_image, part
> image.50.makefs.sh, error code 1
> _______________________________________________
> Devel mailing list
> Devel@lists.laptop.org
> http://lists.laptop.org/listinfo/devel

diff --git a/modules/sd_card_image/image.50.makefs.sh b/modules/sd_card_image/image.50.makefs.sh
index 7f907ad..b259409 100644
--- a/modules/sd_card_image/image.50.makefs.sh
+++ b/modules/sd_card_image/image.50.makefs.sh
@@ -79,15 +79,20 @@ make_image()
 $ROOT_PARTITION_START_BLOCK,,,
 EOF
 
-	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"
+	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
 
-	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
@@ -127,9 +132,8 @@ EOF
 
 	umount $ROOT
 	umount $BOOT
-
-	kpartx -d $disk_loop || :
 	losetup -d $disk_loop || :
+
 	# FIXME: any value to running e2fsck now? maybe with -D ?
 }
 
_______________________________________________
Devel mailing list
Devel@lists.laptop.org
http://lists.laptop.org/listinfo/devel

Reply via email to