Enable decimal value for $DIB_IMAGE_SIZE.
Patch adds support for using decimal values for $DIB_IMAGE_SIZE. This allows for creating images that are <1G in size. Change-Id: I945644a8e77fecfb0b83efa282dc00bb29514e0b Closes-Bug: #1366909
This commit is contained in:
parent
c9f44b29bb
commit
f84b910f15
@ -225,7 +225,7 @@ unmount_image
|
|||||||
mv $TMP_BUILD_DIR/mnt $TMP_BUILD_DIR/built
|
mv $TMP_BUILD_DIR/mnt $TMP_BUILD_DIR/built
|
||||||
|
|
||||||
if [ -n "$DIB_IMAGE_SIZE" ]; then
|
if [ -n "$DIB_IMAGE_SIZE" ]; then
|
||||||
truncate -s${DIB_IMAGE_SIZE}G $TMP_IMAGE_PATH
|
du_size=$(echo "$DIB_IMAGE_SIZE" | awk '{printf("%d\n",$1 * 1024 *1024)}')
|
||||||
else
|
else
|
||||||
# in kb*0.60 - underreport to get a slightly bigger device
|
# in kb*0.60 - underreport to get a slightly bigger device
|
||||||
# Rounding down size so that is is a multiple of 64, works around a bug in
|
# Rounding down size so that is is a multiple of 64, works around a bug in
|
||||||
@ -233,6 +233,7 @@ else
|
|||||||
# of 64k. https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1180021
|
# of 64k. https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1180021
|
||||||
du_size=$(sudo du --block-size=600 -x -s ${TMP_BUILD_DIR}/built |\
|
du_size=$(sudo du --block-size=600 -x -s ${TMP_BUILD_DIR}/built |\
|
||||||
awk ' { print $1 }')
|
awk ' { print $1 }')
|
||||||
|
fi
|
||||||
if [ "$FS_TYPE" = "ext4" ] ; then
|
if [ "$FS_TYPE" = "ext4" ] ; then
|
||||||
# Very conservative to handle images being resized a lot
|
# Very conservative to handle images being resized a lot
|
||||||
# We set journal size to 64M so our journal is large enough when we
|
# We set journal size to 64M so our journal is large enough when we
|
||||||
@ -243,7 +244,6 @@ else
|
|||||||
|
|
||||||
_NEEDED_SIZE=$(echo "$du_size" | awk ' { print $1 + 64 - ( $1 % 64) } ')
|
_NEEDED_SIZE=$(echo "$du_size" | awk ' { print $1 + 64 - ( $1 % 64) } ')
|
||||||
truncate -s${_NEEDED_SIZE}K $TMP_IMAGE_PATH
|
truncate -s${_NEEDED_SIZE}K $TMP_IMAGE_PATH
|
||||||
fi
|
|
||||||
|
|
||||||
if [ -n "$MAX_ONLINE_RESIZE" ]; then
|
if [ -n "$MAX_ONLINE_RESIZE" ]; then
|
||||||
MKFS_OPTS="-E resize=$MAX_ONLINE_RESIZE $MKFS_OPTS"
|
MKFS_OPTS="-E resize=$MAX_ONLINE_RESIZE $MKFS_OPTS"
|
||||||
|
Loading…
Reference in New Issue
Block a user