Rahul Chaturvedi | b5643e8 | 2010-07-09 10:46:05 +0530 | [diff] [blame] | 1 | #!/bin/bash |
| 2 | |
| 3 | # Copyright (c) 2010 The Chromium OS Authors. All rights reserved. |
| 4 | # Use of this source code is governed by a BSD-style license that can be |
| 5 | # found in the LICENSE file. |
| 6 | |
Gaurav Shah | 550edca | 2014-09-25 11:13:55 -0700 | [diff] [blame] | 7 | # Script to convert the output of build_image.sh to a QEMU image. |
Rahul Chaturvedi | b5643e8 | 2010-07-09 10:46:05 +0530 | [diff] [blame] | 8 | |
Kees Cook | 84a4c7a | 2011-10-18 13:21:41 -0700 | [diff] [blame] | 9 | # Helper scripts should be run from the same location as this script. |
| 10 | SCRIPT_ROOT=$(dirname "$(readlink -f "$0")") |
David James | 359d3e1 | 2012-07-10 13:09:48 -0700 | [diff] [blame] | 11 | . "${SCRIPT_ROOT}/common.sh" || exit 1 |
Liam McLoughlin | 5b37c54 | 2012-08-16 11:09:37 -0700 | [diff] [blame] | 12 | . "${SCRIPT_ROOT}/build_library/build_common.sh" || exit 1 |
Greg Spencer | 798d75f | 2011-02-01 22:04:49 -0800 | [diff] [blame] | 13 | |
| 14 | # Need to be inside the chroot to load chromeos-common.sh |
| 15 | assert_inside_chroot |
| 16 | |
| 17 | # Load functions and constants for chromeos-install |
Gwendal Grignou | 0f61849 | 2014-04-07 20:05:58 +0000 | [diff] [blame] | 18 | . /usr/share/misc/chromeos-common.sh || exit 1 |
Mike Frysinger | 566c943 | 2019-03-02 14:18:29 -0500 | [diff] [blame] | 19 | |
| 20 | # Default values for creating VM's. |
| 21 | DEFAULT_QEMU_IMAGE="chromiumos_qemu_image.bin" |
Rahul Chaturvedi | b5643e8 | 2010-07-09 10:46:05 +0530 | [diff] [blame] | 22 | |
Rahul Chaturvedi | b5643e8 | 2010-07-09 10:46:05 +0530 | [diff] [blame] | 23 | # Flags |
Liam McLoughlin | 12a9a84 | 2012-10-10 10:37:06 -0400 | [diff] [blame] | 24 | DEFINE_string adjust_part "" \ |
| 25 | "Adjustments to apply to the partition table" |
Rahul Chaturvedi | b5643e8 | 2010-07-09 10:46:05 +0530 | [diff] [blame] | 26 | DEFINE_string board "${DEFAULT_BOARD}" \ |
| 27 | "Board for which the image was built" |
| 28 | DEFINE_boolean factory $FLAGS_FALSE \ |
| 29 | "Modify the image for manufacturing testing" |
| 30 | DEFINE_boolean factory_install $FLAGS_FALSE \ |
| 31 | "Modify the image for factory install shim" |
Simon Glass | 142ca06 | 2011-02-09 13:39:43 -0800 | [diff] [blame] | 32 | |
Gabe Black | 1d6dc25 | 2014-08-18 17:02:09 -0700 | [diff] [blame] | 33 | # We default to TRUE so the buildbot gets its image. |
Chris Sosa | 8dad50d | 2011-02-14 15:29:32 -0800 | [diff] [blame] | 34 | DEFINE_boolean force_copy ${FLAGS_FALSE} "Always rebuild test image" |
Rahul Chaturvedi | b5643e8 | 2010-07-09 10:46:05 +0530 | [diff] [blame] | 35 | DEFINE_string from "" \ |
| 36 | "Directory containing rootfs.image and mbr.image" |
Don Garrett | 7937ef8 | 2014-08-25 18:04:05 -0700 | [diff] [blame] | 37 | DEFINE_string disk_layout "2gb-rootfs-updatable" \ |
Liam McLoughlin | b78a7c3 | 2012-11-06 20:19:05 -0500 | [diff] [blame] | 38 | "The disk layout type to use for this image." |
Rahul Chaturvedi | b5643e8 | 2010-07-09 10:46:05 +0530 | [diff] [blame] | 39 | DEFINE_string state_image "" \ |
| 40 | "Stateful partition image (defaults to creating new statful partition)" |
| 41 | DEFINE_boolean test_image "${FLAGS_FALSE}" \ |
Jacob Kopczynski | 75d465c | 2018-07-19 12:54:17 -0700 | [diff] [blame] | 42 | "Acquires image from ${CHROMEOS_TEST_IMAGE_NAME} instead of " \ |
| 43 | "${CHROMEOS_IMAGE_NAME}." |
Rahul Chaturvedi | b5643e8 | 2010-07-09 10:46:05 +0530 | [diff] [blame] | 44 | DEFINE_string to "" \ |
| 45 | "Destination folder for VM output file(s)" |
Rahul Chaturvedi | b5643e8 | 2010-07-09 10:46:05 +0530 | [diff] [blame] | 46 | |
| 47 | # Parse command line |
| 48 | FLAGS "$@" || exit 1 |
| 49 | eval set -- "${FLAGS_ARGV}" |
| 50 | |
| 51 | # Die on any errors. |
Brian Harring | 7f175a5 | 2012-03-02 05:37:00 -0800 | [diff] [blame] | 52 | switch_to_strict_mode |
Rahul Chaturvedi | b5643e8 | 2010-07-09 10:46:05 +0530 | [diff] [blame] | 53 | |
Mike Frysinger | 79e9dcd | 2019-07-29 00:48:36 -0400 | [diff] [blame^] | 54 | # Get the size of a regular file or a block device. |
| 55 | # |
| 56 | # $1 - The regular file or block device to get the size of. |
| 57 | bd_safe_size() { |
| 58 | local file="$1" |
| 59 | if [[ -b "${file}" ]]; then |
| 60 | sudo blockdev --getsize64 "${file}" |
| 61 | else |
| 62 | stat -c%s "${file}" |
| 63 | fi |
| 64 | } |
| 65 | |
Gabe Black | 067b354 | 2014-09-23 01:15:14 -0700 | [diff] [blame] | 66 | TEMP_DIR=$(mktemp -d) |
| 67 | TEMP_MNT="" |
| 68 | TEMP_ESP_MNT="" |
| 69 | SRC_DEV="" |
| 70 | DST_DEV="" |
| 71 | cleanup() { |
| 72 | if [[ -n "${TEMP_MNT}" ]]; then |
| 73 | safe_umount "${TEMP_MNT}" || true |
| 74 | rmdir "${TEMP_MNT}" || true |
| 75 | fi |
| 76 | if [[ -n "${TEMP_ESP_MNT}" ]]; then |
| 77 | safe_umount "${TEMP_ESP_MNT}" || true |
| 78 | rmdir "${TEMP_ESP_MNT}" || true |
| 79 | fi |
| 80 | |
| 81 | if [[ -n "${SRC_DEV}" ]]; then |
| 82 | loopback_detach "${SRC_DEV}" || true |
| 83 | fi |
| 84 | if [[ -n "${DST_DEV}" ]]; then |
| 85 | loopback_detach "${DST_DEV}" || true |
| 86 | fi |
| 87 | rm -rf "${TEMP_DIR}" |
| 88 | } |
Mike Frysinger | 9ebc8ce | 2015-04-06 13:15:01 -0400 | [diff] [blame] | 89 | trap 'ret=$?; cleanup; die_err_trap ${ret}' INT TERM EXIT |
Gabe Black | 067b354 | 2014-09-23 01:15:14 -0700 | [diff] [blame] | 90 | |
Rahul Chaturvedi | b5643e8 | 2010-07-09 10:46:05 +0530 | [diff] [blame] | 91 | # Default to the most recent image |
| 92 | if [ -z "${FLAGS_from}" ] ; then |
Alex Klein | 999443c | 2018-10-17 12:02:05 -0600 | [diff] [blame] | 93 | FLAGS_from="${IMAGES_DIR}/${FLAGS_board}/latest" |
Rahul Chaturvedi | b5643e8 | 2010-07-09 10:46:05 +0530 | [diff] [blame] | 94 | fi |
| 95 | if [ -z "${FLAGS_to}" ] ; then |
| 96 | FLAGS_to="${FLAGS_from}" |
| 97 | fi |
| 98 | |
Mike Frysinger | b86854a | 2014-11-25 18:43:58 -0500 | [diff] [blame] | 99 | # Convert args to full paths. Use echo here on the unquoted value to process all |
| 100 | # shell level expansions like ~ and *. |
| 101 | if ! resolved=$(readlink -f "$(echo ${FLAGS_from})"); then |
| 102 | die_notrace "image_to_vm: processing --from failed." \ |
| 103 | "Verify the path exists: ${FLAGS_from}" \ |
| 104 | " cwd: ${PWD}" |
| 105 | fi |
| 106 | FLAGS_from=${resolved} |
| 107 | if ! resolved=$(readlink -f "$(echo ${FLAGS_to})"); then |
| 108 | die_notrace "image_to_vm: Processing --to failed." \ |
| 109 | "Verify the path exists: ${FLAGS_to}" \ |
| 110 | " cwd: ${PWD}" |
| 111 | fi |
| 112 | FLAGS_to=${resolved} |
| 113 | |
Hung-Te Lin | 269680c | 2016-05-30 14:47:37 +0800 | [diff] [blame] | 114 | if [ ${FLAGS_test_image} -eq ${FLAGS_TRUE} ]; then |
David James | 7efb76c | 2013-01-09 15:25:58 -0800 | [diff] [blame] | 115 | SRC_IMAGE="${FLAGS_from}/${CHROMEOS_TEST_IMAGE_NAME}" |
Simon Glass | 142ca06 | 2011-02-09 13:39:43 -0800 | [diff] [blame] | 116 | else |
| 117 | # Use the standard image |
| 118 | SRC_IMAGE="${FLAGS_from}/${CHROMEOS_IMAGE_NAME}" |
Rahul Chaturvedi | b5643e8 | 2010-07-09 10:46:05 +0530 | [diff] [blame] | 119 | fi |
Mike Frysinger | b86854a | 2014-11-25 18:43:58 -0500 | [diff] [blame] | 120 | if [[ ! -e ${SRC_IMAGE} ]]; then |
| 121 | die_notrace "image_to_vm: src image does not exist: ${SRC_IMAGE}" \ |
| 122 | "Please verify you have selected the right input." \ |
| 123 | "Note: only dev/test/factory images can be used as inputs." |
| 124 | fi |
Rahul Chaturvedi | b5643e8 | 2010-07-09 10:46:05 +0530 | [diff] [blame] | 125 | |
Prathmesh Prabhu | aa96e57 | 2017-08-31 22:42:37 -0700 | [diff] [blame] | 126 | if [[ -z "${FLAGS_board}" ]] && [[ -n "${FLAGS_from}" ]]; then |
| 127 | # The user may not know the board of in the input image, so infer it for them. |
| 128 | # TODO(pprabhu): This will fail if the user's chroot has a default_board set |
| 129 | # which is different from the image provided, because FLAGS_board will use |
| 130 | # that. Fix this project-wide by respecting the --board flag when provided, |
| 131 | # but preferring the board inferred from FLAGS_from over the default, |
| 132 | # everywhere. |
| 133 | FLAGS_board="$( |
| 134 | . "${BUILD_LIBRARY_DIR}/mount_gpt_util.sh" |
| 135 | get_board_from_image "${SRC_IMAGE}" |
| 136 | )" |
| 137 | fi |
| 138 | |
| 139 | if [[ ! -d "/build/${FLAGS_board}" ]]; then |
| 140 | # Using board options and overrides requires that the board sysroot be setup |
| 141 | # (in order to read kernel and disk-image options). |
| 142 | # OTOH, we don't actually need to build any packages / update the host |
| 143 | # sysroot. |
Alex Klein | d65766f | 2019-01-11 14:57:34 -0700 | [diff] [blame] | 144 | setup_board --quiet --board="${FLAGS_board}" \ |
| 145 | --skip-toolchain-update --skip-chroot-upgrade --skip-board-pkg-init |
Prathmesh Prabhu | aa96e57 | 2017-08-31 22:42:37 -0700 | [diff] [blame] | 146 | fi |
Bertrand SIMONNET | 1e77c19 | 2015-06-03 15:22:01 -0700 | [diff] [blame] | 147 | . "${BUILD_LIBRARY_DIR}/board_options.sh" || exit 1 |
| 148 | . "${SCRIPT_ROOT}/build_library/disk_layout_util.sh" || exit 1 |
| 149 | |
Rahul Chaturvedi | b5643e8 | 2010-07-09 10:46:05 +0530 | [diff] [blame] | 150 | # Memory units are in MBs |
Greg Spencer | 798d75f | 2011-02-01 22:04:49 -0800 | [diff] [blame] | 151 | TEMP_IMG="$(dirname "${SRC_IMAGE}")/vm_temp_image.bin" |
Rahul Chaturvedi | b5643e8 | 2010-07-09 10:46:05 +0530 | [diff] [blame] | 152 | |
Rahul Chaturvedi | b5643e8 | 2010-07-09 10:46:05 +0530 | [diff] [blame] | 153 | # Split apart the partitions and make some new ones |
Gabe Black | 067b354 | 2014-09-23 01:15:14 -0700 | [diff] [blame] | 154 | SRC_DEV=$(loopback_partscan "${SRC_IMAGE}") |
Rahul Chaturvedi | b5643e8 | 2010-07-09 10:46:05 +0530 | [diff] [blame] | 155 | |
| 156 | # Fix the kernel command line |
Gabe Black | 067b354 | 2014-09-23 01:15:14 -0700 | [diff] [blame] | 157 | SRC_STATE="${SRC_DEV}"p1 |
| 158 | SRC_ROOTFS="${SRC_DEV}"p3 |
| 159 | SRC_KERN="${SRC_DEV}"p4 |
| 160 | SRC_OEM="${SRC_DEV}"p8 |
| 161 | SRC_ESP="${SRC_DEV}"p12 |
Rahul Chaturvedi | b5643e8 | 2010-07-09 10:46:05 +0530 | [diff] [blame] | 162 | if [ -n "${FLAGS_state_image}" ]; then |
| 163 | TEMP_STATE="${FLAGS_state_image}" |
Rahul Chaturvedi | e770e16 | 2010-07-15 00:35:11 +0530 | [diff] [blame] | 164 | else |
Liam McLoughlin | b78a7c3 | 2012-11-06 20:19:05 -0500 | [diff] [blame] | 165 | STATEFUL_SIZE_BYTES=$(get_filesystem_size "${FLAGS_disk_layout}" 1) |
Liam McLoughlin | 5b37c54 | 2012-08-16 11:09:37 -0700 | [diff] [blame] | 166 | STATEFUL_SIZE_MEGABYTES=$(( STATEFUL_SIZE_BYTES / 1024 / 1024 )) |
Gabe Black | 067b354 | 2014-09-23 01:15:14 -0700 | [diff] [blame] | 167 | original_image_size=$(bd_safe_size "${SRC_STATE}") |
Liam McLoughlin | 5b37c54 | 2012-08-16 11:09:37 -0700 | [diff] [blame] | 168 | if [ "${original_image_size}" -gt "${STATEFUL_SIZE_BYTES}" ]; then |
Sam Hurst | c94b7f9 | 2018-06-07 07:14:54 -0700 | [diff] [blame] | 169 | if [ $(( original_image_size - STATEFUL_SIZE_BYTES )) -lt \ |
| 170 | $(( 1024 * 1024 )) ]; then |
| 171 | # cgpt.py sometimes makes the stateful a tiny bit larger to |
| 172 | # counteract alignment losses. |
| 173 | # This is fine -- just keep using the slightly larger partition as it is. |
| 174 | TEMP_STATE="${SRC_STATE}" |
| 175 | else |
| 176 | die "Cannot resize stateful image to smaller than original. Exiting." |
| 177 | fi |
| 178 | else |
| 179 | echo "Resizing stateful partition to ${STATEFUL_SIZE_MEGABYTES}MB" |
| 180 | # Extend the original file size to the new size. |
| 181 | TEMP_STATE="${TEMP_DIR}"/stateful |
| 182 | # Create TEMP_STATE as a regular user so a regular user can delete it. |
| 183 | sudo dd if="${SRC_STATE}" bs=16M status=none > "${TEMP_STATE}" |
| 184 | sudo e2fsck -pf "${TEMP_STATE}" |
| 185 | sudo resize2fs "${TEMP_STATE}" ${STATEFUL_SIZE_MEGABYTES}M |
Rahul Chaturvedi | e770e16 | 2010-07-15 00:35:11 +0530 | [diff] [blame] | 186 | fi |
Rahul Chaturvedi | b5643e8 | 2010-07-09 10:46:05 +0530 | [diff] [blame] | 187 | fi |
Rahul Chaturvedi | b5643e8 | 2010-07-09 10:46:05 +0530 | [diff] [blame] | 188 | TEMP_PMBR="${TEMP_DIR}"/pmbr |
| 189 | dd if="${SRC_IMAGE}" of="${TEMP_PMBR}" bs=512 count=1 |
| 190 | |
Gabe Black | 067b354 | 2014-09-23 01:15:14 -0700 | [diff] [blame] | 191 | # Set up a new partition table. |
| 192 | PARTITION_SCRIPT_PATH=$(mktemp) |
| 193 | write_partition_script "${FLAGS_disk_layout}" "${PARTITION_SCRIPT_PATH}" |
| 194 | . "${PARTITION_SCRIPT_PATH}" |
| 195 | write_partition_table "${TEMP_IMG}" "${TEMP_PMBR}" |
| 196 | rm "${PARTITION_SCRIPT_PATH}" |
| 197 | |
| 198 | DST_DEV=$(loopback_partscan "${TEMP_IMG}") |
| 199 | DST_STATE="${DST_DEV}"p1 |
| 200 | DST_ROOTFS="${DST_DEV}"p3 |
| 201 | DST_KERN="${DST_DEV}"p4 |
| 202 | DST_OEM="${DST_DEV}"p8 |
| 203 | DST_ESP="${DST_DEV}"p12 |
| 204 | |
| 205 | # Copy into the partition parts of the file. |
LaMont Jones | b24a4bd | 2019-06-17 09:00:34 -0600 | [diff] [blame] | 206 | # When copying to (or from) a non-regular file, cp ignores --sparse. Since we |
| 207 | # have created a collection of empty partitions for the new image above, we can |
| 208 | # use 'dd conv=sparse' to both speed up the copy, and (apparently) avoid |
| 209 | # b/135292499. See also crbug.com/957712. This only works because we know that |
| 210 | # the destination partition is all zeros. |
| 211 | sudo dd if="${SRC_ROOTFS}" of="${DST_ROOTFS}" conv=sparse bs=2M |
| 212 | sudo dd if="${TEMP_STATE}" of="${DST_STATE}" conv=sparse bs=2M |
| 213 | sudo dd if="${SRC_ESP}" of="${DST_ESP}" conv=sparse bs=2M |
| 214 | sudo dd if="${SRC_OEM}" of="${DST_OEM}" conv=sparse bs=2M |
Allen Webb | 6b80db6 | 2019-06-12 10:06:01 -0700 | [diff] [blame] | 215 | sync |
Gabe Black | 067b354 | 2014-09-23 01:15:14 -0700 | [diff] [blame] | 216 | |
Rahul Chaturvedi | b5643e8 | 2010-07-09 10:46:05 +0530 | [diff] [blame] | 217 | TEMP_MNT=$(mktemp -d) |
Will Drewry | efce668 | 2010-07-23 19:43:27 -0500 | [diff] [blame] | 218 | TEMP_ESP_MNT=$(mktemp -d) |
Rahul Chaturvedi | b5643e8 | 2010-07-09 10:46:05 +0530 | [diff] [blame] | 219 | mkdir -p "${TEMP_MNT}" |
Gabe Black | 067b354 | 2014-09-23 01:15:14 -0700 | [diff] [blame] | 220 | enable_rw_mount "${DST_ROOTFS}" |
| 221 | sudo mount "${DST_ROOTFS}" "${TEMP_MNT}" |
Will Drewry | efce668 | 2010-07-23 19:43:27 -0500 | [diff] [blame] | 222 | mkdir -p "${TEMP_ESP_MNT}" |
Gabe Black | 067b354 | 2014-09-23 01:15:14 -0700 | [diff] [blame] | 223 | sudo mount "${DST_ESP}" "${TEMP_ESP_MNT}" |
Will Drewry | efce668 | 2010-07-23 19:43:27 -0500 | [diff] [blame] | 224 | |
Will Drewry | 537caa9 | 2010-08-20 20:30:56 -0500 | [diff] [blame] | 225 | # Unmount everything prior to building a final image |
Mike Frysinger | 9ebc8ce | 2015-04-06 13:15:01 -0400 | [diff] [blame] | 226 | trap 'die_err_trap' INT TERM EXIT |
Rahul Chaturvedi | b5643e8 | 2010-07-09 10:46:05 +0530 | [diff] [blame] | 227 | cleanup |
| 228 | |
Gabe Black | b982759 | 2014-09-03 21:58:11 -0700 | [diff] [blame] | 229 | # Make the built-image bootable. |
Will Drewry | 537caa9 | 2010-08-20 20:30:56 -0500 | [diff] [blame] | 230 | # NOTE: The TEMP_IMG must live in the same image dir as the original image |
| 231 | # to operate automatically below. |
| 232 | ${SCRIPTS_DIR}/bin/cros_make_image_bootable $(dirname "${TEMP_IMG}") \ |
| 233 | $(basename "${TEMP_IMG}") \ |
Arkaitz Ruiz Alvarez | 2bf8859 | 2011-07-07 15:47:31 -0700 | [diff] [blame] | 234 | --force_developer_mode |
Will Drewry | 537caa9 | 2010-08-20 20:30:56 -0500 | [diff] [blame] | 235 | |
Gabe Black | 34bbc10 | 2014-09-10 16:35:56 -0700 | [diff] [blame] | 236 | IMAGE_DEV="" |
Gabe Black | fbdb1d5 | 2014-09-22 23:43:35 -0700 | [diff] [blame] | 237 | detach_loopback() { |
Gabe Black | 34bbc10 | 2014-09-10 16:35:56 -0700 | [diff] [blame] | 238 | if [ -n "${IMAGE_DEV}" ]; then |
Gabe Black | fbdb1d5 | 2014-09-22 23:43:35 -0700 | [diff] [blame] | 239 | loopback_detach "${IMAGE_DEV}" |
Gabe Black | 34bbc10 | 2014-09-10 16:35:56 -0700 | [diff] [blame] | 240 | fi |
| 241 | } |
Mike Frysinger | 9ebc8ce | 2015-04-06 13:15:01 -0400 | [diff] [blame] | 242 | trap 'ret=$?; detach_loopback; die_err_trap ${ret}' INT TERM EXIT |
Gabe Black | 34bbc10 | 2014-09-10 16:35:56 -0700 | [diff] [blame] | 243 | |
Gabe Black | b982759 | 2014-09-03 21:58:11 -0700 | [diff] [blame] | 244 | # cros_make_image_bootable made the kernel in slot A recovery signed. We want |
| 245 | # it to be normally signed like the one in slot B, so copy B into A. |
LaMont Jones | b24a4bd | 2019-06-17 09:00:34 -0600 | [diff] [blame] | 246 | # Because cros_make_image_bootable overwrote p2 above, we cannot do a sparse |
| 247 | # copy. |
Gabe Black | fbdb1d5 | 2014-09-22 23:43:35 -0700 | [diff] [blame] | 248 | IMAGE_DEV=$(loopback_partscan "${TEMP_IMG}") |
LaMont Jones | b24a4bd | 2019-06-17 09:00:34 -0600 | [diff] [blame] | 249 | sudo dd if=${IMAGE_DEV}p4 of=${IMAGE_DEV}p2 bs=2M |
Allen Webb | 6b80db6 | 2019-06-12 10:06:01 -0700 | [diff] [blame] | 250 | sync |
Gabe Black | b982759 | 2014-09-03 21:58:11 -0700 | [diff] [blame] | 251 | |
Mike Frysinger | 9ebc8ce | 2015-04-06 13:15:01 -0400 | [diff] [blame] | 252 | trap 'die_err_trap' INT TERM EXIT |
| 253 | switch_to_strict_mode |
Gabe Black | fbdb1d5 | 2014-09-22 23:43:35 -0700 | [diff] [blame] | 254 | loopback_detach "${IMAGE_DEV}" |
Gabe Black | b982759 | 2014-09-03 21:58:11 -0700 | [diff] [blame] | 255 | |
Rahul Chaturvedi | b5643e8 | 2010-07-09 10:46:05 +0530 | [diff] [blame] | 256 | echo Creating final image |
Gaurav Shah | 550edca | 2014-09-25 11:13:55 -0700 | [diff] [blame] | 257 | mv "${TEMP_IMG}" "${FLAGS_to}/${DEFAULT_QEMU_IMAGE}" |
Rahul Chaturvedi | b5643e8 | 2010-07-09 10:46:05 +0530 | [diff] [blame] | 258 | |
Gabe Black | 067b354 | 2014-09-23 01:15:14 -0700 | [diff] [blame] | 259 | rm -rf "${TEMP_IMG}" |
Rahul Chaturvedi | b5643e8 | 2010-07-09 10:46:05 +0530 | [diff] [blame] | 260 | |
| 261 | echo "Created image at ${FLAGS_to}" |
| 262 | |
Nicolas Norvez | 82f51ec | 2018-01-26 10:10:37 -0800 | [diff] [blame] | 263 | echo "You can start the image with:" |
| 264 | echo "cros_vm --start --image-path ${FLAGS_to}/${DEFAULT_QEMU_IMAGE}" |
Rahul Chaturvedi | b5643e8 | 2010-07-09 10:46:05 +0530 | [diff] [blame] | 265 | |