diff system-image.sh @ 642:c92dc77da038

Since gene2fs can't produce large images in a reasonable amount of time, make a 64 meg image and resize it if necessary. (This means the minimum image size is 64 megs, because gene2fs won't run unless you specify a size, but it knows right away if the size you gave it wasn't big enough. I don't understand this either.)
author Rob Landley <rob@landley.net>
date Sat, 21 Mar 2009 22:56:15 -0500
parents b4ea140d2439
children 87ef47d783f5
line wrap: on
line diff
--- a/system-image.sh	Fri Mar 20 21:52:26 2009 -0500
+++ b/system-image.sh	Sat Mar 21 22:56:15 2009 -0500
@@ -97,10 +97,22 @@
   echo "/dev d 755 0 0 - - - - -" > "$DEVLIST" &&
   echo "/dev/console c 640 0 0 5 1 0 0 -" >> "$DEVLIST" &&
 
-  genext2fs -z -D "$DEVLIST" -d "${NATIVE_ROOT}" \
-    -i 1024 -b $[$SYSIMAGE_HDA_MEGS*1024] "${SYSIMAGE}/${IMAGE}" &&
+  # Produce 64 meg filesystem, which should always be big enough.
+
+  genext2fs -z -D "$DEVLIST" -d "$NATIVE_ROOT" -b 65536 -i 1024 \
+    "$SYSIMAGE/$IMAGE" &&
   rm "$DEVLIST" || dienow
 
+  # Extend image size to HDA_MEGS if necessary, keeping it sparse.  (Feeding
+  # a larger -b size to genext2fs is insanely slow, and not particularly
+  # sparse.)
+
+  if [ $[1024*$SYSIMAGE_HDA_MEGS] -gt 65536 ]
+  then
+    dd if=/dev/zero of=woot.img bs=1k count=1 seek=$[1024*1024-1] &&
+    resize2fs "${SYSIMAGE}/${IMAGE}" ${SYSIMAGE_HDA_MEGS}M || dienow
+  fi
+
 #elif [ "$SYSIMAGE_TYPE" == "squashfs" ]
 #then
 # We used to do this, but updating the squashfs patch for each new kernel