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 | |
| 7 | # Script to convert the output of build_image.sh to a VMware image and write a |
| 8 | # corresponding VMware config file. |
| 9 | |
Kees Cook | 84a4c7a | 2011-10-18 13:21:41 -0700 | [diff] [blame] | 10 | # Helper scripts should be run from the same location as this script. |
| 11 | SCRIPT_ROOT=$(dirname "$(readlink -f "$0")") |
David James | 359d3e1 | 2012-07-10 13:09:48 -0700 | [diff] [blame] | 12 | . "${SCRIPT_ROOT}/common.sh" || exit 1 |
Liam McLoughlin | 5b37c54 | 2012-08-16 11:09:37 -0700 | [diff] [blame] | 13 | . "${SCRIPT_ROOT}/build_library/disk_layout_util.sh" || exit 1 |
| 14 | . "${SCRIPT_ROOT}/build_library/build_common.sh" || exit 1 |
Greg Spencer | 798d75f | 2011-02-01 22:04:49 -0800 | [diff] [blame] | 15 | |
| 16 | # Need to be inside the chroot to load chromeos-common.sh |
| 17 | assert_inside_chroot |
| 18 | |
| 19 | # Load functions and constants for chromeos-install |
Gwendal Grignou | 0f61849 | 2014-04-07 20:05:58 +0000 | [diff] [blame] | 20 | . /usr/share/misc/chromeos-common.sh || exit 1 |
David James | 359d3e1 | 2012-07-10 13:09:48 -0700 | [diff] [blame] | 21 | . "${SCRIPT_ROOT}/lib/cros_vm_constants.sh" || exit 1 |
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 format "qemu" \ |
| 36 | "Output format, either qemu, vmware or virtualbox" |
| 37 | DEFINE_string from "" \ |
| 38 | "Directory containing rootfs.image and mbr.image" |
Don Garrett | 7937ef8 | 2014-08-25 18:04:05 -0700 | [diff] [blame] | 39 | DEFINE_string disk_layout "2gb-rootfs-updatable" \ |
Liam McLoughlin | b78a7c3 | 2012-11-06 20:19:05 -0500 | [diff] [blame] | 40 | "The disk layout type to use for this image." |
Rahul Chaturvedi | b5643e8 | 2010-07-09 10:46:05 +0530 | [diff] [blame] | 41 | DEFINE_boolean make_vmx ${FLAGS_TRUE} \ |
| 42 | "Create a vmx file for use with vmplayer (vmware only)." |
| 43 | DEFINE_integer mem "${DEFAULT_MEM}" \ |
| 44 | "Memory size for the vm config in MBs (vmware only)." |
Rahul Chaturvedi | b5643e8 | 2010-07-09 10:46:05 +0530 | [diff] [blame] | 45 | DEFINE_string state_image "" \ |
| 46 | "Stateful partition image (defaults to creating new statful partition)" |
| 47 | DEFINE_boolean test_image "${FLAGS_FALSE}" \ |
Simon Glass | 142ca06 | 2011-02-09 13:39:43 -0800 | [diff] [blame] | 48 | "Copies normal image to ${CHROMEOS_TEST_IMAGE_NAME}, modifies it for test." |
Rahul Chaturvedi | b5643e8 | 2010-07-09 10:46:05 +0530 | [diff] [blame] | 49 | DEFINE_string to "" \ |
| 50 | "Destination folder for VM output file(s)" |
| 51 | DEFINE_string vbox_disk "${DEFAULT_VBOX_DISK}" \ |
| 52 | "Filename for the output disk (virtualbox only)." |
Rahul Chaturvedi | b5643e8 | 2010-07-09 10:46:05 +0530 | [diff] [blame] | 53 | DEFINE_string vmdk "${DEFAULT_VMDK}" \ |
| 54 | "Filename for the vmware disk image (vmware only)." |
| 55 | DEFINE_string vmx "${DEFAULT_VMX}" \ |
| 56 | "Filename for the vmware config (vmware only)." |
| 57 | |
| 58 | # Parse command line |
| 59 | FLAGS "$@" || exit 1 |
| 60 | eval set -- "${FLAGS_ARGV}" |
| 61 | |
| 62 | # Die on any errors. |
Brian Harring | 7f175a5 | 2012-03-02 05:37:00 -0800 | [diff] [blame] | 63 | switch_to_strict_mode |
Rahul Chaturvedi | b5643e8 | 2010-07-09 10:46:05 +0530 | [diff] [blame] | 64 | |
| 65 | if [ -z "${FLAGS_board}" ] ; then |
Brian Harring | 7f175a5 | 2012-03-02 05:37:00 -0800 | [diff] [blame] | 66 | die_notrace "--board is required." |
Rahul Chaturvedi | b5643e8 | 2010-07-09 10:46:05 +0530 | [diff] [blame] | 67 | fi |
| 68 | |
Gabe Black | 067b354 | 2014-09-23 01:15:14 -0700 | [diff] [blame^] | 69 | TEMP_DIR=$(mktemp -d) |
| 70 | TEMP_MNT="" |
| 71 | TEMP_ESP_MNT="" |
| 72 | SRC_DEV="" |
| 73 | DST_DEV="" |
| 74 | cleanup() { |
| 75 | if [[ -n "${TEMP_MNT}" ]]; then |
| 76 | safe_umount "${TEMP_MNT}" || true |
| 77 | rmdir "${TEMP_MNT}" || true |
| 78 | fi |
| 79 | if [[ -n "${TEMP_ESP_MNT}" ]]; then |
| 80 | safe_umount "${TEMP_ESP_MNT}" || true |
| 81 | rmdir "${TEMP_ESP_MNT}" || true |
| 82 | fi |
| 83 | |
| 84 | if [[ -n "${SRC_DEV}" ]]; then |
| 85 | loopback_detach "${SRC_DEV}" || true |
| 86 | fi |
| 87 | if [[ -n "${DST_DEV}" ]]; then |
| 88 | loopback_detach "${DST_DEV}" || true |
| 89 | fi |
| 90 | rm -rf "${TEMP_DIR}" |
| 91 | } |
| 92 | trap cleanup INT TERM EXIT |
| 93 | |
Liam McLoughlin | 5b37c54 | 2012-08-16 11:09:37 -0700 | [diff] [blame] | 94 | BOARD="$FLAGS_board" |
Chris Sosa | cc09f84 | 2010-09-21 17:09:51 -0700 | [diff] [blame] | 95 | |
Rahul Chaturvedi | b5643e8 | 2010-07-09 10:46:05 +0530 | [diff] [blame] | 96 | IMAGES_DIR="${DEFAULT_BUILD_ROOT}/images/${FLAGS_board}" |
| 97 | # Default to the most recent image |
| 98 | if [ -z "${FLAGS_from}" ] ; then |
Kees Cook | 84a4c7a | 2011-10-18 13:21:41 -0700 | [diff] [blame] | 99 | FLAGS_from="$(${SCRIPT_ROOT}/get_latest_image.sh --board=${FLAGS_board})" |
Zelidrag Hornung | 42ca818 | 2010-07-12 18:08:44 -0700 | [diff] [blame] | 100 | else |
| 101 | pushd "${FLAGS_from}" && FLAGS_from=`pwd` && popd |
Rahul Chaturvedi | b5643e8 | 2010-07-09 10:46:05 +0530 | [diff] [blame] | 102 | fi |
| 103 | if [ -z "${FLAGS_to}" ] ; then |
| 104 | FLAGS_to="${FLAGS_from}" |
| 105 | fi |
| 106 | |
David James | 7efb76c | 2013-01-09 15:25:58 -0800 | [diff] [blame] | 107 | if [ ${FLAGS_factory} -eq ${FLAGS_TRUE} ]; then |
| 108 | SRC_IMAGE="${FLAGS_from}/${CHROMEOS_FACTORY_TEST_IMAGE_NAME}" |
| 109 | elif [ ${FLAGS_test_image} -eq ${FLAGS_TRUE} ]; then |
| 110 | SRC_IMAGE="${FLAGS_from}/${CHROMEOS_TEST_IMAGE_NAME}" |
Simon Glass | 142ca06 | 2011-02-09 13:39:43 -0800 | [diff] [blame] | 111 | else |
| 112 | # Use the standard image |
| 113 | SRC_IMAGE="${FLAGS_from}/${CHROMEOS_IMAGE_NAME}" |
Rahul Chaturvedi | b5643e8 | 2010-07-09 10:46:05 +0530 | [diff] [blame] | 114 | fi |
| 115 | |
| 116 | # Memory units are in MBs |
Greg Spencer | 798d75f | 2011-02-01 22:04:49 -0800 | [diff] [blame] | 117 | TEMP_IMG="$(dirname "${SRC_IMAGE}")/vm_temp_image.bin" |
Rahul Chaturvedi | b5643e8 | 2010-07-09 10:46:05 +0530 | [diff] [blame] | 118 | |
| 119 | # If we're not building for VMWare, don't build the vmx |
| 120 | if [ "${FLAGS_format}" != "vmware" ]; then |
| 121 | FLAGS_make_vmx="${FLAGS_FALSE}" |
| 122 | fi |
| 123 | |
| 124 | # Convert args to paths. Need eval to un-quote the string so that shell |
| 125 | # chars like ~ are processed; just doing FOO=`readlink -f $FOO` won't work. |
| 126 | FLAGS_from=`eval readlink -f $FLAGS_from` |
| 127 | FLAGS_to=`eval readlink -f $FLAGS_to` |
| 128 | |
| 129 | # Split apart the partitions and make some new ones |
Gabe Black | 067b354 | 2014-09-23 01:15:14 -0700 | [diff] [blame^] | 130 | SRC_DEV=$(loopback_partscan "${SRC_IMAGE}") |
Rahul Chaturvedi | b5643e8 | 2010-07-09 10:46:05 +0530 | [diff] [blame] | 131 | |
| 132 | # Fix the kernel command line |
Gabe Black | 067b354 | 2014-09-23 01:15:14 -0700 | [diff] [blame^] | 133 | SRC_STATE="${SRC_DEV}"p1 |
| 134 | SRC_ROOTFS="${SRC_DEV}"p3 |
| 135 | SRC_KERN="${SRC_DEV}"p4 |
| 136 | SRC_OEM="${SRC_DEV}"p8 |
| 137 | SRC_ESP="${SRC_DEV}"p12 |
Rahul Chaturvedi | b5643e8 | 2010-07-09 10:46:05 +0530 | [diff] [blame] | 138 | if [ -n "${FLAGS_state_image}" ]; then |
| 139 | TEMP_STATE="${FLAGS_state_image}" |
Rahul Chaturvedi | e770e16 | 2010-07-15 00:35:11 +0530 | [diff] [blame] | 140 | else |
Liam McLoughlin | b78a7c3 | 2012-11-06 20:19:05 -0500 | [diff] [blame] | 141 | STATEFUL_SIZE_BYTES=$(get_filesystem_size "${FLAGS_disk_layout}" 1) |
Liam McLoughlin | 5b37c54 | 2012-08-16 11:09:37 -0700 | [diff] [blame] | 142 | STATEFUL_SIZE_MEGABYTES=$(( STATEFUL_SIZE_BYTES / 1024 / 1024 )) |
Gabe Black | 067b354 | 2014-09-23 01:15:14 -0700 | [diff] [blame^] | 143 | original_image_size=$(bd_safe_size "${SRC_STATE}") |
Liam McLoughlin | 5b37c54 | 2012-08-16 11:09:37 -0700 | [diff] [blame] | 144 | if [ "${original_image_size}" -gt "${STATEFUL_SIZE_BYTES}" ]; then |
| 145 | die "Cannot resize stateful image to smaller than original. Exiting." |
Rahul Chaturvedi | e770e16 | 2010-07-15 00:35:11 +0530 | [diff] [blame] | 146 | fi |
Liam McLoughlin | 5b37c54 | 2012-08-16 11:09:37 -0700 | [diff] [blame] | 147 | |
| 148 | echo "Resizing stateful partition to ${STATEFUL_SIZE_MEGABYTES}MB" |
| 149 | # Extend the original file size to the new size. |
Gabe Black | 067b354 | 2014-09-23 01:15:14 -0700 | [diff] [blame^] | 150 | TEMP_STATE="${TEMP_DIR}"/stateful |
| 151 | # Create TEMP_STATE as a regular user so a regular user can delete it. |
| 152 | sudo chmod a+r "${SRC_STATE}" |
| 153 | dd if="${SRC_STATE}" of="${TEMP_STATE}" |
Liam McLoughlin | 5b37c54 | 2012-08-16 11:09:37 -0700 | [diff] [blame] | 154 | sudo e2fsck -pf "${TEMP_STATE}" |
| 155 | sudo resize2fs "${TEMP_STATE}" ${STATEFUL_SIZE_MEGABYTES}M |
Rahul Chaturvedi | b5643e8 | 2010-07-09 10:46:05 +0530 | [diff] [blame] | 156 | fi |
Rahul Chaturvedi | b5643e8 | 2010-07-09 10:46:05 +0530 | [diff] [blame] | 157 | TEMP_PMBR="${TEMP_DIR}"/pmbr |
| 158 | dd if="${SRC_IMAGE}" of="${TEMP_PMBR}" bs=512 count=1 |
| 159 | |
Gabe Black | 067b354 | 2014-09-23 01:15:14 -0700 | [diff] [blame^] | 160 | # Set up a new partition table. |
| 161 | PARTITION_SCRIPT_PATH=$(mktemp) |
| 162 | write_partition_script "${FLAGS_disk_layout}" "${PARTITION_SCRIPT_PATH}" |
| 163 | . "${PARTITION_SCRIPT_PATH}" |
| 164 | write_partition_table "${TEMP_IMG}" "${TEMP_PMBR}" |
| 165 | rm "${PARTITION_SCRIPT_PATH}" |
| 166 | |
| 167 | DST_DEV=$(loopback_partscan "${TEMP_IMG}") |
| 168 | DST_STATE="${DST_DEV}"p1 |
| 169 | DST_ROOTFS="${DST_DEV}"p3 |
| 170 | DST_KERN="${DST_DEV}"p4 |
| 171 | DST_OEM="${DST_DEV}"p8 |
| 172 | DST_ESP="${DST_DEV}"p12 |
| 173 | |
| 174 | # Copy into the partition parts of the file. |
| 175 | sudo dd if="${SRC_ROOTFS}" of="${DST_ROOTFS}" |
| 176 | sudo dd if="${TEMP_STATE}" of="${DST_STATE}" |
| 177 | sudo dd if="${SRC_ESP}" of="${DST_ESP}" |
| 178 | sudo dd if="${SRC_OEM}" of="${DST_OEM}" |
| 179 | |
Rahul Chaturvedi | b5643e8 | 2010-07-09 10:46:05 +0530 | [diff] [blame] | 180 | TEMP_MNT=$(mktemp -d) |
Will Drewry | efce668 | 2010-07-23 19:43:27 -0500 | [diff] [blame] | 181 | TEMP_ESP_MNT=$(mktemp -d) |
Rahul Chaturvedi | b5643e8 | 2010-07-09 10:46:05 +0530 | [diff] [blame] | 182 | mkdir -p "${TEMP_MNT}" |
Gabe Black | 067b354 | 2014-09-23 01:15:14 -0700 | [diff] [blame^] | 183 | enable_rw_mount "${DST_ROOTFS}" |
| 184 | sudo mount "${DST_ROOTFS}" "${TEMP_MNT}" |
Will Drewry | efce668 | 2010-07-23 19:43:27 -0500 | [diff] [blame] | 185 | mkdir -p "${TEMP_ESP_MNT}" |
Gabe Black | 067b354 | 2014-09-23 01:15:14 -0700 | [diff] [blame^] | 186 | sudo mount "${DST_ESP}" "${TEMP_ESP_MNT}" |
Will Drewry | efce668 | 2010-07-23 19:43:27 -0500 | [diff] [blame] | 187 | |
Ben Chan | d4ec205 | 2014-07-17 18:18:31 -0700 | [diff] [blame] | 188 | # Modify the unverified usb template, which uses a default usb_disk of sdb3, |
| 189 | # for targets (e.g. x86 and amd64) that have syslinux installed. |
| 190 | SYSLINUX_USB_A_CONFIG="${TEMP_MNT}/boot/syslinux/usb.A.cfg" |
| 191 | if [ -e "${SYSLINUX_USB_A_CONFIG}" ]; then |
| 192 | sudo sed -i -e 's/sdb3/sda3/g' "${SYSLINUX_USB_A_CONFIG}" |
| 193 | fi |
Will Drewry | 537caa9 | 2010-08-20 20:30:56 -0500 | [diff] [blame] | 194 | |
Jorge Lucangeli Obes | 29b972b | 2013-12-18 15:56:26 -0800 | [diff] [blame] | 195 | # Add loading of cirrus fb module |
Dominik Behr | d1a71ca | 2013-10-01 15:18:38 -0700 | [diff] [blame] | 196 | if [ "${FLAGS_format}" = "qemu" ]; then |
| 197 | sudo_clobber "${TEMP_MNT}/etc/init/cirrusfb.conf" <<END |
| 198 | start on starting boot-splash |
| 199 | task |
| 200 | exec modprobe cirrus |
| 201 | END |
| 202 | fi |
Jorge Lucangeli Obes | 29b972b | 2013-12-18 15:56:26 -0800 | [diff] [blame] | 203 | |
Will Drewry | 537caa9 | 2010-08-20 20:30:56 -0500 | [diff] [blame] | 204 | # Unmount everything prior to building a final image |
Rahul Chaturvedi | b5643e8 | 2010-07-09 10:46:05 +0530 | [diff] [blame] | 205 | trap - INT TERM EXIT |
| 206 | cleanup |
| 207 | |
Gabe Black | b982759 | 2014-09-03 21:58:11 -0700 | [diff] [blame] | 208 | # Make the built-image bootable. |
Will Drewry | 537caa9 | 2010-08-20 20:30:56 -0500 | [diff] [blame] | 209 | # NOTE: The TEMP_IMG must live in the same image dir as the original image |
| 210 | # to operate automatically below. |
| 211 | ${SCRIPTS_DIR}/bin/cros_make_image_bootable $(dirname "${TEMP_IMG}") \ |
| 212 | $(basename "${TEMP_IMG}") \ |
Arkaitz Ruiz Alvarez | 2bf8859 | 2011-07-07 15:47:31 -0700 | [diff] [blame] | 213 | --force_developer_mode |
Will Drewry | 537caa9 | 2010-08-20 20:30:56 -0500 | [diff] [blame] | 214 | |
Gabe Black | 34bbc10 | 2014-09-10 16:35:56 -0700 | [diff] [blame] | 215 | IMAGE_DEV="" |
Gabe Black | fbdb1d5 | 2014-09-22 23:43:35 -0700 | [diff] [blame] | 216 | detach_loopback() { |
Gabe Black | 34bbc10 | 2014-09-10 16:35:56 -0700 | [diff] [blame] | 217 | if [ -n "${IMAGE_DEV}" ]; then |
Gabe Black | fbdb1d5 | 2014-09-22 23:43:35 -0700 | [diff] [blame] | 218 | loopback_detach "${IMAGE_DEV}" |
Gabe Black | 34bbc10 | 2014-09-10 16:35:56 -0700 | [diff] [blame] | 219 | fi |
| 220 | } |
| 221 | trap detach_loopback INT TERM EXIT |
| 222 | |
Gabe Black | b982759 | 2014-09-03 21:58:11 -0700 | [diff] [blame] | 223 | # cros_make_image_bootable made the kernel in slot A recovery signed. We want |
| 224 | # it to be normally signed like the one in slot B, so copy B into A. |
Gabe Black | fbdb1d5 | 2014-09-22 23:43:35 -0700 | [diff] [blame] | 225 | IMAGE_DEV=$(loopback_partscan "${TEMP_IMG}") |
Gabe Black | b982759 | 2014-09-03 21:58:11 -0700 | [diff] [blame] | 226 | sudo cp ${IMAGE_DEV}p4 ${IMAGE_DEV}p2 |
| 227 | |
Gabe Black | 34bbc10 | 2014-09-10 16:35:56 -0700 | [diff] [blame] | 228 | trap - INT TERM EXIT |
Gabe Black | fbdb1d5 | 2014-09-22 23:43:35 -0700 | [diff] [blame] | 229 | loopback_detach "${IMAGE_DEV}" |
Gabe Black | b982759 | 2014-09-03 21:58:11 -0700 | [diff] [blame] | 230 | |
Rahul Chaturvedi | b5643e8 | 2010-07-09 10:46:05 +0530 | [diff] [blame] | 231 | echo Creating final image |
| 232 | # Convert image to output format |
| 233 | if [ "${FLAGS_format}" = "virtualbox" -o "${FLAGS_format}" = "qemu" ]; then |
| 234 | if [ "${FLAGS_format}" = "virtualbox" ]; then |
Liam McLoughlin | c9f1dab | 2011-11-29 18:17:26 +0000 | [diff] [blame] | 235 | sudo VBoxManage convertdd "${TEMP_IMG}" "${FLAGS_to}/${FLAGS_vbox_disk}" |
Rahul Chaturvedi | b5643e8 | 2010-07-09 10:46:05 +0530 | [diff] [blame] | 236 | else |
| 237 | mv ${TEMP_IMG} ${FLAGS_to}/${DEFAULT_QEMU_IMAGE} |
| 238 | fi |
| 239 | elif [ "${FLAGS_format}" = "vmware" ]; then |
| 240 | qemu-img convert -f raw "${TEMP_IMG}" \ |
| 241 | -O vmdk "${FLAGS_to}/${FLAGS_vmdk}" |
| 242 | else |
Brian Harring | 7f175a5 | 2012-03-02 05:37:00 -0800 | [diff] [blame] | 243 | die_notrace "Invalid format: ${FLAGS_format}" |
Rahul Chaturvedi | b5643e8 | 2010-07-09 10:46:05 +0530 | [diff] [blame] | 244 | fi |
| 245 | |
Gabe Black | 067b354 | 2014-09-23 01:15:14 -0700 | [diff] [blame^] | 246 | rm -rf "${TEMP_IMG}" |
Rahul Chaturvedi | b5643e8 | 2010-07-09 10:46:05 +0530 | [diff] [blame] | 247 | |
| 248 | echo "Created image at ${FLAGS_to}" |
| 249 | |
| 250 | # Generate the vmware config file |
| 251 | # A good reference doc: http://www.sanbarrow.com/vmx.html |
| 252 | VMX_CONFIG="#!/usr/bin/vmware |
| 253 | .encoding = \"UTF-8\" |
| 254 | config.version = \"8\" |
| 255 | virtualHW.version = \"4\" |
| 256 | memsize = \"${FLAGS_mem}\" |
| 257 | ide0:0.present = \"TRUE\" |
| 258 | ide0:0.fileName = \"${FLAGS_vmdk}\" |
| 259 | ethernet0.present = \"TRUE\" |
| 260 | usb.present = \"TRUE\" |
| 261 | sound.present = \"TRUE\" |
| 262 | sound.virtualDev = \"es1371\" |
| 263 | displayName = \"Chromium OS\" |
| 264 | guestOS = \"otherlinux\" |
| 265 | ethernet0.addressType = \"generated\" |
| 266 | floppy0.present = \"FALSE\"" |
| 267 | |
| 268 | if [[ "${FLAGS_make_vmx}" = "${FLAGS_TRUE}" ]]; then |
| 269 | echo "${VMX_CONFIG}" > "${FLAGS_to}/${FLAGS_vmx}" |
| 270 | echo "Wrote the following config to: ${FLAGS_to}/${FLAGS_vmx}" |
| 271 | echo "${VMX_CONFIG}" |
| 272 | fi |
| 273 | |
Olof Johansson | 3ed8d12 | 2010-09-27 13:29:40 -0500 | [diff] [blame] | 274 | |
| 275 | if [ "${FLAGS_format}" == "qemu" ]; then |
| 276 | echo "If you have qemu-kvm installed, you can start the image by:" |
John Sheu | b7b095b | 2012-12-18 13:30:26 -0800 | [diff] [blame] | 277 | echo "sudo kvm -m ${FLAGS_mem} -vga cirrus -pidfile /tmp/kvm.pid" \ |
| 278 | "-net nic,model=virtio -net user,hostfwd=tcp::9222-:22 \\" |
| 279 | echo "-hda ${FLAGS_to}/${DEFAULT_QEMU_IMAGE}" |
Olof Johansson | 3ed8d12 | 2010-09-27 13:29:40 -0500 | [diff] [blame] | 280 | fi |