| 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 | 5 |
| 6 /* Routines for verifying a file's signature. Useful in testing the core | 6 /* Routines for verifying a file's signature. Useful in testing the core |
| 7 * RSA verification implementation. | 7 * RSA verification implementation. |
| 8 */ | 8 */ |
| 9 | 9 |
| 10 #include <inttypes.h> /* For PRIu64 macro */ | 10 #include <inttypes.h> /* For PRIu64 macro */ |
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 114 /* Allocate a buffer for the kernel */ | 114 /* Allocate a buffer for the kernel */ |
| 115 lkp.kernel_buffer = Malloc(KERNEL_BUFFER_SIZE); | 115 lkp.kernel_buffer = Malloc(KERNEL_BUFFER_SIZE); |
| 116 if(!lkp.kernel_buffer) { | 116 if(!lkp.kernel_buffer) { |
| 117 fprintf(stderr, "Unable to allocate kernel buffer.\n"); | 117 fprintf(stderr, "Unable to allocate kernel buffer.\n"); |
| 118 return 1; | 118 return 1; |
| 119 } | 119 } |
| 120 | 120 |
| 121 /* TODO: Option for boot mode - developer, recovery */ | 121 /* TODO: Option for boot mode - developer, recovery */ |
| 122 /* Need to skip the address check, since we're putting it somewhere on the | 122 /* Need to skip the address check, since we're putting it somewhere on the |
| 123 * heap instead of its actual target address in the firmware. */ | 123 * heap instead of its actual target address in the firmware. */ |
| 124 lkp.boot_flags = BOOT_FLAG_SKIP_ADDR_CHECK; | 124 lkp.boot_flags = BOOT_FLAG_SKIP_ADDR_CHECK | BOOT_FLAG_RECOVERY; |
| 125 | 125 |
| 126 /* Call LoadKernel() */ | 126 /* Call LoadKernel() */ |
| 127 rv = LoadKernel(&lkp); | 127 rv = LoadKernel(&lkp); |
| 128 printf("LoadKernel() returned %d\n", rv); | 128 printf("LoadKernel() returned %d\n", rv); |
| 129 | 129 |
| 130 if (LOAD_KERNEL_SUCCESS == rv) { | 130 if (LOAD_KERNEL_SUCCESS == rv) { |
| 131 printf("Partition number: %" PRIu64 "\n", lkp.partition_number); | 131 printf("Partition number: %" PRIu64 "\n", lkp.partition_number); |
| 132 printf("Bootloader address: %" PRIu64 "\n", lkp.bootloader_address); | 132 printf("Bootloader address: %" PRIu64 "\n", lkp.bootloader_address); |
| 133 printf("Bootloader size: %" PRIu64 "\n", lkp.bootloader_size); | 133 printf("Bootloader size: %" PRIu64 "\n", lkp.bootloader_size); |
| 134 } | 134 } |
| 135 | 135 |
| 136 fclose(image_file); | 136 fclose(image_file); |
| 137 Free(lkp.kernel_buffer); | 137 Free(lkp.kernel_buffer); |
| 138 return 0; | 138 return rv != LOAD_KERNEL_SUCCESS; |
| 139 } | 139 } |
| OLD | NEW |