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 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
160 if (0 == kbuf_sectors) { | 160 if (0 == kbuf_sectors) { |
161 VBDEBUG(("LoadKernel() called with sector size > KBUF_SIZE\n")); | 161 VBDEBUG(("LoadKernel() called with sector size > KBUF_SIZE\n")); |
162 goto LoadKernelExit; | 162 goto LoadKernelExit; |
163 } | 163 } |
164 | 164 |
165 rec_switch = (BOOT_FLAG_RECOVERY & params->boot_flags ? 1 : 0); | 165 rec_switch = (BOOT_FLAG_RECOVERY & params->boot_flags ? 1 : 0); |
166 dev_switch = (BOOT_FLAG_DEVELOPER & params->boot_flags ? 1 : 0); | 166 dev_switch = (BOOT_FLAG_DEVELOPER & params->boot_flags ? 1 : 0); |
167 | 167 |
168 if (rec_switch) | 168 if (rec_switch) |
169 boot_mode = kBootRecovery; | 169 boot_mode = kBootRecovery; |
170 else if (BOOT_FLAG_DEV_FIRMWARE & params->boot_flags) | 170 else if (BOOT_FLAG_DEV_FIRMWARE & params->boot_flags) { |
171 if (!dev_switch) { | 171 if (!dev_switch) { |
172 /* Dev firmware should be signed such that it never boots with the dev | 172 /* Dev firmware should be signed such that it never boots with the dev |
173 * switch is off; so something is terribly wrong. */ | 173 * switch is off; so something is terribly wrong. */ |
174 VBDEBUG(("LoadKernel() called with dev firmware but dev switch off\n")); | 174 VBDEBUG(("LoadKernel() called with dev firmware but dev switch off\n")); |
175 recovery = VBNV_RECOVERY_RW_DEV_MISMATCH; | 175 recovery = VBNV_RECOVERY_RW_DEV_MISMATCH; |
176 goto LoadKernelExit; | 176 goto LoadKernelExit; |
177 } | 177 } |
178 boot_mode = kBootDev; | 178 boot_mode = kBootDev; |
179 else { | 179 } else { |
180 /* Normal firmware */ | 180 /* Normal firmware */ |
181 boot_mode = kBootNormal; | 181 boot_mode = kBootNormal; |
182 dev_switch = 0; /* Always do a fully verified boot */ | 182 dev_switch = 0; /* Always do a fully verified boot */ |
183 } | 183 } |
184 | 184 |
185 /* Clear output params in case we fail */ | 185 /* Clear output params in case we fail */ |
186 params->partition_number = 0; | 186 params->partition_number = 0; |
187 params->bootloader_address = 0; | 187 params->bootloader_address = 0; |
188 params->bootloader_size = 0; | 188 params->bootloader_size = 0; |
189 | 189 |
(...skipping 310 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
500 /* Save whether the good partition's key block was fully verified */ | 500 /* Save whether the good partition's key block was fully verified */ |
501 VbNvSet(vnc, VBNV_FW_VERIFIED_KERNEL_KEY, good_partition_key_block_valid); | 501 VbNvSet(vnc, VBNV_FW_VERIFIED_KERNEL_KEY, good_partition_key_block_valid); |
502 | 502 |
503 /* Store recovery request, if any, then tear down non-volatile storage */ | 503 /* Store recovery request, if any, then tear down non-volatile storage */ |
504 VbNvSet(vnc, VBNV_RECOVERY_REQUEST, LOAD_KERNEL_RECOVERY == retval ? | 504 VbNvSet(vnc, VBNV_RECOVERY_REQUEST, LOAD_KERNEL_RECOVERY == retval ? |
505 recovery : VBNV_RECOVERY_NOT_REQUESTED); | 505 recovery : VBNV_RECOVERY_NOT_REQUESTED); |
506 VbNvTeardown(vnc); | 506 VbNvTeardown(vnc); |
507 | 507 |
508 return retval; | 508 return retval; |
509 } | 509 } |
OLD | NEW |