OLD | NEW |
1 /* Copyright (c) 2010 The Chromium OS Authors. All rights reserved. | 1 /* Copyright (c) 2010 The Chromium OS Authors. All rights reserved. |
2 * Use of this source code is governed by a BSD-style license that can be | 2 * Use of this source code is governed by a BSD-style license that can be |
3 * found in the LICENSE file. | 3 * found in the LICENSE file. |
4 * | 4 * |
5 * Functions for loading a kernel from disk. | 5 * Functions for loading a kernel from disk. |
6 * (Firmware portion) | 6 * (Firmware portion) |
7 */ | 7 */ |
8 | 8 |
9 #include "vboot_kernel.h" | 9 #include "vboot_kernel.h" |
10 | 10 |
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
139 | 139 |
140 /* Initialization */ | 140 /* Initialization */ |
141 kernel_subkey = (VbPublicKey*)params->header_sign_key_blob; | 141 kernel_subkey = (VbPublicKey*)params->header_sign_key_blob; |
142 blba = params->bytes_per_lba; | 142 blba = params->bytes_per_lba; |
143 kbuf_sectors = KBUF_SIZE / blba; | 143 kbuf_sectors = KBUF_SIZE / blba; |
144 if (0 == kbuf_sectors) { | 144 if (0 == kbuf_sectors) { |
145 VBDEBUG(("LoadKernel() called with sector size > KBUF_SIZE\n")); | 145 VBDEBUG(("LoadKernel() called with sector size > KBUF_SIZE\n")); |
146 return LOAD_KERNEL_INVALID; | 146 return LOAD_KERNEL_INVALID; |
147 } | 147 } |
148 | 148 |
149 is_dev = (BOOT_FLAG_DEVELOPER & params->boot_flags ? 1 : 0); | |
150 is_rec = (BOOT_FLAG_RECOVERY & params->boot_flags ? 1 : 0); | 149 is_rec = (BOOT_FLAG_RECOVERY & params->boot_flags ? 1 : 0); |
| 150 if (is_rec || (BOOT_FLAG_DEV_FIRMWARE & params->boot_flags)) { |
| 151 /* Recovery or developer firmware, so accurately represent the |
| 152 * state of the developer switch for the purposes of verified boot. */ |
| 153 is_dev = (BOOT_FLAG_DEVELOPER & params->boot_flags ? 1 : 0); |
| 154 } else { |
| 155 /* Normal firmware always does a fully verified boot regardless of |
| 156 * the state of the developer switch. */ |
| 157 is_dev = 0; |
| 158 } |
151 is_normal = (!is_dev && !is_rec); | 159 is_normal = (!is_dev && !is_rec); |
152 | 160 |
153 /* Clear output params in case we fail */ | 161 /* Clear output params in case we fail */ |
154 params->partition_number = 0; | 162 params->partition_number = 0; |
155 params->bootloader_address = 0; | 163 params->bootloader_address = 0; |
156 params->bootloader_size = 0; | 164 params->bootloader_size = 0; |
157 | 165 |
158 /* Let the TPM know if we're in recovery mode */ | 166 /* Let the TPM know if we're in recovery mode */ |
159 if (is_rec) { | 167 if (is_rec) { |
160 if (0 != RollbackKernelRecovery(is_dev)) { | 168 if (0 != RollbackKernelRecovery(is_dev)) { |
(...skipping 278 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
439 return LOAD_KERNEL_SUCCESS; | 447 return LOAD_KERNEL_SUCCESS; |
440 } | 448 } |
441 | 449 |
442 /* The BIOS may attempt to display different screens depending on whether | 450 /* The BIOS may attempt to display different screens depending on whether |
443 * we find an invalid kernel partition (return LOAD_KERNEL_INVALID) or not. | 451 * we find an invalid kernel partition (return LOAD_KERNEL_INVALID) or not. |
444 * But the flow is changing, so for now treating both cases as invalid gives | 452 * But the flow is changing, so for now treating both cases as invalid gives |
445 * slightly less confusing user feedback. Sigh. | 453 * slightly less confusing user feedback. Sigh. |
446 */ | 454 */ |
447 return LOAD_KERNEL_INVALID; | 455 return LOAD_KERNEL_INVALID; |
448 } | 456 } |
OLD | NEW |