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 304 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
315 | 315 |
316 /* Done with the kernel signing key, so can free it now */ | 316 /* Done with the kernel signing key, so can free it now */ |
317 RSAPublicKeyFree(data_key); | 317 RSAPublicKeyFree(data_key); |
318 | 318 |
319 /* If we're still here, the kernel is valid. */ | 319 /* If we're still here, the kernel is valid. */ |
320 /* Save the first good partition we find; that's the one we'll boot */ | 320 /* Save the first good partition we find; that's the one we'll boot */ |
321 debug("Partiton is good.\n"); | 321 debug("Partiton is good.\n"); |
322 /* TODO: GPT partitions start at 1, but cgptlib starts them at 0. | 322 /* TODO: GPT partitions start at 1, but cgptlib starts them at 0. |
323 * Adjust here, until cgptlib is fixed. */ | 323 * Adjust here, until cgptlib is fixed. */ |
324 good_partition = gpt.current_kernel + 1; | 324 good_partition = gpt.current_kernel + 1; |
325 params->partition_number = gpt.current_kernel; | 325 params->partition_number = gpt.current_kernel + 1; |
326 params->bootloader_address = preamble->bootloader_address; | 326 params->bootloader_address = preamble->bootloader_address; |
327 params->bootloader_size = preamble->bootloader_size; | 327 params->bootloader_size = preamble->bootloader_size; |
328 /* If we're in developer or recovery mode, there's no rollback | 328 /* If we're in developer or recovery mode, there's no rollback |
329 * protection, so we can stop at the first valid kernel. */ | 329 * protection, so we can stop at the first valid kernel. */ |
330 if (!is_normal) { | 330 if (!is_normal) { |
331 debug("Boot_flags = !is_normal\n"); | 331 debug("Boot_flags = !is_normal\n"); |
332 break; | 332 break; |
333 } | 333 } |
334 | 334 |
335 /* Otherwise, we're in normal boot mode, so we do care about the | 335 /* Otherwise, we're in normal boot mode, so we do care about the |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
392 /* Success! */ | 392 /* Success! */ |
393 return LOAD_KERNEL_SUCCESS; | 393 return LOAD_KERNEL_SUCCESS; |
394 } | 394 } |
395 | 395 |
396 // Handle error cases | 396 // Handle error cases |
397 if (found_partitions) | 397 if (found_partitions) |
398 return LOAD_KERNEL_INVALID; | 398 return LOAD_KERNEL_INVALID; |
399 else | 399 else |
400 return LOAD_KERNEL_NOT_FOUND; | 400 return LOAD_KERNEL_NOT_FOUND; |
401 } | 401 } |
OLD | NEW |