summaryrefslogtreecommitdiff
path: root/export-image
diff options
context:
space:
mode:
authorSerge Schneider <serge@raspberrypi.org>2018-03-01 17:55:25 +0000
committerSerge Schneider <serge@raspberrypi.org>2018-03-01 18:02:01 +0000
commit4d689a25fdd2309e1c6c1b01d12523b3cd401461 (patch)
treed366b3fa25a11d5043d2ca57f42662caa3ca8976 /export-image
parent40eae05204c00a4c4a070ea651fa4c11b12f5beb (diff)
export-image: don't round up if already a multiple of 4MB
Fixes #156
Diffstat (limited to 'export-image')
-rwxr-xr-xexport-image/prerun.sh2
1 files changed, 1 insertions, 1 deletions
diff --git a/export-image/prerun.sh b/export-image/prerun.sh
index 3acc248..72cb299 100755
--- a/export-image/prerun.sh
+++ b/export-image/prerun.sh
@@ -14,7 +14,7 @@ TOTAL_SIZE=$(du --apparent-size -s ${EXPORT_ROOTFS_DIR} --exclude var/cache/apt/
ROUND_SIZE="$((4 * 1024 * 1024))"
ROUNDED_ROOT_SECTOR=$(((2 * BOOT_SIZE + ROUND_SIZE) / ROUND_SIZE * ROUND_SIZE / 512 + 8192))
-IMG_SIZE=$(((BOOT_SIZE + TOTAL_SIZE + (800 * 1024 * 1024) + ROUND_SIZE) / ROUND_SIZE * ROUND_SIZE))
+IMG_SIZE=$(((BOOT_SIZE + TOTAL_SIZE + (800 * 1024 * 1024) + ROUND_SIZE - 1) / ROUND_SIZE * ROUND_SIZE))
truncate -s ${IMG_SIZE} ${IMG_FILE}
fdisk -H 255 -S 63 ${IMG_FILE} <<EOF