From 81a6ab9ec130bb3b44eb21a57be1a7ae413cf241 Mon Sep 17 00:00:00 2001 From: Gleb F-Malinovskiy Date: Tue, 9 Jul 2013 12:34:21 +0400 Subject: [PATCH] tar2fs: double /boot size Factor of 2 is not enough for kernel upgrade due to filesystem overhead. Add BOOT_SIZE_FACTOR on top of that. --- bin/tar2fs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/bin/tar2fs b/bin/tar2fs index 8c77778b..71cf73f3 100755 --- a/bin/tar2fs +++ b/bin/tar2fs @@ -20,7 +20,9 @@ fi [ -n "$GLOBAL_DEBUG" ] || message "WORKDIR: $WORKDIR" MB=1048576 # a parted's "megabyte" in bytes is *broken* + SIZE_FACTOR=2 # multiply the sizes found by this value +BOOT_SIZE_FACTOR=2 # multiply /boot size by this value additionally CUR_BOUNDARY=0 # align first partition at 1MB for performance (+1) @@ -87,15 +89,15 @@ IMG="$2" ROOTSIZE="$3" [ -n "$ROOTSIZE" -a "$ROOTSIZE" != 0 ] || unset ROOTSIZE -# image size in bytes (note the final ceil rounding to megabytes) +# image size in bytes TARSIZE="$(stat -Lc %s "$TAR")" # /boot size in that tarball BOOTSIZE="$(boot_size "$TAR")" DEFSIZE="$(($SIZE_FACTOR * ($TARSIZE - $BOOTSIZE)))" # (exact sizes) -ROOTSIZE="$((${ROOTSIZE:-$DEFSIZE} + $MB - 1))" +ROOTSIZE="$((${ROOTSIZE:-$DEFSIZE} + $MB - 1))" # for ceil rounding to MB # image and /boot sizes in megabytes ROOTSIZEM="$(($ROOTSIZE / $MB))" -BOOTSIZEM="$((($SIZE_FACTOR * $BOOTSIZE + $MB - 1) / $MB))" +BOOTSIZEM="$((($SIZE_FACTOR * $BOOT_SIZE_FACTOR * $BOOTSIZE + $MB - 1) / $MB))" # tested to work: ext[234], jfs # NB: xfs doesn't have a spare sector for the bootloader