Commit fff98d41 authored by Anton Midyukov's avatar Anton Midyukov

tar2fs, build-vm: add VM_BOOTSIZE for change size /boot partition

parent 37dce2b2
......@@ -153,15 +153,20 @@ IMG="$2"
ROOTSIZE="$3"
[ -n "$ROOTSIZE" -a "$ROOTSIZE" != 0 ] || unset ROOTSIZE
BOOTSIZE="$9"
[ -n "$BOOTSIZE" -a "$BOOTSIZE" != 0 ] || unset BOOTSIZE
# 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)
BOOTDEFSIZE="$(boot_size "$TAR")"
DEFSIZE="$(($SIZE_FACTOR * ($TARSIZE - ${BOOTSIZE:-$BOOTDEFSIZE})))" # (exact sizes)
ROOTSIZE="$((${ROOTSIZE:-$DEFSIZE} + $MB - 1))" # for ceil rounding to MB
# image and /boot sizes in megabytes
ROOTSIZEM="$(($ROOTSIZE / $MB))"
BOOTSIZEM="$((($SIZE_FACTOR * $BOOT_SIZE_FACTOR * $BOOTSIZE + $MB - 1) / $MB))"
BOOTDEFSIZE="$(($SIZE_FACTOR * $BOOT_SIZE_FACTOR * $BOOTDEFSIZE))"
BOOTSIZE="$((${BOOTSIZE:-$BOOTDEFSIZE} + $MB - 1))" # for ceil rounding to MB
BOOTSIZEM="$(($BOOTSIZE / $MB))"
# single root partition hardwired so far,
# add another image for home/data/swap if needed
......
......@@ -58,7 +58,7 @@ tar2fs: $(SAVE_TARBALL) check-sudo prepare-tarball-qemu
if ! sudo $$TOPDIR/bin/tar2fs \
"$(VM_TARBALL)" "$(VM_RAWDISK)" "$(VM_SIZE)" "$(VM_FSTYPE)" \
"$(VM_BOOTLOADER)" "$(ARCH)" "$(VM_PARTTABLE)" \
"$(VM_BOOTTYPE)"; then \
"$(VM_BOOTTYPE)" "$(VM_BOOTSIZE)"; then \
echo "** error: sudo tar2fs failed, see build log" >&2; \
exit 1; \
fi
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment