diff --git a/build_library/vm_image_util.sh b/build_library/vm_image_util.sh index 03d1bd7289..f7b74f45db 100644 --- a/build_library/vm_image_util.sh +++ b/build_library/vm_image_util.sh @@ -195,17 +195,10 @@ _disk_ext() { esac } -# Unpack the source disk to individual partitions, optionally using an -# alternate filesystem image for the state partition instead of the one -# from VM_SRC_IMG. Start new image using the given disk layout. +# Unpack the source disk to individual partitions. +# Start new image using the given disk layout. unpack_source_disk() { get_disk_layout_type $(_get_vm_opt DISK_LAYOUT) - local alternate_state_image="$1" - - if [[ -n "${alternate_state_image}" && ! -f "${alternate_state_image}" ]] - then - die "State image does not exist: $alternate_state_image" - fi info "Unpacking source image to $(relpath "${VM_TMP_DIR}")" @@ -222,10 +215,6 @@ unpack_source_disk() { TEMP_OEM="${VM_TMP_DIR}"/part_${NUM_OEM} TEMP_ROOTFS="${VM_TMP_DIR}"/part_${NUM_ROOTFS_A} TEMP_STATE="${VM_TMP_DIR}"/part_${NUM_STATEFUL} - # Copy the replacement STATE image if it is set - if [[ -n "${alternate_state_image}" ]]; then - cp --sparse=always "${alternate_state_image}" "${TEMP_STATE}" - fi if [[ $(_get_vm_opt PARTITIONED_IMG) -eq 1 ]]; then info "Initializing new partition table..." diff --git a/image_to_vm.sh b/image_to_vm.sh index 149b791d79..b7a7cafd5f 100755 --- a/image_to_vm.sh +++ b/image_to_vm.sh @@ -39,8 +39,6 @@ DEFINE_string disk_layout "" \ "The disk layout type to use for this image." DEFINE_integer mem "${DEFAULT_MEM}" \ "Memory size for the vm config in MBs." -DEFINE_string state_image "" \ - "Stateful partition image (defaults to creating new statful partition)" DEFINE_boolean prod_image "${FLAGS_FALSE}" \ "Use the production image instead of the default developer image." DEFINE_string to "" \ @@ -105,9 +103,9 @@ legacy_offset_size_export ${VM_SRC_IMG} # Make sure things are cleaned up on failure trap vm_cleanup EXIT -# Unpack image, using alternate state image if defined +# Unpack image # Resize to use all available space in new disk layout -unpack_source_disk "${FLAGS_state_image}" +unpack_source_disk resize_state_partition # Optionally install any OEM packages