| 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 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 201 fi | 201 fi |
| 202 if grep -q enable_rootfs_verification "${IMAGE_DIR}/boot.desc"; then | 202 if grep -q enable_rootfs_verification "${IMAGE_DIR}/boot.desc"; then |
| 203 cros_root=/dev/dm-0 | 203 cros_root=/dev/dm-0 |
| 204 fi | 204 fi |
| 205 # TODO(wad) LOAD FROM IMAGE KERNEL AND NOT BOOT.DESC | 205 # TODO(wad) LOAD FROM IMAGE KERNEL AND NOT BOOT.DESC |
| 206 local verity_args=$(grep -- '--verity_' "${IMAGE_DIR}/boot.desc") | 206 local verity_args=$(grep -- '--verity_' "${IMAGE_DIR}/boot.desc") |
| 207 # Convert the args to the right names and clean up extra quoting. | 207 # Convert the args to the right names and clean up extra quoting. |
| 208 # TODO(wad) just update these everywhere | 208 # TODO(wad) just update these everywhere |
| 209 verity_args=$(echo $verity_args | sed \ | 209 verity_args=$(echo $verity_args | sed \ |
| 210 -e 's/verity_algorithm/verity_hash_alg/g' \ | 210 -e 's/verity_algorithm/verity_hash_alg/g' \ |
| 211 -e 's/verity_depth/verity_tree_depth/g' \ | |
| 212 -e 's/"//g') | 211 -e 's/"//g') |
| 213 | 212 |
| 214 # Tie the installed recovery kernel to the final kernel. If we don't | 213 # Tie the installed recovery kernel to the final kernel. If we don't |
| 215 # do this, a normal recovery image could be used to drop an unsigned | 214 # do this, a normal recovery image could be used to drop an unsigned |
| 216 # kernel on without a key-change check. | 215 # kernel on without a key-change check. |
| 217 # Doing this here means that the kernel and initramfs creation can | 216 # Doing this here means that the kernel and initramfs creation can |
| 218 # be done independently from the image to be modified as long as the | 217 # be done independently from the image to be modified as long as the |
| 219 # chromeos-recovery interfaces are the same. It allows for the signer | 218 # chromeos-recovery interfaces are the same. It allows for the signer |
| 220 # to just compute the new hash and update the kernel command line during | 219 # to just compute the new hash and update the kernel command line during |
| 221 # recovery image generation. (Alternately, it means an image can be created, | 220 # recovery image generation. (Alternately, it means an image can be created, |
| (...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 449 | 448 |
| 450 trap cleanup EXIT | 449 trap cleanup EXIT |
| 451 | 450 |
| 452 maybe_resize_stateful # Also copies the image if needed. | 451 maybe_resize_stateful # Also copies the image if needed. |
| 453 | 452 |
| 454 install_recovery_kernel | 453 install_recovery_kernel |
| 455 | 454 |
| 456 echo "Recovery image created at $RECOVERY_IMAGE" | 455 echo "Recovery image created at $RECOVERY_IMAGE" |
| 457 print_time_elapsed | 456 print_time_elapsed |
| 458 trap - EXIT | 457 trap - EXIT |
| OLD | NEW |