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 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
222 trap - INT TERM EXIT | 222 trap - INT TERM EXIT |
223 cleanup | 223 cleanup |
224 | 224 |
225 # Make 3 GiB output image | 225 # Make 3 GiB output image |
226 TEMP_IMG=$(mktemp) | 226 TEMP_IMG=$(mktemp) |
227 # TOOD(adlr): pick a size that will for sure accomodate the partitions | 227 # TOOD(adlr): pick a size that will for sure accomodate the partitions |
228 sudo dd if=/dev/zero of="${TEMP_IMG}" bs=1 count=1 \ | 228 sudo dd if=/dev/zero of="${TEMP_IMG}" bs=1 count=1 \ |
229 seek=$((${FLAGS_vdisk_size} * 1024 * 1024 - 1)) | 229 seek=$((${FLAGS_vdisk_size} * 1024 * 1024 - 1)) |
230 | 230 |
231 # Set up the partition table | 231 # Set up the partition table |
232 install_gpt "${TEMP_IMG}" "${TEMP_ROOTFS}" "${TEMP_STATE}" \ | 232 install_gpt "${TEMP_IMG}" "$(numsectors $TEMP_ROOTFS)" \ |
233 "${TEMP_PMBR}" "${TEMP_ESP}" false ${FLAGS_rootfs_partition_size} | 233 "$(numsectors $TEMP_STATE)" "${TEMP_PMBR}" "$(numsectors $TEMP_ESP)" \ |
| 234 false ${FLAGS_rootfs_partition_size} |
234 # Copy into the partition parts of the file | 235 # Copy into the partition parts of the file |
235 dd if="${TEMP_ROOTFS}" of="${TEMP_IMG}" conv=notrunc bs=512 \ | 236 dd if="${TEMP_ROOTFS}" of="${TEMP_IMG}" conv=notrunc bs=512 \ |
236 seek="${START_ROOTFS_A}" | 237 seek="${START_ROOTFS_A}" |
237 dd if="${TEMP_STATE}" of="${TEMP_IMG}" conv=notrunc bs=512 \ | 238 dd if="${TEMP_STATE}" of="${TEMP_IMG}" conv=notrunc bs=512 \ |
238 seek="${START_STATEFUL}" | 239 seek="${START_STATEFUL}" |
239 dd if="${TEMP_KERN}" of="${TEMP_IMG}" conv=notrunc bs=512 \ | 240 dd if="${TEMP_KERN}" of="${TEMP_IMG}" conv=notrunc bs=512 \ |
240 seek="${START_KERN_A}" | 241 seek="${START_KERN_A}" |
241 dd if="${TEMP_ESP}" of="${TEMP_IMG}" conv=notrunc bs=512 \ | 242 dd if="${TEMP_ESP}" of="${TEMP_IMG}" conv=notrunc bs=512 \ |
242 seek="${START_ESP}" | 243 seek="${START_ESP}" |
243 | 244 |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
280 guestOS = \"otherlinux\" | 281 guestOS = \"otherlinux\" |
281 ethernet0.addressType = \"generated\" | 282 ethernet0.addressType = \"generated\" |
282 floppy0.present = \"FALSE\"" | 283 floppy0.present = \"FALSE\"" |
283 | 284 |
284 if [[ "${FLAGS_make_vmx}" = "${FLAGS_TRUE}" ]]; then | 285 if [[ "${FLAGS_make_vmx}" = "${FLAGS_TRUE}" ]]; then |
285 echo "${VMX_CONFIG}" > "${FLAGS_to}/${FLAGS_vmx}" | 286 echo "${VMX_CONFIG}" > "${FLAGS_to}/${FLAGS_vmx}" |
286 echo "Wrote the following config to: ${FLAGS_to}/${FLAGS_vmx}" | 287 echo "Wrote the following config to: ${FLAGS_to}/${FLAGS_vmx}" |
287 echo "${VMX_CONFIG}" | 288 echo "${VMX_CONFIG}" |
288 fi | 289 fi |
289 | 290 |
OLD | NEW |