OLD | NEW |
---|---|
1 /* Copyright (c) 2011 The Chromium OS Authors. All rights reserved. | 1 /* Copyright (c) 2011 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 579 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
590 /* Write and free GPT data */ | 590 /* Write and free GPT data */ |
591 WriteAndFreeGptData(&gpt); | 591 WriteAndFreeGptData(&gpt); |
592 | 592 |
593 /* Handle finding a good partition */ | 593 /* Handle finding a good partition */ |
594 if (good_partition >= 0) { | 594 if (good_partition >= 0) { |
595 VBDEBUG(("Good_partition >= 0\n")); | 595 VBDEBUG(("Good_partition >= 0\n")); |
596 if (shcall) | 596 if (shcall) |
597 shcall->check_result = VBSD_LKC_CHECK_GOOD_PARTITION; | 597 shcall->check_result = VBSD_LKC_CHECK_GOOD_PARTITION; |
598 | 598 |
599 /* See if we need to update the TPM */ | 599 /* See if we need to update the TPM */ |
600 if (kBootRecovery != boot_mode && good_partition_key_block_valid) { | 600 if ((kBootRecovery != boot_mode) && |
Sumit
2011/04/17 17:11:12
Do we need to set TPM in developer firmware? I agr
| |
601 /* We only update the TPM in normal and developer boot modes. In | 601 good_partition_key_block_valid && |
602 * developer mode, we only advanced lowest_version for kernels with valid | 602 !((1 == shared->firmware_index) && (shared->flags & VBSD_FWB_TRIED))) { |
603 * key blocks, and didn't count self-signed key blocks. In recovery | 603 /* We only update the TPM in normal and developer boot modes. |
604 * mode, the TPM stays PP-unlocked, so anything we write gets blown away | 604 * In developer mode, we only advanced lowest_version for |
605 * by the firmware when we go back to normal mode. */ | 605 * kernels with valid key blocks, and didn't count self-signed |
606 VBDEBUG(("Boot_flags = not recovery\n")); | 606 * key blocks. Recovery kernels aren't numbered, so we don't |
607 * update the TPM in recovery mode. We don't advance the TPM if | |
608 * we're trying a new firmware B, because that firmware may have a | |
609 * key change and roll forward the TPM too soon. */ | |
610 VBDEBUG(("Checking if TPM kernel version needs advancing\n")); | |
607 | 611 |
608 if ((lowest_version > tpm_version) && | 612 if ((lowest_version > tpm_version) && |
609 (lowest_version != LOWEST_TPM_VERSION)) { | 613 (lowest_version != LOWEST_TPM_VERSION)) { |
610 status = RollbackKernelWrite((uint32_t)lowest_version); | 614 status = RollbackKernelWrite((uint32_t)lowest_version); |
611 if (0 != status) { | 615 if (0 != status) { |
612 VBDEBUG(("Error writing kernel versions to TPM.\n")); | 616 VBDEBUG(("Error writing kernel versions to TPM.\n")); |
613 if (status == TPM_E_MUST_REBOOT) | 617 if (status == TPM_E_MUST_REBOOT) |
614 retval = LOAD_KERNEL_REBOOT; | 618 retval = LOAD_KERNEL_REBOOT; |
615 else | 619 else |
616 recovery = VBNV_RECOVERY_RW_TPM_ERROR; | 620 recovery = VBNV_RECOVERY_RW_TPM_ERROR; |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
666 | 670 |
667 /* Save timer values */ | 671 /* Save timer values */ |
668 shared->timer_load_kernel_enter = timer_enter; | 672 shared->timer_load_kernel_enter = timer_enter; |
669 shared->timer_load_kernel_exit = VbGetTimer(); | 673 shared->timer_load_kernel_exit = VbGetTimer(); |
670 /* Store how much shared data we used, if any */ | 674 /* Store how much shared data we used, if any */ |
671 params->shared_data_size = shared->data_used; | 675 params->shared_data_size = shared->data_used; |
672 } | 676 } |
673 | 677 |
674 return retval; | 678 return retval; |
675 } | 679 } |
OLD | NEW |