Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(189)

Side by Side Diff: utility/load_kernel_test.c

Issue 2866006: Move old vkernel code out of vboot_firmware. (Closed) Base URL: ssh://gitrw.chromium.org/vboot_reference.git
Patch Set: Created 10 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « utility/Makefile ('k') | utility/load_kernel_test_old.c » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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 }
OLDNEW
« no previous file with comments | « utility/Makefile ('k') | utility/load_kernel_test_old.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698