Bill Richardson | f318ee2 | 2014-09-23 14:30:30 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2014 The Chromium OS Authors. All rights reserved. |
Randall Spangler | 7d6898d | 2010-06-11 09:22:13 -0700 | [diff] [blame] | 3 | * Use of this source code is governed by a BSD-style license that can be |
| 4 | * found in the LICENSE file. |
| 5 | * |
| 6 | * Verified boot kernel utility |
| 7 | */ |
| 8 | |
Bill Richardson | a08b5c9 | 2010-06-30 21:59:43 -0700 | [diff] [blame] | 9 | #include <errno.h> |
Vincent Palatin | 56c85db | 2012-09-05 15:35:12 -0700 | [diff] [blame] | 10 | #include <fcntl.h> |
Randall Spangler | 7d6898d | 2010-06-11 09:22:13 -0700 | [diff] [blame] | 11 | #include <getopt.h> |
Bill Richardson | 31d95c2 | 2014-08-24 22:07:17 -0700 | [diff] [blame] | 12 | #include <inttypes.h> /* For PRIu64 */ |
David Riley | 05987b1 | 2015-02-05 19:22:49 -0800 | [diff] [blame] | 13 | #ifndef HAVE_MACOS |
Bill Richardson | 31d95c2 | 2014-08-24 22:07:17 -0700 | [diff] [blame] | 14 | #include <linux/fs.h> /* For BLKGETSIZE64 */ |
David Riley | 05987b1 | 2015-02-05 19:22:49 -0800 | [diff] [blame] | 15 | #endif |
Bill Richardson | 249677d | 2010-06-23 11:16:37 -0700 | [diff] [blame] | 16 | #include <stdarg.h> |
Randall Spangler | 7d6898d | 2010-06-11 09:22:13 -0700 | [diff] [blame] | 17 | #include <stdio.h> |
Bill Richardson | a08b5c9 | 2010-06-30 21:59:43 -0700 | [diff] [blame] | 18 | #include <string.h> |
Bill Richardson | f318ee2 | 2014-09-23 14:30:30 -0700 | [diff] [blame] | 19 | #include <sys/ioctl.h> |
Bill Richardson | a08b5c9 | 2010-06-30 21:59:43 -0700 | [diff] [blame] | 20 | #include <sys/stat.h> |
Randall Spangler | 7d6898d | 2010-06-11 09:22:13 -0700 | [diff] [blame] | 21 | #include <unistd.h> |
| 22 | |
Bill Richardson | 2559338 | 2015-01-30 12:22:28 -0800 | [diff] [blame] | 23 | #include "file_type.h" |
Bill Richardson | 6f39615 | 2014-07-15 12:52:19 -0700 | [diff] [blame] | 24 | #include "futility.h" |
Randall Spangler | 7d6898d | 2010-06-11 09:22:13 -0700 | [diff] [blame] | 25 | #include "host_common.h" |
| 26 | #include "kernel_blob.h" |
Bill Richardson | 9bfe2c9 | 2015-01-27 12:21:04 -0800 | [diff] [blame] | 27 | #include "traversal.h" |
Bill Richardson | f318ee2 | 2014-09-23 14:30:30 -0700 | [diff] [blame] | 28 | #include "vb1_helper.h" |
| 29 | |
| 30 | static void Fatal(const char *format, ...) |
| 31 | { |
| 32 | va_list ap; |
| 33 | va_start(ap, format); |
| 34 | fprintf(stderr, "ERROR: "); |
| 35 | vfprintf(stderr, format, ap); |
| 36 | va_end(ap); |
| 37 | exit(1); |
| 38 | } |
Randall Spangler | 7d6898d | 2010-06-11 09:22:13 -0700 | [diff] [blame] | 39 | |
Bill Richardson | 72e344d | 2012-03-19 12:47:18 -0700 | [diff] [blame] | 40 | /* Global opts */ |
Bill Richardson | 779796f | 2014-09-23 11:47:40 -0700 | [diff] [blame] | 41 | static int opt_verbose; |
| 42 | static int opt_vblockonly; |
Bill Richardson | 72e344d | 2012-03-19 12:47:18 -0700 | [diff] [blame] | 43 | static uint64_t opt_pad = 65536; |
Bill Richardson | 249677d | 2010-06-23 11:16:37 -0700 | [diff] [blame] | 44 | |
Randall Spangler | 7d6898d | 2010-06-11 09:22:13 -0700 | [diff] [blame] | 45 | /* Command line options */ |
| 46 | enum { |
Bill Richardson | 31d95c2 | 2014-08-24 22:07:17 -0700 | [diff] [blame] | 47 | OPT_MODE_PACK = 1000, |
| 48 | OPT_MODE_REPACK, |
| 49 | OPT_MODE_VERIFY, |
Shelley Chen | f1f53b3 | 2015-01-08 09:13:44 -0800 | [diff] [blame] | 50 | OPT_MODE_GET_VMLINUZ, |
Bill Richardson | 31d95c2 | 2014-08-24 22:07:17 -0700 | [diff] [blame] | 51 | OPT_ARCH, |
| 52 | OPT_OLDBLOB, |
| 53 | OPT_KLOADADDR, |
| 54 | OPT_KEYBLOCK, |
| 55 | OPT_SIGNPUBKEY, |
| 56 | OPT_SIGNPRIVATE, |
| 57 | OPT_VERSION, |
| 58 | OPT_VMLINUZ, |
| 59 | OPT_BOOTLOADER, |
| 60 | OPT_CONFIG, |
| 61 | OPT_VBLOCKONLY, |
| 62 | OPT_PAD, |
| 63 | OPT_VERBOSE, |
| 64 | OPT_MINVERSION, |
Shelley Chen | f1f53b3 | 2015-01-08 09:13:44 -0800 | [diff] [blame] | 65 | OPT_VMLINUZ_OUT, |
Randall Spangler | 7d6898d | 2010-06-11 09:22:13 -0700 | [diff] [blame] | 66 | }; |
| 67 | |
Mike Frysinger | 7351ed7 | 2014-08-18 10:47:42 -0400 | [diff] [blame] | 68 | static const struct option long_opts[] = { |
Bill Richardson | 31d95c2 | 2014-08-24 22:07:17 -0700 | [diff] [blame] | 69 | {"pack", 1, 0, OPT_MODE_PACK}, |
| 70 | {"repack", 1, 0, OPT_MODE_REPACK}, |
| 71 | {"verify", 1, 0, OPT_MODE_VERIFY}, |
Shelley Chen | f1f53b3 | 2015-01-08 09:13:44 -0800 | [diff] [blame] | 72 | {"get-vmlinuz", 1, 0, OPT_MODE_GET_VMLINUZ}, |
Bill Richardson | 31d95c2 | 2014-08-24 22:07:17 -0700 | [diff] [blame] | 73 | {"arch", 1, 0, OPT_ARCH}, |
| 74 | {"oldblob", 1, 0, OPT_OLDBLOB}, |
| 75 | {"kloadaddr", 1, 0, OPT_KLOADADDR}, |
| 76 | {"keyblock", 1, 0, OPT_KEYBLOCK}, |
| 77 | {"signpubkey", 1, 0, OPT_SIGNPUBKEY}, |
| 78 | {"signprivate", 1, 0, OPT_SIGNPRIVATE}, |
| 79 | {"version", 1, 0, OPT_VERSION}, |
| 80 | {"minversion", 1, 0, OPT_MINVERSION}, |
| 81 | {"vmlinuz", 1, 0, OPT_VMLINUZ}, |
| 82 | {"bootloader", 1, 0, OPT_BOOTLOADER}, |
| 83 | {"config", 1, 0, OPT_CONFIG}, |
| 84 | {"vblockonly", 0, 0, OPT_VBLOCKONLY}, |
| 85 | {"pad", 1, 0, OPT_PAD}, |
| 86 | {"verbose", 0, &opt_verbose, 1}, |
Bill Richardson | e192e7f | 2014-09-23 12:49:26 -0700 | [diff] [blame] | 87 | {"debug", 0, &debugging_enabled, 1}, |
Shelley Chen | f1f53b3 | 2015-01-08 09:13:44 -0800 | [diff] [blame] | 88 | {"vmlinuz-out", 1, 0, OPT_VMLINUZ_OUT}, |
Bill Richardson | 31d95c2 | 2014-08-24 22:07:17 -0700 | [diff] [blame] | 89 | {NULL, 0, 0, 0} |
Randall Spangler | 7d6898d | 2010-06-11 09:22:13 -0700 | [diff] [blame] | 90 | }; |
| 91 | |
| 92 | |
Bill Richardson | 31d95c2 | 2014-08-24 22:07:17 -0700 | [diff] [blame] | 93 | |
| 94 | static const char usage[] = |
Bill Richardson | 31d95c2 | 2014-08-24 22:07:17 -0700 | [diff] [blame] | 95 | "\n" |
Bill Richardson | 779796f | 2014-09-23 11:47:40 -0700 | [diff] [blame] | 96 | "Usage: " MYNAME " %s --pack <file> [PARAMETERS]\n" |
Bill Richardson | 31d95c2 | 2014-08-24 22:07:17 -0700 | [diff] [blame] | 97 | "\n" |
| 98 | " Required parameters:\n" |
| 99 | " --keyblock <file> Key block in .keyblock format\n" |
| 100 | " --signprivate <file> Private key to sign kernel data,\n" |
| 101 | " in .vbprivk format\n" |
| 102 | " --version <number> Kernel version\n" |
| 103 | " --vmlinuz <file> Linux kernel bzImage file\n" |
| 104 | " --bootloader <file> Bootloader stub\n" |
| 105 | " --config <file> Command line file\n" |
| 106 | " --arch <arch> Cpu architecture (default x86)\n" |
| 107 | "\n" |
| 108 | " Optional:\n" |
| 109 | " --kloadaddr <address> Assign kernel body load address\n" |
| 110 | " --pad <number> Verification padding size in bytes\n" |
| 111 | " --vblockonly Emit just the verification blob\n" |
| 112 | "\nOR\n\n" |
Bill Richardson | 779796f | 2014-09-23 11:47:40 -0700 | [diff] [blame] | 113 | "Usage: " MYNAME " %s --repack <file> [PARAMETERS]\n" |
Bill Richardson | 31d95c2 | 2014-08-24 22:07:17 -0700 | [diff] [blame] | 114 | "\n" |
| 115 | " Required parameters:\n" |
| 116 | " --signprivate <file> Private key to sign kernel data,\n" |
| 117 | " in .vbprivk format\n" |
| 118 | " --oldblob <file> Previously packed kernel blob\n" |
| 119 | " (including verfication blob)\n" |
| 120 | "\n" |
| 121 | " Optional:\n" |
| 122 | " --keyblock <file> Key block in .keyblock format\n" |
| 123 | " --config <file> New command line file\n" |
| 124 | " --version <number> Kernel version\n" |
| 125 | " --kloadaddr <address> Assign kernel body load address\n" |
| 126 | " --pad <number> Verification blob size in bytes\n" |
| 127 | " --vblockonly Emit just the verification blob\n" |
| 128 | "\nOR\n\n" |
Bill Richardson | 779796f | 2014-09-23 11:47:40 -0700 | [diff] [blame] | 129 | "Usage: " MYNAME " %s --verify <file> [PARAMETERS]\n" |
Bill Richardson | 31d95c2 | 2014-08-24 22:07:17 -0700 | [diff] [blame] | 130 | "\n" |
| 131 | " Optional:\n" |
| 132 | " --signpubkey <file>" |
| 133 | " Public key to verify kernel keyblock,\n" |
| 134 | " in .vbpubk format\n" |
| 135 | " --verbose Print a more detailed report\n" |
| 136 | " --keyblock <file> Outputs the verified key block,\n" |
| 137 | " in .keyblock format\n" |
| 138 | " --pad <number> Verification padding size in bytes\n" |
| 139 | " --minversion <number> Minimum combined kernel key version\n" |
Shelley Chen | f1f53b3 | 2015-01-08 09:13:44 -0800 | [diff] [blame] | 140 | "\nOR\n\n" |
| 141 | "Usage: " MYNAME " %s --get-vmlinuz <file> [PARAMETERS]\n" |
| 142 | "\n" |
| 143 | " Required parameters:\n" |
| 144 | " --vmlinuz-out <file> vmlinuz image output file\n" |
Bill Richardson | 31d95c2 | 2014-08-24 22:07:17 -0700 | [diff] [blame] | 145 | "\n"; |
| 146 | |
| 147 | |
Randall Spangler | 7d6898d | 2010-06-11 09:22:13 -0700 | [diff] [blame] | 148 | /* Print help and return error */ |
Bill Richardson | 779796f | 2014-09-23 11:47:40 -0700 | [diff] [blame] | 149 | static void print_help(const char *progname) |
Bill Richardson | 31d95c2 | 2014-08-24 22:07:17 -0700 | [diff] [blame] | 150 | { |
Shelley Chen | f1f53b3 | 2015-01-08 09:13:44 -0800 | [diff] [blame] | 151 | printf(usage, progname, progname, progname, progname); |
Randall Spangler | 7d6898d | 2010-06-11 09:22:13 -0700 | [diff] [blame] | 152 | } |
| 153 | |
Bill Richardson | 72e344d | 2012-03-19 12:47:18 -0700 | [diff] [blame] | 154 | |
Bill Richardson | 2f6a71f | 2010-10-14 09:25:39 -0700 | [diff] [blame] | 155 | /* Return an explanation when fread() fails. */ |
Bill Richardson | 779796f | 2014-09-23 11:47:40 -0700 | [diff] [blame] | 156 | static const char *error_fread(FILE *fp) |
Bill Richardson | 31d95c2 | 2014-08-24 22:07:17 -0700 | [diff] [blame] | 157 | { |
| 158 | const char *retval = "beats me why"; |
| 159 | if (feof(fp)) |
| 160 | retval = "EOF"; |
| 161 | else if (ferror(fp)) |
| 162 | retval = strerror(errno); |
| 163 | clearerr(fp); |
| 164 | return retval; |
Bill Richardson | 2f6a71f | 2010-10-14 09:25:39 -0700 | [diff] [blame] | 165 | } |
Randall Spangler | 7d6898d | 2010-06-11 09:22:13 -0700 | [diff] [blame] | 166 | |
Randall Spangler | 7d6898d | 2010-06-11 09:22:13 -0700 | [diff] [blame] | 167 | |
Bill Richardson | f318ee2 | 2014-09-23 14:30:30 -0700 | [diff] [blame] | 168 | /* This reads a complete kernel partition into a buffer */ |
| 169 | static uint8_t *ReadOldKPartFromFileOrDie(const char *filename, |
Bill Richardson | 779796f | 2014-09-23 11:47:40 -0700 | [diff] [blame] | 170 | uint64_t *size_ptr) |
Bill Richardson | 31d95c2 | 2014-08-24 22:07:17 -0700 | [diff] [blame] | 171 | { |
| 172 | FILE *fp = NULL; |
| 173 | struct stat statbuf; |
Bill Richardson | 31d95c2 | 2014-08-24 22:07:17 -0700 | [diff] [blame] | 174 | uint8_t *buf; |
Bill Richardson | 31d95c2 | 2014-08-24 22:07:17 -0700 | [diff] [blame] | 175 | uint64_t file_size = 0; |
Bill Richardson | a08b5c9 | 2010-06-30 21:59:43 -0700 | [diff] [blame] | 176 | |
Bill Richardson | 31d95c2 | 2014-08-24 22:07:17 -0700 | [diff] [blame] | 177 | if (0 != stat(filename, &statbuf)) |
| 178 | Fatal("Unable to stat %s: %s\n", filename, strerror(errno)); |
Bill Richardson | a08b5c9 | 2010-06-30 21:59:43 -0700 | [diff] [blame] | 179 | |
Bill Richardson | 31d95c2 | 2014-08-24 22:07:17 -0700 | [diff] [blame] | 180 | if (S_ISBLK(statbuf.st_mode)) { |
David Riley | 05987b1 | 2015-02-05 19:22:49 -0800 | [diff] [blame] | 181 | #ifndef HAVE_MACOS |
Bill Richardson | 779796f | 2014-09-23 11:47:40 -0700 | [diff] [blame] | 182 | int fd = open(filename, O_RDONLY); |
| 183 | if (fd >= 0) { |
Bill Richardson | 31d95c2 | 2014-08-24 22:07:17 -0700 | [diff] [blame] | 184 | ioctl(fd, BLKGETSIZE64, &file_size); |
| 185 | close(fd); |
| 186 | } |
David Riley | 05987b1 | 2015-02-05 19:22:49 -0800 | [diff] [blame] | 187 | #endif |
Bill Richardson | 31d95c2 | 2014-08-24 22:07:17 -0700 | [diff] [blame] | 188 | } else { |
| 189 | file_size = statbuf.st_size; |
| 190 | } |
| 191 | Debug("%s size is 0x%" PRIx64 "\n", filename, file_size); |
| 192 | if (file_size < opt_pad) |
| 193 | Fatal("%s is too small to be a valid kernel blob\n"); |
Bill Richardson | a08b5c9 | 2010-06-30 21:59:43 -0700 | [diff] [blame] | 194 | |
Bill Richardson | 31d95c2 | 2014-08-24 22:07:17 -0700 | [diff] [blame] | 195 | Debug("Reading %s\n", filename); |
| 196 | fp = fopen(filename, "rb"); |
| 197 | if (!fp) |
| 198 | Fatal("Unable to open file %s: %s\n", filename, |
| 199 | strerror(errno)); |
Bill Richardson | a08b5c9 | 2010-06-30 21:59:43 -0700 | [diff] [blame] | 200 | |
Bill Richardson | f318ee2 | 2014-09-23 14:30:30 -0700 | [diff] [blame] | 201 | buf = malloc(file_size); |
| 202 | if (1 != fread(buf, file_size, 1, fp)) |
| 203 | Fatal("Unable to read entirety of %s: %s\n", filename, |
Bill Richardson | 31d95c2 | 2014-08-24 22:07:17 -0700 | [diff] [blame] | 204 | error_fread(fp)); |
vbendeb | b2b0fcc | 2010-07-15 15:09:47 -0700 | [diff] [blame] | 205 | |
Bill Richardson | 31d95c2 | 2014-08-24 22:07:17 -0700 | [diff] [blame] | 206 | if (size_ptr) |
Bill Richardson | f318ee2 | 2014-09-23 14:30:30 -0700 | [diff] [blame] | 207 | *size_ptr = file_size; |
Bill Richardson | 72e344d | 2012-03-19 12:47:18 -0700 | [diff] [blame] | 208 | |
Bill Richardson | f318ee2 | 2014-09-23 14:30:30 -0700 | [diff] [blame] | 209 | return buf; |
Randall Spangler | 7d6898d | 2010-06-11 09:22:13 -0700 | [diff] [blame] | 210 | } |
| 211 | |
Bill Richardson | 72e344d | 2012-03-19 12:47:18 -0700 | [diff] [blame] | 212 | /****************************************************************************/ |
Randall Spangler | 7d6898d | 2010-06-11 09:22:13 -0700 | [diff] [blame] | 213 | |
Bill Richardson | 4dad690 | 2014-12-03 16:13:33 -0800 | [diff] [blame] | 214 | static int do_vbutil_kernel(int argc, char *argv[]) |
Bill Richardson | 31d95c2 | 2014-08-24 22:07:17 -0700 | [diff] [blame] | 215 | { |
| 216 | char *filename = NULL; |
| 217 | char *oldfile = NULL; |
| 218 | char *keyblock_file = NULL; |
| 219 | char *signpubkey_file = NULL; |
| 220 | char *signprivkey_file = NULL; |
| 221 | char *version_str = NULL; |
| 222 | int version = -1; |
| 223 | char *vmlinuz_file = NULL; |
| 224 | char *bootloader_file = NULL; |
| 225 | char *config_file = NULL; |
Shelley Chen | f1f53b3 | 2015-01-08 09:13:44 -0800 | [diff] [blame] | 226 | char *vmlinuz_out_file = NULL; |
Bill Richardson | e192e7f | 2014-09-23 12:49:26 -0700 | [diff] [blame] | 227 | enum arch_t arch = ARCH_X86; |
Bill Richardson | 31d95c2 | 2014-08-24 22:07:17 -0700 | [diff] [blame] | 228 | uint64_t kernel_body_load_address = CROS_32BIT_ENTRY_ADDR; |
| 229 | int mode = 0; |
| 230 | int parse_error = 0; |
| 231 | uint64_t min_version = 0; |
| 232 | char *e; |
Shelley Chen | f1f53b3 | 2015-01-08 09:13:44 -0800 | [diff] [blame] | 233 | int i = 0; |
Shelley Chen | 1bdc612 | 2015-02-02 10:06:10 -0800 | [diff] [blame] | 234 | int errcount = 0; |
Bill Richardson | f318ee2 | 2014-09-23 14:30:30 -0700 | [diff] [blame] | 235 | int rv; |
| 236 | VbKeyBlockHeader *keyblock = NULL; |
| 237 | VbKeyBlockHeader *t_keyblock = NULL; |
Bill Richardson | 31d95c2 | 2014-08-24 22:07:17 -0700 | [diff] [blame] | 238 | VbPrivateKey *signpriv_key = NULL; |
| 239 | VbPublicKey *signpub_key = NULL; |
Bill Richardson | f318ee2 | 2014-09-23 14:30:30 -0700 | [diff] [blame] | 240 | uint8_t *kpart_data = NULL; |
| 241 | uint64_t kpart_size = 0; |
| 242 | uint8_t *vmlinuz_buf = NULL; |
| 243 | uint64_t vmlinuz_size = 0; |
| 244 | uint8_t *t_config_data; |
| 245 | uint64_t t_config_size; |
| 246 | uint8_t *t_bootloader_data; |
| 247 | uint64_t t_bootloader_size; |
Shelley Chen | f1f53b3 | 2015-01-08 09:13:44 -0800 | [diff] [blame] | 248 | uint64_t vmlinuz_header_size = 0; |
| 249 | uint64_t vmlinuz_header_address = 0; |
Shelley Chen | 1bdc612 | 2015-02-02 10:06:10 -0800 | [diff] [blame] | 250 | uint64_t vmlinuz_header_offset = 0; |
Bill Richardson | f318ee2 | 2014-09-23 14:30:30 -0700 | [diff] [blame] | 251 | VbKernelPreambleHeader *preamble = NULL; |
| 252 | uint8_t *kblob_data = NULL; |
| 253 | uint64_t kblob_size = 0; |
| 254 | uint8_t *vblock_data = NULL; |
| 255 | uint64_t vblock_size = 0; |
Shelley Chen | f1f53b3 | 2015-01-08 09:13:44 -0800 | [diff] [blame] | 256 | FILE *f; |
Bill Richardson | 72e344d | 2012-03-19 12:47:18 -0700 | [diff] [blame] | 257 | |
Bill Richardson | 31d95c2 | 2014-08-24 22:07:17 -0700 | [diff] [blame] | 258 | while (((i = getopt_long(argc, argv, ":", long_opts, NULL)) != -1) && |
| 259 | !parse_error) { |
| 260 | switch (i) { |
| 261 | default: |
| 262 | case '?': |
| 263 | /* Unhandled option */ |
| 264 | parse_error = 1; |
| 265 | break; |
Bill Richardson | 72e344d | 2012-03-19 12:47:18 -0700 | [diff] [blame] | 266 | |
Bill Richardson | 31d95c2 | 2014-08-24 22:07:17 -0700 | [diff] [blame] | 267 | case 0: |
| 268 | /* silently handled option */ |
| 269 | break; |
Bill Richardson | 72e344d | 2012-03-19 12:47:18 -0700 | [diff] [blame] | 270 | |
Bill Richardson | 31d95c2 | 2014-08-24 22:07:17 -0700 | [diff] [blame] | 271 | case OPT_MODE_PACK: |
| 272 | case OPT_MODE_REPACK: |
| 273 | case OPT_MODE_VERIFY: |
Shelley Chen | f1f53b3 | 2015-01-08 09:13:44 -0800 | [diff] [blame] | 274 | case OPT_MODE_GET_VMLINUZ: |
Bill Richardson | 31d95c2 | 2014-08-24 22:07:17 -0700 | [diff] [blame] | 275 | if (mode && (mode != i)) { |
| 276 | fprintf(stderr, |
| 277 | "Only one mode can be specified\n"); |
| 278 | parse_error = 1; |
| 279 | break; |
| 280 | } |
| 281 | mode = i; |
| 282 | filename = optarg; |
| 283 | break; |
Bill Richardson | 72e344d | 2012-03-19 12:47:18 -0700 | [diff] [blame] | 284 | |
Bill Richardson | 31d95c2 | 2014-08-24 22:07:17 -0700 | [diff] [blame] | 285 | case OPT_ARCH: |
| 286 | /* check the first 3 characters to also detect x86_64 */ |
| 287 | if ((!strncasecmp(optarg, "x86", 3)) || |
| 288 | (!strcasecmp(optarg, "amd64"))) |
| 289 | arch = ARCH_X86; |
| 290 | else if ((!strcasecmp(optarg, "arm")) || |
| 291 | (!strcasecmp(optarg, "aarch64"))) |
| 292 | arch = ARCH_ARM; |
| 293 | else if (!strcasecmp(optarg, "mips")) |
| 294 | arch = ARCH_MIPS; |
| 295 | else { |
| 296 | fprintf(stderr, |
| 297 | "Unknown architecture string: %s\n", |
| 298 | optarg); |
| 299 | parse_error = 1; |
| 300 | } |
| 301 | break; |
Bill Richardson | 72e344d | 2012-03-19 12:47:18 -0700 | [diff] [blame] | 302 | |
Bill Richardson | 31d95c2 | 2014-08-24 22:07:17 -0700 | [diff] [blame] | 303 | case OPT_OLDBLOB: |
| 304 | oldfile = optarg; |
| 305 | break; |
Bill Richardson | 72e344d | 2012-03-19 12:47:18 -0700 | [diff] [blame] | 306 | |
Bill Richardson | 31d95c2 | 2014-08-24 22:07:17 -0700 | [diff] [blame] | 307 | case OPT_KLOADADDR: |
Bill Richardson | 31d95c2 | 2014-08-24 22:07:17 -0700 | [diff] [blame] | 308 | kernel_body_load_address = strtoul(optarg, &e, 0); |
| 309 | if (!*optarg || (e && *e)) { |
| 310 | fprintf(stderr, "Invalid --kloadaddr\n"); |
| 311 | parse_error = 1; |
| 312 | } |
| 313 | break; |
Bill Richardson | 72e344d | 2012-03-19 12:47:18 -0700 | [diff] [blame] | 314 | |
Bill Richardson | 31d95c2 | 2014-08-24 22:07:17 -0700 | [diff] [blame] | 315 | case OPT_KEYBLOCK: |
| 316 | keyblock_file = optarg; |
| 317 | break; |
Bill Richardson | 72e344d | 2012-03-19 12:47:18 -0700 | [diff] [blame] | 318 | |
Bill Richardson | 31d95c2 | 2014-08-24 22:07:17 -0700 | [diff] [blame] | 319 | case OPT_SIGNPUBKEY: |
| 320 | signpubkey_file = optarg; |
| 321 | break; |
Bill Richardson | 72e344d | 2012-03-19 12:47:18 -0700 | [diff] [blame] | 322 | |
Bill Richardson | 31d95c2 | 2014-08-24 22:07:17 -0700 | [diff] [blame] | 323 | case OPT_SIGNPRIVATE: |
| 324 | signprivkey_file = optarg; |
| 325 | break; |
Bill Richardson | 72e344d | 2012-03-19 12:47:18 -0700 | [diff] [blame] | 326 | |
Bill Richardson | 31d95c2 | 2014-08-24 22:07:17 -0700 | [diff] [blame] | 327 | case OPT_VMLINUZ: |
| 328 | vmlinuz_file = optarg; |
| 329 | break; |
Bill Richardson | 72e344d | 2012-03-19 12:47:18 -0700 | [diff] [blame] | 330 | |
Bill Richardson | 31d95c2 | 2014-08-24 22:07:17 -0700 | [diff] [blame] | 331 | case OPT_BOOTLOADER: |
| 332 | bootloader_file = optarg; |
| 333 | break; |
Bill Richardson | 72e344d | 2012-03-19 12:47:18 -0700 | [diff] [blame] | 334 | |
Bill Richardson | 31d95c2 | 2014-08-24 22:07:17 -0700 | [diff] [blame] | 335 | case OPT_CONFIG: |
| 336 | config_file = optarg; |
| 337 | break; |
Bill Richardson | 72e344d | 2012-03-19 12:47:18 -0700 | [diff] [blame] | 338 | |
Bill Richardson | 31d95c2 | 2014-08-24 22:07:17 -0700 | [diff] [blame] | 339 | case OPT_VBLOCKONLY: |
| 340 | opt_vblockonly = 1; |
| 341 | break; |
Bill Richardson | 72e344d | 2012-03-19 12:47:18 -0700 | [diff] [blame] | 342 | |
Bill Richardson | 31d95c2 | 2014-08-24 22:07:17 -0700 | [diff] [blame] | 343 | case OPT_VERSION: |
| 344 | version_str = optarg; |
| 345 | version = strtoul(optarg, &e, 0); |
| 346 | if (!*optarg || (e && *e)) { |
| 347 | fprintf(stderr, "Invalid --version\n"); |
| 348 | parse_error = 1; |
| 349 | } |
| 350 | break; |
Bill Richardson | 72e344d | 2012-03-19 12:47:18 -0700 | [diff] [blame] | 351 | |
Bill Richardson | 31d95c2 | 2014-08-24 22:07:17 -0700 | [diff] [blame] | 352 | case OPT_MINVERSION: |
| 353 | min_version = strtoul(optarg, &e, 0); |
| 354 | if (!*optarg || (e && *e)) { |
| 355 | fprintf(stderr, "Invalid --minversion\n"); |
| 356 | parse_error = 1; |
| 357 | } |
| 358 | break; |
Bill Richardson | 72e344d | 2012-03-19 12:47:18 -0700 | [diff] [blame] | 359 | |
Bill Richardson | 31d95c2 | 2014-08-24 22:07:17 -0700 | [diff] [blame] | 360 | case OPT_PAD: |
| 361 | opt_pad = strtoul(optarg, &e, 0); |
| 362 | if (!*optarg || (e && *e)) { |
| 363 | fprintf(stderr, "Invalid --pad\n"); |
| 364 | parse_error = 1; |
| 365 | } |
| 366 | break; |
Shelley Chen | f1f53b3 | 2015-01-08 09:13:44 -0800 | [diff] [blame] | 367 | case OPT_VMLINUZ_OUT: |
| 368 | vmlinuz_out_file = optarg; |
Bill Richardson | 31d95c2 | 2014-08-24 22:07:17 -0700 | [diff] [blame] | 369 | } |
| 370 | } |
Bill Richardson | 72e344d | 2012-03-19 12:47:18 -0700 | [diff] [blame] | 371 | |
Bill Richardson | 779796f | 2014-09-23 11:47:40 -0700 | [diff] [blame] | 372 | if (parse_error) { |
| 373 | print_help(argv[0]); |
| 374 | return 1; |
| 375 | } |
Bill Richardson | 72e344d | 2012-03-19 12:47:18 -0700 | [diff] [blame] | 376 | |
Bill Richardson | 31d95c2 | 2014-08-24 22:07:17 -0700 | [diff] [blame] | 377 | switch (mode) { |
| 378 | case OPT_MODE_PACK: |
Bill Richardson | 72e344d | 2012-03-19 12:47:18 -0700 | [diff] [blame] | 379 | |
Bill Richardson | 31d95c2 | 2014-08-24 22:07:17 -0700 | [diff] [blame] | 380 | if (!keyblock_file) |
| 381 | Fatal("Missing required keyblock file.\n"); |
Bill Richardson | 72e344d | 2012-03-19 12:47:18 -0700 | [diff] [blame] | 382 | |
Bill Richardson | f318ee2 | 2014-09-23 14:30:30 -0700 | [diff] [blame] | 383 | t_keyblock = (VbKeyBlockHeader *)ReadFile(keyblock_file, 0); |
| 384 | if (!t_keyblock) |
Bill Richardson | 31d95c2 | 2014-08-24 22:07:17 -0700 | [diff] [blame] | 385 | Fatal("Error reading key block.\n"); |
Bill Richardson | 72e344d | 2012-03-19 12:47:18 -0700 | [diff] [blame] | 386 | |
Bill Richardson | 31d95c2 | 2014-08-24 22:07:17 -0700 | [diff] [blame] | 387 | if (!signprivkey_file) |
| 388 | Fatal("Missing required signprivate file.\n"); |
Bill Richardson | 72e344d | 2012-03-19 12:47:18 -0700 | [diff] [blame] | 389 | |
Bill Richardson | 31d95c2 | 2014-08-24 22:07:17 -0700 | [diff] [blame] | 390 | signpriv_key = PrivateKeyRead(signprivkey_file); |
| 391 | if (!signpriv_key) |
| 392 | Fatal("Error reading signing key.\n"); |
Bill Richardson | 72e344d | 2012-03-19 12:47:18 -0700 | [diff] [blame] | 393 | |
Bill Richardson | f318ee2 | 2014-09-23 14:30:30 -0700 | [diff] [blame] | 394 | if (!config_file) |
| 395 | Fatal("Missing required config file.\n"); |
Bill Richardson | 72e344d | 2012-03-19 12:47:18 -0700 | [diff] [blame] | 396 | |
Bill Richardson | f318ee2 | 2014-09-23 14:30:30 -0700 | [diff] [blame] | 397 | Debug("Reading %s\n", config_file); |
| 398 | t_config_data = |
| 399 | ReadConfigFile(config_file, &t_config_size); |
| 400 | if (!t_config_data) |
| 401 | Fatal("Error reading config file.\n"); |
Bill Richardson | 72e344d | 2012-03-19 12:47:18 -0700 | [diff] [blame] | 402 | |
Bill Richardson | f318ee2 | 2014-09-23 14:30:30 -0700 | [diff] [blame] | 403 | if (!bootloader_file) |
| 404 | Fatal("Missing required bootloader file.\n"); |
Bill Richardson | 72e344d | 2012-03-19 12:47:18 -0700 | [diff] [blame] | 405 | |
Bill Richardson | f318ee2 | 2014-09-23 14:30:30 -0700 | [diff] [blame] | 406 | Debug("Reading %s\n", bootloader_file); |
| 407 | t_bootloader_data = ReadFile(bootloader_file, |
| 408 | &t_bootloader_size); |
| 409 | if (!t_bootloader_data) |
| 410 | Fatal("Error reading bootloader file.\n"); |
| 411 | Debug(" bootloader file size=0x%" PRIx64 "\n", |
| 412 | t_bootloader_size); |
Bill Richardson | 72e344d | 2012-03-19 12:47:18 -0700 | [diff] [blame] | 413 | |
Bill Richardson | f318ee2 | 2014-09-23 14:30:30 -0700 | [diff] [blame] | 414 | if (!vmlinuz_file) |
| 415 | Fatal("Missing required vmlinuz file.\n"); |
| 416 | Debug("Reading %s\n", vmlinuz_file); |
| 417 | vmlinuz_buf = ReadFile(vmlinuz_file, &vmlinuz_size); |
| 418 | if (!vmlinuz_buf) |
| 419 | Fatal("Error reading vmlinuz file.\n"); |
| 420 | Debug(" vmlinuz file size=0x%" PRIx64 "\n", |
| 421 | vmlinuz_size); |
| 422 | if (!vmlinuz_size) |
| 423 | Fatal("Empty vmlinuz file\n"); |
Bill Richardson | 31d95c2 | 2014-08-24 22:07:17 -0700 | [diff] [blame] | 424 | |
Bill Richardson | f318ee2 | 2014-09-23 14:30:30 -0700 | [diff] [blame] | 425 | kblob_data = CreateKernelBlob( |
| 426 | vmlinuz_buf, vmlinuz_size, |
| 427 | arch, kernel_body_load_address, |
| 428 | t_config_data, t_config_size, |
| 429 | t_bootloader_data, t_bootloader_size, |
| 430 | &kblob_size); |
| 431 | if (!kblob_data) |
| 432 | Fatal("Unable to create kernel blob\n"); |
Bill Richardson | 31d95c2 | 2014-08-24 22:07:17 -0700 | [diff] [blame] | 433 | |
Bill Richardson | f318ee2 | 2014-09-23 14:30:30 -0700 | [diff] [blame] | 434 | Debug("kblob_size = 0x%" PRIx64 "\n", kblob_size); |
| 435 | |
| 436 | vblock_data = SignKernelBlob(kblob_data, kblob_size, opt_pad, |
| 437 | version, kernel_body_load_address, |
| 438 | t_keyblock, signpriv_key, |
| 439 | &vblock_size); |
| 440 | if (!vblock_data) |
| 441 | Fatal("Unable to sign kernel blob\n"); |
| 442 | |
| 443 | Debug("vblock_size = 0x%" PRIx64 "\n", vblock_size); |
| 444 | |
| 445 | if (opt_vblockonly) |
| 446 | rv = WriteSomeParts(filename, |
| 447 | vblock_data, vblock_size, |
| 448 | NULL, 0); |
| 449 | else |
| 450 | rv = WriteSomeParts(filename, |
| 451 | vblock_data, vblock_size, |
| 452 | kblob_data, kblob_size); |
| 453 | return rv; |
Bill Richardson | 31d95c2 | 2014-08-24 22:07:17 -0700 | [diff] [blame] | 454 | |
| 455 | case OPT_MODE_REPACK: |
| 456 | |
| 457 | /* Required */ |
| 458 | |
| 459 | if (!signprivkey_file) |
| 460 | Fatal("Missing required signprivate file.\n"); |
| 461 | |
| 462 | signpriv_key = PrivateKeyRead(signprivkey_file); |
| 463 | if (!signpriv_key) |
| 464 | Fatal("Error reading signing key.\n"); |
| 465 | |
| 466 | if (!oldfile) |
| 467 | Fatal("Missing previously packed blob.\n"); |
| 468 | |
Bill Richardson | f318ee2 | 2014-09-23 14:30:30 -0700 | [diff] [blame] | 469 | /* Load the kernel partition */ |
| 470 | kpart_data = ReadOldKPartFromFileOrDie(oldfile, &kpart_size); |
Bill Richardson | 31d95c2 | 2014-08-24 22:07:17 -0700 | [diff] [blame] | 471 | |
Bill Richardson | 9bfe2c9 | 2015-01-27 12:21:04 -0800 | [diff] [blame] | 472 | /* Make sure we have a kernel partition */ |
| 473 | if (FILE_TYPE_KERN_PREAMBLE != |
Bill Richardson | 2559338 | 2015-01-30 12:22:28 -0800 | [diff] [blame] | 474 | futil_file_type_buf(kpart_data, kpart_size)) |
Bill Richardson | 9bfe2c9 | 2015-01-27 12:21:04 -0800 | [diff] [blame] | 475 | Fatal("%s is not a kernel blob\n", oldfile); |
| 476 | |
Bill Richardson | f318ee2 | 2014-09-23 14:30:30 -0700 | [diff] [blame] | 477 | kblob_data = UnpackKPart(kpart_data, kpart_size, opt_pad, |
| 478 | &keyblock, &preamble, &kblob_size); |
Bill Richardson | 31d95c2 | 2014-08-24 22:07:17 -0700 | [diff] [blame] | 479 | |
Bill Richardson | f318ee2 | 2014-09-23 14:30:30 -0700 | [diff] [blame] | 480 | if (!kblob_data) |
| 481 | Fatal("Unable to unpack kernel partition\n"); |
Bill Richardson | 31d95c2 | 2014-08-24 22:07:17 -0700 | [diff] [blame] | 482 | |
Bill Richardson | f318ee2 | 2014-09-23 14:30:30 -0700 | [diff] [blame] | 483 | kernel_body_load_address = preamble->body_load_address; |
Bill Richardson | 31d95c2 | 2014-08-24 22:07:17 -0700 | [diff] [blame] | 484 | |
Bill Richardson | f318ee2 | 2014-09-23 14:30:30 -0700 | [diff] [blame] | 485 | /* Update the config if asked */ |
Bill Richardson | 31d95c2 | 2014-08-24 22:07:17 -0700 | [diff] [blame] | 486 | if (config_file) { |
Bill Richardson | 31d95c2 | 2014-08-24 22:07:17 -0700 | [diff] [blame] | 487 | Debug("Reading %s\n", config_file); |
Bill Richardson | f318ee2 | 2014-09-23 14:30:30 -0700 | [diff] [blame] | 488 | t_config_data = |
| 489 | ReadConfigFile(config_file, &t_config_size); |
| 490 | if (!t_config_data) |
Bill Richardson | 31d95c2 | 2014-08-24 22:07:17 -0700 | [diff] [blame] | 491 | Fatal("Error reading config file.\n"); |
Bill Richardson | f318ee2 | 2014-09-23 14:30:30 -0700 | [diff] [blame] | 492 | if (0 != UpdateKernelBlobConfig( |
| 493 | kblob_data, kblob_size, |
| 494 | t_config_data, t_config_size)) |
| 495 | Fatal("Unable to update config\n"); |
Bill Richardson | 31d95c2 | 2014-08-24 22:07:17 -0700 | [diff] [blame] | 496 | } |
| 497 | |
Bill Richardson | f318ee2 | 2014-09-23 14:30:30 -0700 | [diff] [blame] | 498 | if (!version_str) |
| 499 | version = preamble->kernel_version; |
| 500 | |
Bill Richardson | 31d95c2 | 2014-08-24 22:07:17 -0700 | [diff] [blame] | 501 | if (keyblock_file) { |
Bill Richardson | f318ee2 | 2014-09-23 14:30:30 -0700 | [diff] [blame] | 502 | t_keyblock = |
| 503 | (VbKeyBlockHeader *)ReadFile(keyblock_file, 0); |
| 504 | if (!t_keyblock) |
Bill Richardson | 31d95c2 | 2014-08-24 22:07:17 -0700 | [diff] [blame] | 505 | Fatal("Error reading key block.\n"); |
| 506 | } |
| 507 | |
Bill Richardson | f1dba02 | 2014-10-01 14:10:45 -0700 | [diff] [blame] | 508 | /* Reuse previous body size */ |
Bill Richardson | f318ee2 | 2014-09-23 14:30:30 -0700 | [diff] [blame] | 509 | vblock_data = SignKernelBlob(kblob_data, kblob_size, opt_pad, |
| 510 | version, kernel_body_load_address, |
| 511 | t_keyblock ? t_keyblock : keyblock, |
| 512 | signpriv_key, &vblock_size); |
| 513 | if (!vblock_data) |
| 514 | Fatal("Unable to sign kernel blob\n"); |
Bill Richardson | 31d95c2 | 2014-08-24 22:07:17 -0700 | [diff] [blame] | 515 | |
Bill Richardson | f318ee2 | 2014-09-23 14:30:30 -0700 | [diff] [blame] | 516 | if (opt_vblockonly) |
| 517 | rv = WriteSomeParts(filename, |
| 518 | vblock_data, vblock_size, |
| 519 | NULL, 0); |
| 520 | else |
| 521 | rv = WriteSomeParts(filename, |
| 522 | vblock_data, vblock_size, |
| 523 | kblob_data, kblob_size); |
| 524 | return rv; |
Bill Richardson | 31d95c2 | 2014-08-24 22:07:17 -0700 | [diff] [blame] | 525 | |
| 526 | case OPT_MODE_VERIFY: |
| 527 | |
| 528 | /* Optional */ |
| 529 | |
| 530 | if (signpubkey_file) { |
| 531 | signpub_key = PublicKeyRead(signpubkey_file); |
| 532 | if (!signpub_key) |
| 533 | Fatal("Error reading public key.\n"); |
| 534 | } |
| 535 | |
| 536 | /* Do it */ |
| 537 | |
Bill Richardson | f318ee2 | 2014-09-23 14:30:30 -0700 | [diff] [blame] | 538 | /* Load the kernel partition */ |
| 539 | kpart_data = ReadOldKPartFromFileOrDie(filename, &kpart_size); |
Bill Richardson | 31d95c2 | 2014-08-24 22:07:17 -0700 | [diff] [blame] | 540 | |
Bill Richardson | f318ee2 | 2014-09-23 14:30:30 -0700 | [diff] [blame] | 541 | kblob_data = UnpackKPart(kpart_data, kpart_size, opt_pad, |
| 542 | 0, 0, &kblob_size); |
| 543 | if (!kblob_data) |
| 544 | Fatal("Unable to unpack kernel partition\n"); |
| 545 | |
| 546 | rv = VerifyKernelBlob(kblob_data, kblob_size, |
| 547 | signpub_key, keyblock_file, min_version); |
| 548 | |
| 549 | return rv; |
Shelley Chen | f1f53b3 | 2015-01-08 09:13:44 -0800 | [diff] [blame] | 550 | |
| 551 | case OPT_MODE_GET_VMLINUZ: |
| 552 | |
| 553 | if (!vmlinuz_out_file) { |
| 554 | fprintf(stderr, |
| 555 | "USE: vbutil_kernel --get-vmlinuz <file> " |
| 556 | "--vmlinuz-out <file>\n"); |
| 557 | print_help(argv[0]); |
| 558 | return 1; |
| 559 | } |
| 560 | |
| 561 | kpart_data = ReadOldKPartFromFileOrDie(filename, &kpart_size); |
| 562 | |
| 563 | kblob_data = UnpackKPart(kpart_data, kpart_size, opt_pad, |
| 564 | &keyblock, &preamble, &kblob_size); |
| 565 | |
| 566 | if (!kblob_data) |
| 567 | Fatal("Unable to unpack kernel partition\n"); |
| 568 | |
| 569 | f = fopen(vmlinuz_out_file, "wb"); |
| 570 | if (!f) { |
| 571 | VbExError("Can't open output file %s\n", |
| 572 | vmlinuz_out_file); |
| 573 | return 1; |
| 574 | } |
| 575 | |
| 576 | /* Now stick 16-bit header followed by kernel block into |
| 577 | output */ |
| 578 | if (VbGetKernelVmlinuzHeader(preamble, |
| 579 | &vmlinuz_header_address, |
| 580 | &vmlinuz_header_size) |
| 581 | != VBOOT_SUCCESS) { |
| 582 | Fatal("Unable to retrieve Vmlinuz Header!"); |
| 583 | } |
Shelley Chen | 1bdc612 | 2015-02-02 10:06:10 -0800 | [diff] [blame] | 584 | |
Shelley Chen | f1f53b3 | 2015-01-08 09:13:44 -0800 | [diff] [blame] | 585 | if (vmlinuz_header_size) { |
| 586 | // verify that the 16-bit header is included in the |
| 587 | // kblob (to make sure that it's included in the |
| 588 | // signature) |
| 589 | if (VerifyVmlinuzInsideKBlob(preamble->body_load_address, |
| 590 | kblob_size, |
| 591 | vmlinuz_header_address, |
| 592 | vmlinuz_header_size)) { |
| 593 | VbExError("Vmlinuz header not signed!\n"); |
| 594 | fclose(f); |
| 595 | unlink(vmlinuz_out_file); |
| 596 | return 1; |
| 597 | } |
Shelley Chen | 1bdc612 | 2015-02-02 10:06:10 -0800 | [diff] [blame] | 598 | // calculate the vmlinuz_header offset from |
| 599 | // the beginning of the kpart_data. The kblob doesn't |
| 600 | // include the body_load_offset, but does include |
| 601 | // the keyblock and preamble sections. |
| 602 | vmlinuz_header_offset = vmlinuz_header_address - |
| 603 | preamble->body_load_address + |
| 604 | keyblock->key_block_size + |
| 605 | preamble->preamble_size; |
| 606 | errcount |= |
| 607 | (1 != fwrite(kpart_data + vmlinuz_header_offset, |
| 608 | vmlinuz_header_size, |
| 609 | 1, |
| 610 | f)); |
| 611 | } |
| 612 | errcount |= (1 != fwrite(kblob_data, |
| 613 | kblob_size, |
Shelley Chen | f1f53b3 | 2015-01-08 09:13:44 -0800 | [diff] [blame] | 614 | 1, |
| 615 | f)); |
Shelley Chen | 1bdc612 | 2015-02-02 10:06:10 -0800 | [diff] [blame] | 616 | if (errcount) { |
Shelley Chen | f1f53b3 | 2015-01-08 09:13:44 -0800 | [diff] [blame] | 617 | VbExError("Can't write output file %s\n", |
| 618 | vmlinuz_out_file); |
| 619 | fclose(f); |
| 620 | unlink(vmlinuz_out_file); |
| 621 | return 1; |
| 622 | } |
| 623 | |
| 624 | fclose(f); |
Shelley Chen | 1bdc612 | 2015-02-02 10:06:10 -0800 | [diff] [blame] | 625 | return 0; |
Bill Richardson | 31d95c2 | 2014-08-24 22:07:17 -0700 | [diff] [blame] | 626 | } |
| 627 | |
| 628 | fprintf(stderr, |
Shelley Chen | f1f53b3 | 2015-01-08 09:13:44 -0800 | [diff] [blame] | 629 | "You must specify a mode: " |
| 630 | "--pack, --repack, --verify, or --get-vmlinuz\n"); |
Bill Richardson | 779796f | 2014-09-23 11:47:40 -0700 | [diff] [blame] | 631 | print_help(argv[0]); |
| 632 | return 1; |
Randall Spangler | 7d6898d | 2010-06-11 09:22:13 -0700 | [diff] [blame] | 633 | } |
Bill Richardson | 6f39615 | 2014-07-15 12:52:19 -0700 | [diff] [blame] | 634 | |
Bill Richardson | 4dad690 | 2014-12-03 16:13:33 -0800 | [diff] [blame] | 635 | DECLARE_FUTIL_COMMAND(vbutil_kernel, do_vbutil_kernel, |
Bill Richardson | f318ee2 | 2014-09-23 14:30:30 -0700 | [diff] [blame] | 636 | "Creates, signs, and verifies the kernel partition", |
Bill Richardson | 779796f | 2014-09-23 11:47:40 -0700 | [diff] [blame] | 637 | print_help); |