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 # Load common constants. This should be the first executable line. | 10 # Load common constants. This should be the first executable line. |
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
160 die "No free loop device. Free up a loop device or reboot. Exiting." | 160 die "No free loop device. Free up a loop device or reboot. Exiting." |
161 fi | 161 fi |
162 | 162 |
163 # Extend the original file size to the new size. | 163 # Extend the original file size to the new size. |
164 dd if=/dev/zero of="${TEMP_STATE}" bs=1 count=1 \ | 164 dd if=/dev/zero of="${TEMP_STATE}" bs=1 count=1 \ |
165 seek=$((STATEFUL_SIZE_BYTES - 1)) | 165 seek=$((STATEFUL_SIZE_BYTES - 1)) |
166 # Resize the partition. | 166 # Resize the partition. |
167 sudo losetup "${STATEFUL_LOOP_DEV}" "${TEMP_STATE}" | 167 sudo losetup "${STATEFUL_LOOP_DEV}" "${TEMP_STATE}" |
168 sudo e2fsck -pf "${STATEFUL_LOOP_DEV}" | 168 sudo e2fsck -pf "${STATEFUL_LOOP_DEV}" |
169 sudo resize2fs "${STATEFUL_LOOP_DEV}" | 169 sudo resize2fs "${STATEFUL_LOOP_DEV}" |
| 170 sync |
170 sudo losetup -d "${STATEFUL_LOOP_DEV}" | 171 sudo losetup -d "${STATEFUL_LOOP_DEV}" |
171 fi | 172 fi |
172 fi | 173 fi |
173 TEMP_PMBR="${TEMP_DIR}"/pmbr | 174 TEMP_PMBR="${TEMP_DIR}"/pmbr |
174 dd if="${SRC_IMAGE}" of="${TEMP_PMBR}" bs=512 count=1 | 175 dd if="${SRC_IMAGE}" of="${TEMP_PMBR}" bs=512 count=1 |
175 | 176 |
176 TEMP_MNT=$(mktemp -d) | 177 TEMP_MNT=$(mktemp -d) |
177 TEMP_ESP_MNT=$(mktemp -d) | 178 TEMP_ESP_MNT=$(mktemp -d) |
178 cleanup() { | 179 cleanup() { |
179 sudo umount -d "${TEMP_MNT}" | 180 sudo umount -d "${TEMP_MNT}" |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
280 echo "${VMX_CONFIG}" | 281 echo "${VMX_CONFIG}" |
281 fi | 282 fi |
282 | 283 |
283 | 284 |
284 if [ "${FLAGS_format}" == "qemu" ]; then | 285 if [ "${FLAGS_format}" == "qemu" ]; then |
285 echo "If you have qemu-kvm installed, you can start the image by:" | 286 echo "If you have qemu-kvm installed, you can start the image by:" |
286 echo "sudo kvm -m ${FLAGS_mem} -vga std -pidfile /tmp/kvm.pid -net nic,model=e
1000 " \ | 287 echo "sudo kvm -m ${FLAGS_mem} -vga std -pidfile /tmp/kvm.pid -net nic,model=e
1000 " \ |
287 "-net user,hostfwd=tcp::922-:22 \\" | 288 "-net user,hostfwd=tcp::922-:22 \\" |
288 echo " -hda ${FLAGS_to}/${DEFAULT_QEMU_IMAGE}" | 289 echo " -hda ${FLAGS_to}/${DEFAULT_QEMU_IMAGE}" |
289 fi | 290 fi |
OLD | NEW |