Short circuit qemu-img convert for raw images
We currently use qemu-img convert with a raw source and dest when building raw images. We can just mv the file for increased speed. Change-Id: I3da095cb9ecad7224a121a434a9fb204132bf6df
This commit is contained in:
parent
100959de8d
commit
2d79e9d395
@ -45,7 +45,7 @@ function show_options () {
|
|||||||
echo "Options:"
|
echo "Options:"
|
||||||
echo " -a i386|amd64|armhf -- set the architecture of the image(default amd64)"
|
echo " -a i386|amd64|armhf -- set the architecture of the image(default amd64)"
|
||||||
echo " -o imagename -- set the imagename of the output image file(default image)"
|
echo " -o imagename -- set the imagename of the output image file(default image)"
|
||||||
echo " -t qcow2,tar -- set the image types of the output image files (default qcow2)"
|
echo " -t qcow2,tar,raw -- set the image types of the output image files (default qcow2)"
|
||||||
echo " File types should be comma separated"
|
echo " File types should be comma separated"
|
||||||
echo " -x -- turn on tracing"
|
echo " -x -- turn on tracing"
|
||||||
echo " -u -- uncompressed; do not compress the image - larger but faster"
|
echo " -u -- uncompressed; do not compress the image - larger but faster"
|
||||||
@ -247,14 +247,24 @@ done
|
|||||||
|
|
||||||
unmount_image
|
unmount_image
|
||||||
|
|
||||||
|
has_raw_type=
|
||||||
if [ "$IS_RAMDISK" == "0" ]; then
|
if [ "$IS_RAMDISK" == "0" ]; then
|
||||||
for IMAGE_TYPE in ${IMAGE_TYPES[@]} ; do
|
for IMAGE_TYPE in ${IMAGE_TYPES[@]} ; do
|
||||||
|
# We have to do raw last because it is destructive
|
||||||
|
if [ "$IMAGE_NAME" = "raw" ]; then
|
||||||
|
has_raw_type=1
|
||||||
|
else
|
||||||
compress_and_save_image $IMAGE_NAME.$IMAGE_TYPE
|
compress_and_save_image $IMAGE_NAME.$IMAGE_TYPE
|
||||||
|
fi
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
|
if [ -n "$has_raw_type" ]; then
|
||||||
|
IMAGE_TYPE="raw"
|
||||||
|
compress_and_save_image $IMAGE_NAME.$IMAGE_TYPE
|
||||||
|
fi
|
||||||
|
|
||||||
# Always cleanup after ourselves
|
# Always cleanup after ourselves
|
||||||
rm $TMP_IMAGE_PATH
|
rm -f $TMP_IMAGE_PATH
|
||||||
cleanup_dirs
|
cleanup_dirs
|
||||||
|
|
||||||
case "$IMAGE_ELEMENT" in
|
case "$IMAGE_ELEMENT" in
|
||||||
|
@ -115,8 +115,12 @@ function compress_and_save_image () {
|
|||||||
else
|
else
|
||||||
EXTRA_OPTIONS=""
|
EXTRA_OPTIONS=""
|
||||||
fi
|
fi
|
||||||
|
if [ "$IMAGE_TYPE" = "raw" ]; then
|
||||||
|
mv $TMP_IMAGE_PATH $1-new
|
||||||
|
else
|
||||||
echo "Converting image using qemu-img convert"
|
echo "Converting image using qemu-img convert"
|
||||||
qemu-img convert ${COMPRESS_IMAGE:+-c} -f raw $TMP_IMAGE_PATH -O $IMAGE_TYPE $EXTRA_OPTIONS $1-new
|
qemu-img convert ${COMPRESS_IMAGE:+-c} -f raw $TMP_IMAGE_PATH -O $IMAGE_TYPE $EXTRA_OPTIONS $1-new
|
||||||
|
fi
|
||||||
|
|
||||||
OUT_IMAGE_PATH=$1-new
|
OUT_IMAGE_PATH=$1-new
|
||||||
finish_image $1
|
finish_image $1
|
||||||
|
Loading…
x
Reference in New Issue
Block a user