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 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
71 DEFINE_string to "" \ | 71 DEFINE_string to "" \ |
72 "Destination folder for VM output file(s)" | 72 "Destination folder for VM output file(s)" |
73 DEFINE_string vbox_disk "${DEFAULT_VBOX_DISK}" \ | 73 DEFINE_string vbox_disk "${DEFAULT_VBOX_DISK}" \ |
74 "Filename for the output disk (virtualbox only)." | 74 "Filename for the output disk (virtualbox only)." |
75 DEFINE_integer vdisk_size 3072 \ | 75 DEFINE_integer vdisk_size 3072 \ |
76 "virtual disk size in MBs." | 76 "virtual disk size in MBs." |
77 DEFINE_string vmdk "${DEFAULT_VMDK}" \ | 77 DEFINE_string vmdk "${DEFAULT_VMDK}" \ |
78 "Filename for the vmware disk image (vmware only)." | 78 "Filename for the vmware disk image (vmware only)." |
79 DEFINE_string vmx "${DEFAULT_VMX}" \ | 79 DEFINE_string vmx "${DEFAULT_VMX}" \ |
80 "Filename for the vmware config (vmware only)." | 80 "Filename for the vmware config (vmware only)." |
81 | 81 |
Daniel Kurtz
2011/03/25 23:24:11
DEFINE_boolean enable_tablet ${FLAGS_FALSE} \
"
| |
82 # Parse command line | 82 # Parse command line |
83 FLAGS "$@" || exit 1 | 83 FLAGS "$@" || exit 1 |
84 eval set -- "${FLAGS_ARGV}" | 84 eval set -- "${FLAGS_ARGV}" |
85 | 85 |
86 # Die on any errors. | 86 # Die on any errors. |
87 set -e | 87 set -e |
88 | 88 |
89 if [ -z "${FLAGS_board}" ] ; then | 89 if [ -z "${FLAGS_board}" ] ; then |
90 die "--board is required." | 90 die "--board is required." |
91 fi | 91 fi |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
182 sudo umount -d "${TEMP_ESP_MNT}" | 182 sudo umount -d "${TEMP_ESP_MNT}" |
183 rmdir "${TEMP_MNT}" "${TEMP_ESP_MNT}" | 183 rmdir "${TEMP_MNT}" "${TEMP_ESP_MNT}" |
184 } | 184 } |
185 trap cleanup INT TERM EXIT | 185 trap cleanup INT TERM EXIT |
186 mkdir -p "${TEMP_MNT}" | 186 mkdir -p "${TEMP_MNT}" |
187 enable_rw_mount "${TEMP_ROOTFS}" | 187 enable_rw_mount "${TEMP_ROOTFS}" |
188 sudo mount -o loop "${TEMP_ROOTFS}" "${TEMP_MNT}" | 188 sudo mount -o loop "${TEMP_ROOTFS}" "${TEMP_MNT}" |
189 mkdir -p "${TEMP_ESP_MNT}" | 189 mkdir -p "${TEMP_ESP_MNT}" |
190 sudo mount -o loop "${TEMP_ESP}" "${TEMP_ESP_MNT}" | 190 sudo mount -o loop "${TEMP_ESP}" "${TEMP_ESP_MNT}" |
191 | 191 |
192 if [ "${FLAGS_format}" = "qemu" ]; then | 192 sudo python "${SCRIPTS_DIR}/fixup_image_for_qemu.py" \ |
193 sudo python "${SCRIPTS_DIR}/fixup_image_for_qemu.py" \ | 193 --mounted_dir="${TEMP_MNT}" \ |
194 --mounted_dir="${TEMP_MNT}" \ | 194 --enable_tablet=false |
Daniel Kurtz
2011/03/25 23:24:11
--enable_tablet="${enable_tablet}"
| |
195 --enable_tablet=true | |
196 else | |
197 sudo python "${SCRIPTS_DIR}/fixup_image_for_qemu.py" \ | |
198 --mounted_dir="${TEMP_MNT}" \ | |
199 --enable_tablet=false | |
200 fi | |
201 | 195 |
202 # Modify the unverified usb template which uses a default usb_disk of sdb3 | 196 # Modify the unverified usb template which uses a default usb_disk of sdb3 |
203 sudo sed -i -e 's/sdb3/sda3/g' "${TEMP_MNT}/boot/syslinux/usb.A.cfg" | 197 sudo sed -i -e 's/sdb3/sda3/g' "${TEMP_MNT}/boot/syslinux/usb.A.cfg" |
204 | 198 |
205 # Unmount everything prior to building a final image | 199 # Unmount everything prior to building a final image |
206 sync | 200 sync |
207 trap - INT TERM EXIT | 201 trap - INT TERM EXIT |
208 cleanup | 202 cleanup |
209 | 203 |
210 # TOOD(adlr): pick a size that will for sure accomodate the partitions. | 204 # TOOD(adlr): pick a size that will for sure accomodate the partitions. |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
282 echo "${VMX_CONFIG}" | 276 echo "${VMX_CONFIG}" |
283 fi | 277 fi |
284 | 278 |
285 | 279 |
286 if [ "${FLAGS_format}" == "qemu" ]; then | 280 if [ "${FLAGS_format}" == "qemu" ]; then |
287 echo "If you have qemu-kvm installed, you can start the image by:" | 281 echo "If you have qemu-kvm installed, you can start the image by:" |
288 echo "sudo kvm -m ${FLAGS_mem} -vga std -pidfile /tmp/kvm.pid -net nic,model=v irtio " \ | 282 echo "sudo kvm -m ${FLAGS_mem} -vga std -pidfile /tmp/kvm.pid -net nic,model=v irtio " \ |
289 "-net user,hostfwd=tcp::9222-:22 \\" | 283 "-net user,hostfwd=tcp::9222-:22 \\" |
290 echo " -hda ${FLAGS_to}/${DEFAULT_QEMU_IMAGE}" | 284 echo " -hda ${FLAGS_to}/${DEFAULT_QEMU_IMAGE}" |
291 fi | 285 fi |
OLD | NEW |