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 */ |
11 #include <stdio.h> | 11 #include <stdio.h> |
12 #include <stdlib.h> | 12 #include <stdlib.h> |
13 #include <string.h> | 13 #include <string.h> |
14 #include <sys/types.h> | 14 #include <sys/types.h> |
15 | 15 |
16 #include "load_kernel_fw.h" | 16 #include "load_kernel_fw.h" |
17 #include "boot_device.h" | 17 #include "boot_device.h" |
18 #include "host_common.h" | 18 #include "host_common.h" |
19 #include "rollback_index.h" | 19 #include "rollback_index.h" |
20 #include "utility.h" | 20 #include "utility.h" |
| 21 #include "vboot_kernel.h" |
21 | 22 |
22 /* ANSI Color coding sequences. */ | 23 /* ANSI Color coding sequences. */ |
23 #define COL_GREEN "\e[1;32m" | 24 #define COL_GREEN "\e[1;32m" |
24 #define COL_RED "\e[0;31m" | 25 #define COL_RED "\e[0;31m" |
25 #define COL_STOP "\e[m" | 26 #define COL_STOP "\e[m" |
26 | 27 |
27 | 28 |
28 #define LBA_BYTES 512 | 29 #define LBA_BYTES 512 |
29 #define KERNEL_BUFFER_SIZE 0x600000 | 30 #define KERNEL_BUFFER_SIZE 0x600000 |
30 | 31 |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
116 rewind(image_file); | 117 rewind(image_file); |
117 printf("Ending LBA: %" PRIu64 "\n", lkp.ending_lba); | 118 printf("Ending LBA: %" PRIu64 "\n", lkp.ending_lba); |
118 | 119 |
119 /* Allocate a buffer for the kernel */ | 120 /* Allocate a buffer for the kernel */ |
120 lkp.kernel_buffer = Malloc(KERNEL_BUFFER_SIZE); | 121 lkp.kernel_buffer = Malloc(KERNEL_BUFFER_SIZE); |
121 if(!lkp.kernel_buffer) { | 122 if(!lkp.kernel_buffer) { |
122 fprintf(stderr, "Unable to allocate kernel buffer.\n"); | 123 fprintf(stderr, "Unable to allocate kernel buffer.\n"); |
123 return 1; | 124 return 1; |
124 } | 125 } |
125 | 126 |
126 /* TODO: Option for boot mode */ | 127 /* TODO: Option for boot mode - developer, recovery */ |
127 lkp.boot_flags = 0; | 128 /* Need to skip the address check, since we're putting it somewhere on the |
| 129 * heap instead of its actual target address in the firmware. */ |
| 130 lkp.boot_flags = BOOT_FLAG_SKIP_ADDR_CHECK; |
128 | 131 |
129 /* Call LoadKernel() */ | 132 /* Call LoadKernel() */ |
130 rv = LoadKernel(&lkp); | 133 rv = LoadKernel(&lkp); |
131 printf("LoadKernel() returned %d\n", rv); | 134 printf("LoadKernel() returned %d\n", rv); |
132 | 135 |
133 if (LOAD_KERNEL_SUCCESS == rv) { | 136 if (LOAD_KERNEL_SUCCESS == rv) { |
134 printf("Partition number: %" PRIu64 "\n", lkp.partition_number); | 137 printf("Partition number: %" PRIu64 "\n", lkp.partition_number); |
135 printf("Bootloader address: %" PRIu64 "\n", lkp.bootloader_address); | 138 printf("Bootloader address: %" PRIu64 "\n", lkp.bootloader_address); |
136 printf("Bootloader size: %" PRIu64 "\n", lkp.bootloader_size); | 139 printf("Bootloader size: %" PRIu64 "\n", lkp.bootloader_size); |
137 } | 140 } |
138 | 141 |
139 fclose(image_file); | 142 fclose(image_file); |
140 Free(lkp.kernel_buffer); | 143 Free(lkp.kernel_buffer); |
141 return 0; | 144 return 0; |
142 } | 145 } |
OLD | NEW |