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

Side by Side Diff: utility/vbutil_kernel.c

Issue 3520019: Allow --repack option to change kernel version number. (Closed) Base URL: http://git.chromium.org/git/vboot_reference.git
Patch Set: Fixed indentation warnings. Created 10 years, 2 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | 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 * Verified boot kernel utility 5 * Verified boot kernel utility
6 */ 6 */
7 7
8 #include <errno.h> 8 #include <errno.h>
9 #include <getopt.h> 9 #include <getopt.h>
10 #include <inttypes.h> /* For PRIu64 */ 10 #include <inttypes.h> /* For PRIu64 */
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
84 " --config <file> Command line file\n" 84 " --config <file> Command line file\n"
85 "\n" 85 "\n"
86 " Optional:\n" 86 " Optional:\n"
87 " --pad <number> Verification padding size in bytes\n" 87 " --pad <number> Verification padding size in bytes\n"
88 " --vblockonly Emit just the verification blob\n", 88 " --vblockonly Emit just the verification blob\n",
89 progname); 89 progname);
90 fprintf(stderr, 90 fprintf(stderr,
91 "\nOR\n\n" 91 "\nOR\n\n"
92 "Usage: %s --repack <file> [PARAMETERS]\n" 92 "Usage: %s --repack <file> [PARAMETERS]\n"
93 "\n" 93 "\n"
94 " Required parameters (of --keyblock and --config at least " 94 " Required parameters (of --keyblock, --config, and --version \n"
95 "one is required):\n" 95 " at least one is required):\n"
96 " --keyblock <file> Key block in .keyblock format\n" 96 " --keyblock <file> Key block in .keyblock format\n"
97 " --signprivate <file>" 97 " --signprivate <file>"
98 " Private key to sign kernel data, in .vbprivk format\n" 98 " Private key to sign kernel data, in .vbprivk format\n"
99 " --oldblob <file> Previously packed kernel blob\n" 99 " --oldblob <file> Previously packed kernel blob\n"
100 " --config <file> New command line file\n" 100 " --config <file> New command line file\n"
101 " --version <number> Kernel version\n"
101 "\n" 102 "\n"
102 " Optional:\n" 103 " Optional:\n"
103 " --pad <number> Verification padding size in bytes\n" 104 " --pad <number> Verification padding size in bytes\n"
104 " --vblockonly Emit just the verification blob\n", 105 " --vblockonly Emit just the verification blob\n",
105 progname); 106 progname);
106 fprintf(stderr, 107 fprintf(stderr,
107 "\nOR\n\n" 108 "\nOR\n\n"
108 "Usage: %s --verify <file> [PARAMETERS]\n" 109 "Usage: %s --verify <file> [PARAMETERS]\n"
109 "\n" 110 "\n"
110 " Optional:\n" 111 " Optional:\n"
(...skipping 728 matching lines...) Expand 10 before | Expand all | Expand 10 after
839 switch(mode) { 840 switch(mode) {
840 case OPT_MODE_PACK: 841 case OPT_MODE_PACK:
841 bp = NewBlob(version, vmlinuz, bootloader, config_file); 842 bp = NewBlob(version, vmlinuz, bootloader, config_file);
842 if (!bp) 843 if (!bp)
843 return 1; 844 return 1;
844 r = Pack(filename, key_block_file, signprivate, bp, pad, vblockonly); 845 r = Pack(filename, key_block_file, signprivate, bp, pad, vblockonly);
845 FreeBlob(bp); 846 FreeBlob(bp);
846 return r; 847 return r;
847 848
848 case OPT_MODE_REPACK: 849 case OPT_MODE_REPACK:
849 if (!config_file && !key_block_file) { 850 if (!config_file && !key_block_file && !version) {
850 fprintf(stderr, 851 fprintf(stderr,
851 "You must supply at least one of --config and --keyblock\n"); 852 "You must supply at least one of "
853 "--config, --keyblock or --version\n");
852 return 1; 854 return 1;
853 } 855 }
854 856
855 bp = OldBlob(oldfile); 857 bp = OldBlob(oldfile);
856 if (!bp) 858 if (!bp)
857 return 1; 859 return 1;
858 r = ReplaceConfig(bp, config_file); 860 r = ReplaceConfig(bp, config_file);
859 if (!r) { 861 if (!r) {
862 if (version) {
863 bp->kernel_version = version;
864 }
860 r = Pack(filename, key_block_file, signprivate, bp, pad, vblockonly); 865 r = Pack(filename, key_block_file, signprivate, bp, pad, vblockonly);
861 } 866 }
862 FreeBlob(bp); 867 FreeBlob(bp);
863 return r; 868 return r;
864 869
865 case OPT_MODE_VERIFY: 870 case OPT_MODE_VERIFY:
866 return Verify(filename, signpubkey, verbose); 871 return Verify(filename, signpubkey, verbose);
867 872
868 default: 873 default:
869 fprintf(stderr, 874 fprintf(stderr,
870 "You must specify a mode: --pack, --repack or --verify\n"); 875 "You must specify a mode: --pack, --repack or --verify\n");
871 return PrintHelp(progname); 876 return PrintHelp(progname);
872 } 877 }
873 } 878 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698