Instead of creating a sparse image file into which the filesystems are
created, create the image file from a psuedo-random pattern of 4096
bytes, so that zhashfs may skip the unused blocks.
---
 modules/sd_card_image/image.50.makefs.sh     |   11 ++++++++++-
 modules/sd_card_image/postimage.50.makezd.sh |    2 +-
 2 files changed, 11 insertions(+), 2 deletions(-)

diff --git a/modules/sd_card_image/image.50.makefs.sh 
b/modules/sd_card_image/image.50.makefs.sh
index c9ed3b8..6e61eb7 100644
--- a/modules/sd_card_image/image.50.makefs.sh
+++ b/modules/sd_card_image/image.50.makefs.sh
@@ -37,7 +37,16 @@ make_image()
        [ -z "$ext" ] && ext="zd"
        local img=$intermediatesdir/$(image_name).$ext.disk.img
 
-       dd if=/dev/zero of=$img bs=$BLOCK_SIZE count=0 seek=$(($image_size / 
$BLOCK_SIZE))
+        dd if=/dev/urandom of=$img.fill bs=4096 count=1 2>/dev/null
+        rm -f $img.fill.2mb
+        for x in $(seq 512); do cat $img.fill >> $img.fill.2mb; done
+        local n=$(($image_size / (1048576 * 2) + 1))
+        rm -f $img
+        dd if=/dev/zero of=$img bs=1M count=1 2>/dev/null
+        for x in $(seq $n); do cat $img.fill.2mb >> $img; done
+        truncate --size=$image_size $img
+        rm -f $img.fill.2mb
+
        /sbin/sfdisk -S 32 -H 32 --force -uS $img <<EOF
 8192,131072,83,*
 139264,,,
diff --git a/modules/sd_card_image/postimage.50.makezd.sh 
b/modules/sd_card_image/postimage.50.makezd.sh
index a7338d2..c427626 100644
--- a/modules/sd_card_image/postimage.50.makezd.sh
+++ b/modules/sd_card_image/postimage.50.makezd.sh
@@ -23,6 +23,7 @@ for line in $(env); do
        if [[ "$make_zd" == 1 ]]; then
                echo "Making ZD image for $output_name..."
                $bindir/zhashfs 0x20000 sha256 $diskimg $output.zsp $output
+               rm -f $diskimg.fill
 
                echo "Creating MD5sum of $output_name..."
                pushd $outputdir >/dev/null
@@ -41,4 +42,3 @@ for line in $(env); do
        fi
 done
 IFS=$oIFS
-
-- 
1.7.4.1


-- 
James Cameron
http://quozl.linux.org.au/
_______________________________________________
Devel mailing list
[email protected]
http://lists.laptop.org/listinfo/devel

Reply via email to