Round image size up to nearest 4M block

pull/136/head
Serge Schneider 2017-11-24 07:33:03 +00:00
parent 53259b48d3
commit aa8731012e
1 changed files with 2 additions and 1 deletions

View File

@ -12,7 +12,8 @@ mkdir -p ${ROOTFS_DIR}
BOOT_SIZE=$(du --apparent-size -s ${EXPORT_ROOTFS_DIR}/boot --block-size=1 | cut -f 1)
TOTAL_SIZE=$(du --apparent-size -s ${EXPORT_ROOTFS_DIR} --exclude var/cache/apt/archives --block-size=1 | cut -f 1)
IMG_SIZE=$((BOOT_SIZE + TOTAL_SIZE + (800 * 1024 * 1024)))
ROUND_SIZE="$((4 * 1024 * 1024))"
IMG_SIZE=$(((BOOT_SIZE + TOTAL_SIZE + (800 * 1024 * 1024) + ROUND_SIZE) / ROUND_SIZE * ROUND_SIZE))
truncate -s ${IMG_SIZE} ${IMG_FILE}
fdisk -H 255 -S 63 ${IMG_FILE} <<EOF