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 307 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
318 goto bad_kernel; | 318 goto bad_kernel; |
319 } | 319 } |
320 | 320 |
321 /* Verify kernel body fits in the partition */ | 321 /* Verify kernel body fits in the partition */ |
322 if (body_offset_sectors + body_sectors > part_size) { | 322 if (body_offset_sectors + body_sectors > part_size) { |
323 VBDEBUG(("Kernel body doesn't fit in partition.\n")); | 323 VBDEBUG(("Kernel body doesn't fit in partition.\n")); |
324 goto bad_kernel; | 324 goto bad_kernel; |
325 } | 325 } |
326 | 326 |
327 /* Read the kernel data */ | 327 /* Read the kernel data */ |
| 328 VBPERFSTART("VB_RKD"); |
328 if (0 != BootDeviceReadLBA(part_start + body_offset_sectors, | 329 if (0 != BootDeviceReadLBA(part_start + body_offset_sectors, |
329 body_sectors, | 330 body_sectors, |
330 params->kernel_buffer)) { | 331 params->kernel_buffer)) { |
331 VBDEBUG(("Unable to read kernel data.\n")); | 332 VBDEBUG(("Unable to read kernel data.\n")); |
| 333 VBPERFEND("VB_RKD"); |
332 goto bad_kernel; | 334 goto bad_kernel; |
333 } | 335 } |
| 336 VBPERFEND("VB_RKD"); |
334 | 337 |
335 /* Verify kernel data */ | 338 /* Verify kernel data */ |
336 if (0 != VerifyData((const uint8_t*)params->kernel_buffer, | 339 if (0 != VerifyData((const uint8_t*)params->kernel_buffer, |
337 params->kernel_buffer_size, | 340 params->kernel_buffer_size, |
338 &preamble->body_signature, data_key)) { | 341 &preamble->body_signature, data_key)) { |
339 VBDEBUG(("Kernel data verification failed.\n")); | 342 VBDEBUG(("Kernel data verification failed.\n")); |
340 goto bad_kernel; | 343 goto bad_kernel; |
341 } | 344 } |
342 | 345 |
343 /* Done with the kernel signing key, so can free it now */ | 346 /* Done with the kernel signing key, so can free it now */ |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
436 return LOAD_KERNEL_SUCCESS; | 439 return LOAD_KERNEL_SUCCESS; |
437 } | 440 } |
438 | 441 |
439 /* The BIOS may attempt to display different screens depending on whether | 442 /* The BIOS may attempt to display different screens depending on whether |
440 * we find an invalid kernel partition (return LOAD_KERNEL_INVALID) or not. | 443 * we find an invalid kernel partition (return LOAD_KERNEL_INVALID) or not. |
441 * But the flow is changing, so for now treating both cases as invalid gives | 444 * But the flow is changing, so for now treating both cases as invalid gives |
442 * slightly less confusing user feedback. Sigh. | 445 * slightly less confusing user feedback. Sigh. |
443 */ | 446 */ |
444 return LOAD_KERNEL_INVALID; | 447 return LOAD_KERNEL_INVALID; |
445 } | 448 } |
OLD | NEW |