| 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 # Helper script that generates the signed kernel image | 7 # Helper script that generates the signed kernel image |
| 8 | 8 |
| 9 . "$(dirname "$0")/common.sh" | 9 . "$(dirname "$0")/common.sh" |
| 10 | 10 |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 71 error "Root file system blocks are not 4k!" | 71 error "Root file system blocks are not 4k!" |
| 72 fi | 72 fi |
| 73 | 73 |
| 74 info "Generating root fs hash tree." | 74 info "Generating root fs hash tree." |
| 75 # Runs as sudo in case the image is a block device. | 75 # Runs as sudo in case the image is a block device. |
| 76 table=$(sudo verity create ${FLAGS_vboot_tree_depth} \ | 76 table=$(sudo verity create ${FLAGS_vboot_tree_depth} \ |
| 77 ${FLAGS_vboot_hash_alg} \ | 77 ${FLAGS_vboot_hash_alg} \ |
| 78 ${FLAGS_rootfs_image} \ | 78 ${FLAGS_rootfs_image} \ |
| 79 ${root_fs_blocks} \ | 79 ${root_fs_blocks} \ |
| 80 ${FLAGS_rootfs_hash}) | 80 ${FLAGS_rootfs_hash}) |
| 81 if [[ -f "${FLAGS_rootfs_hash}" ]]; then |
| 82 sudo chmod a+r "${FLAGS_rootfs_hash}" |
| 83 fi |
| 81 # Don't claim the root device unless the root= flag is pointed to | 84 # Don't claim the root device unless the root= flag is pointed to |
| 82 # the verified boot device. Doing so will claim /dev/sdDP out from | 85 # the verified boot device. Doing so will claim /dev/sdDP out from |
| 83 # under the system. | 86 # under the system. |
| 84 if [[ ${FLAGS_root} = "/dev/dm-0" ]]; then | 87 if [[ ${FLAGS_root} = "/dev/dm-0" ]]; then |
| 85 table=${table//HASH_DEV/\/dev\/sd%D%P} | 88 table=${table//HASH_DEV/\/dev\/sd%D%P} |
| 86 table=${table//ROOT_DEV/\/dev\/sd%D%P} | 89 table=${table//ROOT_DEV/\/dev\/sd%D%P} |
| 87 fi | 90 fi |
| 88 vboot_args="dm=\"${table}\"" | 91 vboot_args="dm=\"${table}\"" |
| 89 info "dm-verity configuration: ${vboot_args}" | 92 info "dm-verity configuration: ${vboot_args}" |
| 90 fi | 93 fi |
| (...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 208 info "Cleaning up temporary files: ${WORK}" | 211 info "Cleaning up temporary files: ${WORK}" |
| 209 rm ${WORK} | 212 rm ${WORK} |
| 210 rmdir ${FLAGS_working_dir} | 213 rmdir ${FLAGS_working_dir} |
| 211 fi | 214 fi |
| 212 | 215 |
| 213 info "Kernel partition image emitted: ${FLAGS_to}" | 216 info "Kernel partition image emitted: ${FLAGS_to}" |
| 214 | 217 |
| 215 if [[ -f ${FLAGS_rootfs_hash} ]]; then | 218 if [[ -f ${FLAGS_rootfs_hash} ]]; then |
| 216 info "Root filesystem hash emitted: ${FLAGS_rootfs_hash}" | 219 info "Root filesystem hash emitted: ${FLAGS_rootfs_hash}" |
| 217 fi | 220 fi |
| OLD | NEW |