summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimo Leone <simo@archlinux.org>2008-03-30 03:31:46 -0500
committerSimo Leone <simo@archlinux.org>2008-03-30 04:00:32 -0500
commitc2657570456d6c8db4830cc3c7a5e4888942d691 (patch)
tree2c7b4453b7d4185c416db67b3a763ad0ddf97f9a
parent378bf136e288da83fea97dd7891c714e0345b891 (diff)
Changed mkusbimg size to 25% over rootsize
This is plenty to compensate for filesystem overhead. Cutting the size too close to the minimum makes the image unbootable. No idea why. Signed-off-by: Simo Leone <simo@archlinux.org>
-rwxr-xr-xmkusbimg9
1 files changed, 6 insertions, 3 deletions
diff --git a/mkusbimg b/mkusbimg
index 6a41f4c..5e655b2 100755
--- a/mkusbimg
+++ b/mkusbimg
@@ -56,13 +56,16 @@ LOOPDEV=$(next_avail_loop)
TMPDIR=$(mktemp -d)
# TODO: there are better ways to do this
-# than adding 5MB to the rootsize
+# than adding 25% to the rootsize
+# XXX: doesn't seem to boot if we cut it too
+# close. even if everything fits...
# IMGSZ >= filesystem overhead + rootsize + 512bytes
# must hold or there will be insufficient space
-IMGSZ=$(( $(du -ms ${IMGROOT}|cut -f1) + 5 ))
+rootsize=$(du -bs ${IMGROOT}|cut -f1)
+IMGSZ=$(( (${rootsize}*5)/4 + 512 ))
# create the image file
-dd if=/dev/zero of="$IMG" bs=1M count="$IMGSZ"
+dd if=/dev/zero of="$IMG" bs="$IMGSZ" count=1
# loop mount the disk image
losetup "$LOOPDEV" "$IMG"