| 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 create a Chrome OS dev recovery image using a dev install shim | 7 # Script to create a Chrome OS dev recovery image using a dev install shim |
| 8 | 8 |
| 9 # Source constants and utility functions | 9 # Source constants and utility functions |
| 10 . "$(dirname "$0")/common.sh" | 10 . "$(dirname "$0")/common.sh" |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 108 TEMP_IMG=$(mktemp) | 108 TEMP_IMG=$(mktemp) |
| 109 | 109 |
| 110 TEMP_KERN="${TEMP_DIR}"/part_2 | 110 TEMP_KERN="${TEMP_DIR}"/part_2 |
| 111 TEMP_ROOTFS="${TEMP_DIR}"/part_3 | 111 TEMP_ROOTFS="${TEMP_DIR}"/part_3 |
| 112 TEMP_OEM="${TEMP_DIR}"/part_8 | 112 TEMP_OEM="${TEMP_DIR}"/part_8 |
| 113 TEMP_ESP="${TEMP_DIR}"/part_12 | 113 TEMP_ESP="${TEMP_DIR}"/part_12 |
| 114 TEMP_PMBR="${TEMP_DIR}"/pmbr | 114 TEMP_PMBR="${TEMP_DIR}"/pmbr |
| 115 dd if="${FLAGS_dev_install_shim}" of="${TEMP_PMBR}" bs=512 count=1 | 115 dd if="${FLAGS_dev_install_shim}" of="${TEMP_PMBR}" bs=512 count=1 |
| 116 | 116 |
| 117 # Set up a new partition table | 117 # Set up a new partition table |
| 118 install_gpt "${TEMP_IMG}" "${TEMP_ROOTFS}" "${TEMP_STATE}" "${TEMP_PMBR}" \ | 118 install_gpt "${TEMP_IMG}" "$(numsectors $TEMP_ROOTFS)" \ |
| 119 "${TEMP_ESP}" false $(roundup $(numsectors ${TEMP_ROOTFS})) | 119 "$(numsectors $TEMP_STATE)" "${TEMP_PMBR}" "$(numsectors $TEMP_ESP)" \ |
| 120 false $(roundup $(numsectors ${TEMP_ROOTFS})) |
| 120 | 121 |
| 121 # Copy into the partition parts of the file | 122 # Copy into the partition parts of the file |
| 122 dd if="${TEMP_ROOTFS}" of="${TEMP_IMG}" conv=notrunc bs=512 \ | 123 dd if="${TEMP_ROOTFS}" of="${TEMP_IMG}" conv=notrunc bs=512 \ |
| 123 seek="${START_ROOTFS_A}" | 124 seek="${START_ROOTFS_A}" |
| 124 dd if="${TEMP_STATE}" of="${TEMP_IMG}" conv=notrunc bs=512 \ | 125 dd if="${TEMP_STATE}" of="${TEMP_IMG}" conv=notrunc bs=512 \ |
| 125 seek="${START_STATEFUL}" | 126 seek="${START_STATEFUL}" |
| 126 # Copy the full kernel (i.e. with vboot sections) | 127 # Copy the full kernel (i.e. with vboot sections) |
| 127 dd if="${TEMP_KERN}" of="${TEMP_IMG}" conv=notrunc bs=512 \ | 128 dd if="${TEMP_KERN}" of="${TEMP_IMG}" conv=notrunc bs=512 \ |
| 128 seek="${START_KERN_A}" | 129 seek="${START_KERN_A}" |
| 129 dd if="${TEMP_OEM}" of="${TEMP_IMG}" conv=notrunc bs=512 \ | 130 dd if="${TEMP_OEM}" of="${TEMP_IMG}" conv=notrunc bs=512 \ |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 163 trap - EXIT | 164 trap - EXIT |
| 164 } | 165 } |
| 165 | 166 |
| 166 # Main | 167 # Main |
| 167 DST_PATH="${INSTALL_SHIM_DIR}/${DEV_RECOVERY_IMAGE}" | 168 DST_PATH="${INSTALL_SHIM_DIR}/${DEV_RECOVERY_IMAGE}" |
| 168 info "Attempting to create dev recovery image using dev install shim \ | 169 info "Attempting to create dev recovery image using dev install shim \ |
| 169 ${FLAGS_dev_install_shim}" | 170 ${FLAGS_dev_install_shim}" |
| 170 create_dev_recovery_image | 171 create_dev_recovery_image |
| 171 mv -f $TEMP_IMG $DST_PATH | 172 mv -f $TEMP_IMG $DST_PATH |
| 172 info "Dev recovery image created at ${DST_PATH}" | 173 info "Dev recovery image created at ${DST_PATH}" |
| OLD | NEW |