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 # This script modifies a base image to act as a recovery installer. | 7 # This script modifies a base image to act as a recovery installer. |
8 # If no kernel image is supplied, it will build a devkeys signed recovery | 8 # If no kernel image is supplied, it will build a devkeys signed recovery |
9 # kernel. Alternatively, a signed recovery kernel can be used to | 9 # kernel. Alternatively, a signed recovery kernel can be used to |
10 # create a Chromium OS recovery image. | 10 # create a Chromium OS recovery image. |
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
178 local root_size=$(partsize "$FLAGS_image" 3) | 178 local root_size=$(partsize "$FLAGS_image" 3) |
179 | 179 |
180 sudo losetup \ | 180 sudo losetup \ |
181 -o $((root_offset * 512)) \ | 181 -o $((root_offset * 512)) \ |
182 --sizelimit $((root_size * 512)) \ | 182 --sizelimit $((root_size * 512)) \ |
183 "$root_dev" \ | 183 "$root_dev" \ |
184 "$FLAGS_image" | 184 "$FLAGS_image" |
185 | 185 |
186 trap "sudo losetup -d $root_dev" EXIT | 186 trap "sudo losetup -d $root_dev" EXIT |
187 | 187 |
188 cros_root=/dev/sd%D%P | 188 cros_root=/dev/sd%D%P # only used for non-verified images |
189 if [[ "${ARCH}" = "arm" ]]; then | 189 if [[ "${ARCH}" = "arm" ]]; then |
190 cros_root='/dev/${devname}${rootpart}' | 190 cros_root='/dev/${devname}${rootpart}' |
191 fi | 191 fi |
192 if grep -q enable_rootfs_verification "${IMAGE_DIR}/boot.desc"; then | 192 if grep -q enable_rootfs_verification "${IMAGE_DIR}/boot.desc"; then |
193 cros_root=/dev/dm-0 | 193 cros_root=/dev/dm-0 |
194 fi | 194 fi |
195 # TODO(wad) LOAD FROM IMAGE KERNEL AND NOT BOOT.DESC | 195 # TODO(wad) LOAD FROM IMAGE KERNEL AND NOT BOOT.DESC |
196 local verity_args=$(grep -- '--verity_' "${IMAGE_DIR}/boot.desc") | 196 local verity_args=$(grep -- '--verity_' "${IMAGE_DIR}/boot.desc") |
197 # Convert the args to the right names and clean up extra quoting. | 197 # Convert the args to the right names and clean up extra quoting. |
198 # TODO(wad) just update these everywhere | 198 # TODO(wad) just update these everywhere |
(...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
438 | 438 |
439 trap cleanup EXIT | 439 trap cleanup EXIT |
440 | 440 |
441 maybe_resize_stateful # Also copies the image if needed. | 441 maybe_resize_stateful # Also copies the image if needed. |
442 | 442 |
443 install_recovery_kernel | 443 install_recovery_kernel |
444 | 444 |
445 echo "Recovery image created at $RECOVERY_IMAGE" | 445 echo "Recovery image created at $RECOVERY_IMAGE" |
446 print_time_elapsed | 446 print_time_elapsed |
447 trap - EXIT | 447 trap - EXIT |
OLD | NEW |