Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 #!/bin/bash | 1 #!/bin/bash |
| 2 | 2 |
| 3 # Copyright (c) 2010 The Chromium OS Authors. All rights reserved. | 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 | 4 # Use of this source code is governed by a BSD-style license that can be |
| 5 # found in the LICENSE file. | 5 # found in the LICENSE file. |
| 6 | 6 |
| 7 # Script to convert the output of build_image.sh to a VMware image and write a | 7 # Script to convert the output of build_image.sh to a VMware image and write a |
| 8 # corresponding VMware config file. | 8 # corresponding VMware config file. |
| 9 | 9 |
| 10 # --- BEGIN COMMON.SH BOILERPLATE --- | 10 # --- BEGIN COMMON.SH BOILERPLATE --- |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 57 "Create a vmx file for use with vmplayer (vmware only)." | 57 "Create a vmx file for use with vmplayer (vmware only)." |
| 58 DEFINE_integer mem "${DEFAULT_MEM}" \ | 58 DEFINE_integer mem "${DEFAULT_MEM}" \ |
| 59 "Memory size for the vm config in MBs (vmware only)." | 59 "Memory size for the vm config in MBs (vmware only)." |
| 60 DEFINE_integer rootfs_partition_size 1024 \ | 60 DEFINE_integer rootfs_partition_size 1024 \ |
| 61 "rootfs parition size in MBs." | 61 "rootfs parition size in MBs." |
| 62 DEFINE_string state_image "" \ | 62 DEFINE_string state_image "" \ |
| 63 "Stateful partition image (defaults to creating new statful partition)" | 63 "Stateful partition image (defaults to creating new statful partition)" |
| 64 DEFINE_integer statefulfs_size 2048 \ | 64 DEFINE_integer statefulfs_size 2048 \ |
| 65 "Stateful partition size in MBs." | 65 "Stateful partition size in MBs." |
| 66 DEFINE_boolean test_image "${FLAGS_FALSE}" \ | 66 DEFINE_boolean test_image "${FLAGS_FALSE}" \ |
| 67 "Copies normal image to chromiumos_test_image.bin, modifies it for test." | 67 "Copies normal image to ${CHROMEOS_TEST_IMAGE_NAME}, modifies it for test." |
| 68 DEFINE_string to "" \ | 68 DEFINE_string to "" \ |
| 69 "Destination folder for VM output file(s)" | 69 "Destination folder for VM output file(s)" |
| 70 DEFINE_string vbox_disk "${DEFAULT_VBOX_DISK}" \ | 70 DEFINE_string vbox_disk "${DEFAULT_VBOX_DISK}" \ |
| 71 "Filename for the output disk (virtualbox only)." | 71 "Filename for the output disk (virtualbox only)." |
| 72 DEFINE_integer vdisk_size 3072 \ | 72 DEFINE_integer vdisk_size 3072 \ |
| 73 "virtual disk size in MBs." | 73 "virtual disk size in MBs." |
| 74 DEFINE_string vmdk "${DEFAULT_VMDK}" \ | 74 DEFINE_string vmdk "${DEFAULT_VMDK}" \ |
| 75 "Filename for the vmware disk image (vmware only)." | 75 "Filename for the vmware disk image (vmware only)." |
| 76 DEFINE_string vmx "${DEFAULT_VMX}" \ | 76 DEFINE_string vmx "${DEFAULT_VMX}" \ |
| 77 "Filename for the vmware config (vmware only)." | 77 "Filename for the vmware config (vmware only)." |
| (...skipping 23 matching lines...) Expand all Loading... | |
| 101 # Default to the most recent image | 101 # Default to the most recent image |
| 102 if [ -z "${FLAGS_from}" ] ; then | 102 if [ -z "${FLAGS_from}" ] ; then |
| 103 FLAGS_from="$(./get_latest_image.sh --board=${FLAGS_board})" | 103 FLAGS_from="$(./get_latest_image.sh --board=${FLAGS_board})" |
| 104 else | 104 else |
| 105 pushd "${FLAGS_from}" && FLAGS_from=`pwd` && popd | 105 pushd "${FLAGS_from}" && FLAGS_from=`pwd` && popd |
| 106 fi | 106 fi |
| 107 if [ -z "${FLAGS_to}" ] ; then | 107 if [ -z "${FLAGS_to}" ] ; then |
| 108 FLAGS_to="${FLAGS_from}" | 108 FLAGS_to="${FLAGS_from}" |
| 109 fi | 109 fi |
| 110 | 110 |
| 111 # Use this image as the source image to copy | |
| 112 SRC_IMAGE="${FLAGS_from}/chromiumos_image.bin" | |
| 113 | |
| 114 # If we're asked to modify the image for test, then let's make a copy and | |
| 115 # modify that instead. | |
| 116 if [ ${FLAGS_test_image} -eq ${FLAGS_TRUE} ] ; then | 111 if [ ${FLAGS_test_image} -eq ${FLAGS_TRUE} ] ; then |
| 117 if [ ! -f "${FLAGS_from}/chromiumos_test_image.bin" ] || \ | 112 # Make a test image - this returns the test filename in CHROMEOS_RETURN_VAL |
| 118 [ ${FLAGS_force_copy} -eq ${FLAGS_TRUE} ] ; then | 113 prepare_test_image "${FLAGS_from}" "${CHROMEOS_IMAGE_NAME}" |
|
sosa
2011/02/09 02:58:52
Need to add FLAGS_force_copy=$FLAGS_TRUE here or a
| |
| 119 # Copy it. | 114 SRC_IMAGE="${CHROMEOS_RETURN_VAL}" |
| 120 echo "Creating test image from original..." | 115 else |
| 121 cp -f "${SRC_IMAGE}" "${FLAGS_from}/chromiumos_test_image.bin" | 116 # Use the standard image |
| 122 | 117 SRC_IMAGE="${FLAGS_from}/${CHROMEOS_IMAGE_NAME}" |
| 123 # Check for manufacturing image. | |
| 124 if [ ${FLAGS_factory} -eq ${FLAGS_TRUE} ] ; then | |
| 125 EXTRA_ARGS="--factory" | |
| 126 fi | |
| 127 | |
| 128 # Check for install shim. | |
| 129 if [ ${FLAGS_factory_install} -eq ${FLAGS_TRUE} ] ; then | |
| 130 EXTRA_ARGS="--factory_install" | |
| 131 fi | |
| 132 | |
| 133 # Modify it. Pass --yes so that mod_image_for_test.sh won't ask us if we | |
| 134 # really want to modify the image; the user gave their assent already with | |
| 135 # --test-image and the original image is going to be preserved. | |
| 136 "${SCRIPTS_DIR}/mod_image_for_test.sh" --board=${FLAGS_board} --image \ | |
| 137 "${FLAGS_from}/chromiumos_test_image.bin" ${EXTRA_ARGS} --yes | |
| 138 echo "Done with mod_image_for_test." | |
| 139 else | |
| 140 echo "Using cached test image." | |
| 141 fi | |
| 142 SRC_IMAGE="${FLAGS_from}/chromiumos_test_image.bin" | |
| 143 echo "Source test image is: ${SRC_IMAGE}" | |
| 144 fi | 118 fi |
| 145 | 119 |
| 146 # Memory units are in MBs | 120 # Memory units are in MBs |
| 147 TEMP_IMG="$(dirname "${SRC_IMAGE}")/vm_temp_image.bin" | 121 TEMP_IMG="$(dirname "${SRC_IMAGE}")/vm_temp_image.bin" |
| 148 | 122 |
| 149 # If we're not building for VMWare, don't build the vmx | 123 # If we're not building for VMWare, don't build the vmx |
| 150 if [ "${FLAGS_format}" != "vmware" ]; then | 124 if [ "${FLAGS_format}" != "vmware" ]; then |
| 151 FLAGS_make_vmx="${FLAGS_FALSE}" | 125 FLAGS_make_vmx="${FLAGS_FALSE}" |
| 152 fi | 126 fi |
| 153 | 127 |
| (...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 301 | 275 |
| 302 if [[ "${FLAGS_make_vmx}" = "${FLAGS_TRUE}" ]]; then | 276 if [[ "${FLAGS_make_vmx}" = "${FLAGS_TRUE}" ]]; then |
| 303 echo "${VMX_CONFIG}" > "${FLAGS_to}/${FLAGS_vmx}" | 277 echo "${VMX_CONFIG}" > "${FLAGS_to}/${FLAGS_vmx}" |
| 304 echo "Wrote the following config to: ${FLAGS_to}/${FLAGS_vmx}" | 278 echo "Wrote the following config to: ${FLAGS_to}/${FLAGS_vmx}" |
| 305 echo "${VMX_CONFIG}" | 279 echo "${VMX_CONFIG}" |
| 306 fi | 280 fi |
| 307 | 281 |
| 308 | 282 |
| 309 if [ "${FLAGS_format}" == "qemu" ]; then | 283 if [ "${FLAGS_format}" == "qemu" ]; then |
| 310 echo "If you have qemu-kvm installed, you can start the image by:" | 284 echo "If you have qemu-kvm installed, you can start the image by:" |
| 311 echo "sudo kvm -m ${FLAGS_mem} -vga std -pidfile /tmp/kvm.pid -net nic,model=v irtio " \ | 285 echo "sudo kvm -m ${FLAGS_mem} -vga std -pidfile /tmp/kvm.pid -net nic,model=e 1000 " \ |
|
sosa
2011/02/09 02:58:52
This got accidentally reverted
| |
| 312 "-net user,hostfwd=tcp::9222-:22 \\" | 286 "-net user,hostfwd=tcp::9222-:22 \\" |
| 313 echo " -hda ${FLAGS_to}/${DEFAULT_QEMU_IMAGE}" | 287 echo " -hda ${FLAGS_to}/${DEFAULT_QEMU_IMAGE}" |
| 314 fi | 288 fi |
| OLD | NEW |