wdenk | 5b1d713 | 2002-11-03 00:07:02 +0000 | [diff] [blame] | 1 | /* |
Bartlomiej Sieka | 9d25438 | 2008-03-11 12:34:47 +0100 | [diff] [blame] | 2 | * (C) Copyright 2008 Semihalf |
| 3 | * |
Prafulla Wadaskar | 89a4d6b | 2009-08-19 17:36:46 +0530 | [diff] [blame] | 4 | * (C) Copyright 2000-2009 |
wdenk | 5b1d713 | 2002-11-03 00:07:02 +0000 | [diff] [blame] | 5 | * DENX Software Engineering |
| 6 | * Wolfgang Denk, wd@denx.de |
wdenk | 0c852a2 | 2004-02-26 23:01:04 +0000 | [diff] [blame] | 7 | * |
Wolfgang Denk | 1a45966 | 2013-07-08 09:37:19 +0200 | [diff] [blame] | 8 | * SPDX-License-Identifier: GPL-2.0+ |
wdenk | 5b1d713 | 2002-11-03 00:07:02 +0000 | [diff] [blame] | 9 | */ |
| 10 | |
Marian Balakowicz | b97a2a0 | 2008-01-08 18:14:09 +0100 | [diff] [blame] | 11 | #include "mkimage.h" |
wdenk | 5b1d713 | 2002-11-03 00:07:02 +0000 | [diff] [blame] | 12 | #include <image.h> |
Wolfgang Denk | 976b38c | 2011-02-12 10:37:11 +0100 | [diff] [blame] | 13 | #include <version.h> |
wdenk | 5b1d713 | 2002-11-03 00:07:02 +0000 | [diff] [blame] | 14 | |
Prafulla Wadaskar | 89a4d6b | 2009-08-19 17:36:46 +0530 | [diff] [blame] | 15 | static void copy_file(int, const char *, int); |
| 16 | static void usage(void); |
wdenk | 5b1d713 | 2002-11-03 00:07:02 +0000 | [diff] [blame] | 17 | |
Prafulla Wadaskar | 89a4d6b | 2009-08-19 17:36:46 +0530 | [diff] [blame] | 18 | /* image_type_params link list to maintain registered image type supports */ |
| 19 | struct image_type_params *mkimage_tparams = NULL; |
wdenk | 5b1d713 | 2002-11-03 00:07:02 +0000 | [diff] [blame] | 20 | |
Prafulla Wadaskar | 89a4d6b | 2009-08-19 17:36:46 +0530 | [diff] [blame] | 21 | /* parameters initialized by core will be used by the image type code */ |
| 22 | struct mkimage_params params = { |
| 23 | .os = IH_OS_LINUX, |
| 24 | .arch = IH_ARCH_PPC, |
| 25 | .type = IH_TYPE_KERNEL, |
| 26 | .comp = IH_COMP_GZIP, |
| 27 | .dtc = MKIMAGE_DEFAULT_DTC_OPTIONS, |
Wolfgang Denk | 04387d2 | 2010-03-27 23:37:46 +0100 | [diff] [blame] | 28 | .imagename = "", |
Shaohui Xie | 5d898a0 | 2012-08-10 02:49:35 +0000 | [diff] [blame] | 29 | .imagename2 = "", |
Prafulla Wadaskar | 89a4d6b | 2009-08-19 17:36:46 +0530 | [diff] [blame] | 30 | }; |
wdenk | 5b1d713 | 2002-11-03 00:07:02 +0000 | [diff] [blame] | 31 | |
Prafulla Wadaskar | 89a4d6b | 2009-08-19 17:36:46 +0530 | [diff] [blame] | 32 | /* |
| 33 | * mkimage_register - |
| 34 | * |
| 35 | * It is used to register respective image generation/list support to the |
| 36 | * mkimage core |
| 37 | * |
| 38 | * the input struct image_type_params is checked and appended to the link |
| 39 | * list, if the input structure is already registered, error |
| 40 | */ |
| 41 | void mkimage_register (struct image_type_params *tparams) |
| 42 | { |
| 43 | struct image_type_params **tp; |
| 44 | |
| 45 | if (!tparams) { |
| 46 | fprintf (stderr, "%s: %s: Null input\n", |
| 47 | params.cmdname, __FUNCTION__); |
| 48 | exit (EXIT_FAILURE); |
| 49 | } |
| 50 | |
| 51 | /* scan the linked list, check for registry and point the last one */ |
| 52 | for (tp = &mkimage_tparams; *tp != NULL; tp = &(*tp)->next) { |
| 53 | if (!strcmp((*tp)->name, tparams->name)) { |
| 54 | fprintf (stderr, "%s: %s already registered\n", |
| 55 | params.cmdname, tparams->name); |
| 56 | return; |
| 57 | } |
| 58 | } |
| 59 | |
| 60 | /* add input struct entry at the end of link list */ |
| 61 | *tp = tparams; |
| 62 | /* mark input entry as last entry in the link list */ |
| 63 | tparams->next = NULL; |
| 64 | |
| 65 | debug ("Registered %s\n", tparams->name); |
| 66 | } |
| 67 | |
| 68 | /* |
| 69 | * mkimage_get_type - |
| 70 | * |
| 71 | * It scans all registers image type supports |
| 72 | * checks the input type_id for each supported image type |
| 73 | * |
| 74 | * if successful, |
| 75 | * returns respective image_type_params pointer if success |
| 76 | * if input type_id is not supported by any of image_type_support |
| 77 | * returns NULL |
| 78 | */ |
| 79 | struct image_type_params *mkimage_get_type(int type) |
| 80 | { |
| 81 | struct image_type_params *curr; |
| 82 | |
| 83 | for (curr = mkimage_tparams; curr != NULL; curr = curr->next) { |
| 84 | if (curr->check_image_type) { |
| 85 | if (!curr->check_image_type (type)) |
| 86 | return curr; |
| 87 | } |
| 88 | } |
| 89 | return NULL; |
| 90 | } |
| 91 | |
| 92 | /* |
| 93 | * mkimage_verify_print_header - |
| 94 | * |
| 95 | * It scans mkimage_tparams link list, |
| 96 | * verifies image_header for each supported image type |
| 97 | * if verification is successful, prints respective header |
| 98 | * |
| 99 | * returns negative if input image format does not match with any of |
| 100 | * supported image types |
| 101 | */ |
| 102 | int mkimage_verify_print_header (void *ptr, struct stat *sbuf) |
| 103 | { |
| 104 | int retval = -1; |
| 105 | struct image_type_params *curr; |
| 106 | |
| 107 | for (curr = mkimage_tparams; curr != NULL; curr = curr->next ) { |
| 108 | if (curr->verify_header) { |
| 109 | retval = curr->verify_header ( |
| 110 | (unsigned char *)ptr, sbuf->st_size, |
| 111 | ¶ms); |
| 112 | |
| 113 | if (retval == 0) { |
| 114 | /* |
| 115 | * Print the image information |
| 116 | * if verify is successful |
| 117 | */ |
| 118 | if (curr->print_header) |
| 119 | curr->print_header (ptr); |
| 120 | else { |
| 121 | fprintf (stderr, |
| 122 | "%s: print_header undefined for %s\n", |
| 123 | params.cmdname, curr->name); |
| 124 | } |
| 125 | break; |
| 126 | } |
| 127 | } |
| 128 | } |
| 129 | return retval; |
| 130 | } |
wdenk | 5b1d713 | 2002-11-03 00:07:02 +0000 | [diff] [blame] | 131 | |
| 132 | int |
| 133 | main (int argc, char **argv) |
| 134 | { |
Bartlomiej Sieka | 9d25438 | 2008-03-11 12:34:47 +0100 | [diff] [blame] | 135 | int ifd = -1; |
wdenk | 5b1d713 | 2002-11-03 00:07:02 +0000 | [diff] [blame] | 136 | struct stat sbuf; |
Peter Tyser | a2513e2 | 2010-04-04 22:36:03 -0500 | [diff] [blame] | 137 | char *ptr; |
Prafulla Wadaskar | 449609f | 2009-08-16 05:28:19 +0530 | [diff] [blame] | 138 | int retval = 0; |
Prafulla Wadaskar | 89a4d6b | 2009-08-19 17:36:46 +0530 | [diff] [blame] | 139 | struct image_type_params *tparams = NULL; |
Stefano Babic | 9bac0bb | 2013-08-19 19:03:19 +0200 | [diff] [blame] | 140 | int pad_len = 0; |
wdenk | 5b1d713 | 2002-11-03 00:07:02 +0000 | [diff] [blame] | 141 | |
Shaohui Xie | 5d898a0 | 2012-08-10 02:49:35 +0000 | [diff] [blame] | 142 | /* Init Freescale PBL Boot image generation/list support */ |
| 143 | init_pbl_image_type(); |
Prafulla Wadaskar | aa0c7a8 | 2009-09-07 15:05:02 +0530 | [diff] [blame] | 144 | /* Init Kirkwood Boot image generation/list support */ |
| 145 | init_kwb_image_type (); |
Stefano Babic | 8edcde5 | 2010-01-20 18:19:10 +0100 | [diff] [blame] | 146 | /* Init Freescale imx Boot image generation/list support */ |
| 147 | init_imx_image_type (); |
Marek Vasut | bce8837 | 2013-08-26 20:43:33 +0200 | [diff] [blame^] | 148 | /* Init Freescale mxs Boot image generation/list support */ |
| 149 | init_mxs_image_type(); |
Prafulla Wadaskar | 89a4d6b | 2009-08-19 17:36:46 +0530 | [diff] [blame] | 150 | /* Init FIT image generation/list support */ |
| 151 | init_fit_image_type (); |
John Rigby | 3decb14 | 2011-07-21 09:10:30 -0400 | [diff] [blame] | 152 | /* Init TI OMAP Boot image generation/list support */ |
| 153 | init_omap_image_type(); |
Prafulla Wadaskar | 89a4d6b | 2009-08-19 17:36:46 +0530 | [diff] [blame] | 154 | /* Init Default image generation/list support */ |
| 155 | init_default_image_type (); |
Heiko Schocher | 7816f2c | 2011-07-16 00:06:42 +0000 | [diff] [blame] | 156 | /* Init Davinci UBL support */ |
| 157 | init_ubl_image_type(); |
Stefano Babic | 4962e38 | 2011-10-17 00:07:43 +0000 | [diff] [blame] | 158 | /* Init Davinci AIS support */ |
| 159 | init_ais_image_type(); |
wdenk | 5b1d713 | 2002-11-03 00:07:02 +0000 | [diff] [blame] | 160 | |
Prafulla Wadaskar | 89a4d6b | 2009-08-19 17:36:46 +0530 | [diff] [blame] | 161 | params.cmdname = *argv; |
| 162 | params.addr = params.ep = 0; |
wdenk | 5b1d713 | 2002-11-03 00:07:02 +0000 | [diff] [blame] | 163 | |
| 164 | while (--argc > 0 && **++argv == '-') { |
| 165 | while (*++*argv) { |
| 166 | switch (**argv) { |
| 167 | case 'l': |
Prafulla Wadaskar | 89a4d6b | 2009-08-19 17:36:46 +0530 | [diff] [blame] | 168 | params.lflag = 1; |
wdenk | 5b1d713 | 2002-11-03 00:07:02 +0000 | [diff] [blame] | 169 | break; |
| 170 | case 'A': |
| 171 | if ((--argc <= 0) || |
Prafulla Wadaskar | 89a4d6b | 2009-08-19 17:36:46 +0530 | [diff] [blame] | 172 | (params.arch = |
| 173 | genimg_get_arch_id (*++argv)) < 0) |
wdenk | 5b1d713 | 2002-11-03 00:07:02 +0000 | [diff] [blame] | 174 | usage (); |
| 175 | goto NXTARG; |
Simon Glass | 4f61042 | 2013-06-13 15:10:06 -0700 | [diff] [blame] | 176 | case 'c': |
| 177 | if (--argc <= 0) |
| 178 | usage(); |
| 179 | params.comment = *++argv; |
| 180 | goto NXTARG; |
wdenk | 5b1d713 | 2002-11-03 00:07:02 +0000 | [diff] [blame] | 181 | case 'C': |
| 182 | if ((--argc <= 0) || |
Prafulla Wadaskar | 89a4d6b | 2009-08-19 17:36:46 +0530 | [diff] [blame] | 183 | (params.comp = |
| 184 | genimg_get_comp_id (*++argv)) < 0) |
wdenk | 5b1d713 | 2002-11-03 00:07:02 +0000 | [diff] [blame] | 185 | usage (); |
| 186 | goto NXTARG; |
Bartlomiej Sieka | 9d25438 | 2008-03-11 12:34:47 +0100 | [diff] [blame] | 187 | case 'D': |
| 188 | if (--argc <= 0) |
| 189 | usage (); |
Prafulla Wadaskar | 89a4d6b | 2009-08-19 17:36:46 +0530 | [diff] [blame] | 190 | params.dtc = *++argv; |
Bartlomiej Sieka | 9d25438 | 2008-03-11 12:34:47 +0100 | [diff] [blame] | 191 | goto NXTARG; |
| 192 | |
wdenk | 5b1d713 | 2002-11-03 00:07:02 +0000 | [diff] [blame] | 193 | case 'O': |
| 194 | if ((--argc <= 0) || |
Prafulla Wadaskar | 89a4d6b | 2009-08-19 17:36:46 +0530 | [diff] [blame] | 195 | (params.os = |
| 196 | genimg_get_os_id (*++argv)) < 0) |
wdenk | 5b1d713 | 2002-11-03 00:07:02 +0000 | [diff] [blame] | 197 | usage (); |
| 198 | goto NXTARG; |
| 199 | case 'T': |
| 200 | if ((--argc <= 0) || |
Prafulla Wadaskar | 89a4d6b | 2009-08-19 17:36:46 +0530 | [diff] [blame] | 201 | (params.type = |
| 202 | genimg_get_type_id (*++argv)) < 0) |
wdenk | 5b1d713 | 2002-11-03 00:07:02 +0000 | [diff] [blame] | 203 | usage (); |
| 204 | goto NXTARG; |
| 205 | |
| 206 | case 'a': |
| 207 | if (--argc <= 0) |
| 208 | usage (); |
Peter Tyser | a2513e2 | 2010-04-04 22:36:03 -0500 | [diff] [blame] | 209 | params.addr = strtoul (*++argv, &ptr, 16); |
wdenk | 5b1d713 | 2002-11-03 00:07:02 +0000 | [diff] [blame] | 210 | if (*ptr) { |
| 211 | fprintf (stderr, |
| 212 | "%s: invalid load address %s\n", |
Prafulla Wadaskar | 89a4d6b | 2009-08-19 17:36:46 +0530 | [diff] [blame] | 213 | params.cmdname, *argv); |
wdenk | 5b1d713 | 2002-11-03 00:07:02 +0000 | [diff] [blame] | 214 | exit (EXIT_FAILURE); |
| 215 | } |
| 216 | goto NXTARG; |
| 217 | case 'd': |
| 218 | if (--argc <= 0) |
| 219 | usage (); |
Prafulla Wadaskar | 89a4d6b | 2009-08-19 17:36:46 +0530 | [diff] [blame] | 220 | params.datafile = *++argv; |
| 221 | params.dflag = 1; |
wdenk | 5b1d713 | 2002-11-03 00:07:02 +0000 | [diff] [blame] | 222 | goto NXTARG; |
| 223 | case 'e': |
| 224 | if (--argc <= 0) |
| 225 | usage (); |
Peter Tyser | a2513e2 | 2010-04-04 22:36:03 -0500 | [diff] [blame] | 226 | params.ep = strtoul (*++argv, &ptr, 16); |
wdenk | 5b1d713 | 2002-11-03 00:07:02 +0000 | [diff] [blame] | 227 | if (*ptr) { |
| 228 | fprintf (stderr, |
| 229 | "%s: invalid entry point %s\n", |
Prafulla Wadaskar | 89a4d6b | 2009-08-19 17:36:46 +0530 | [diff] [blame] | 230 | params.cmdname, *argv); |
wdenk | 5b1d713 | 2002-11-03 00:07:02 +0000 | [diff] [blame] | 231 | exit (EXIT_FAILURE); |
| 232 | } |
Prafulla Wadaskar | 89a4d6b | 2009-08-19 17:36:46 +0530 | [diff] [blame] | 233 | params.eflag = 1; |
wdenk | 5b1d713 | 2002-11-03 00:07:02 +0000 | [diff] [blame] | 234 | goto NXTARG; |
Bartlomiej Sieka | 9d25438 | 2008-03-11 12:34:47 +0100 | [diff] [blame] | 235 | case 'f': |
| 236 | if (--argc <= 0) |
| 237 | usage (); |
Simon Glass | 95d77b4 | 2013-06-13 15:10:05 -0700 | [diff] [blame] | 238 | params.datafile = *++argv; |
| 239 | /* no break */ |
| 240 | case 'F': |
Peter Tyser | 1a99de2 | 2009-11-24 16:42:08 -0600 | [diff] [blame] | 241 | /* |
| 242 | * The flattened image tree (FIT) format |
| 243 | * requires a flattened device tree image type |
| 244 | */ |
| 245 | params.type = IH_TYPE_FLATDT; |
Peter Tyser | fbc1c8f | 2009-12-06 01:33:24 -0600 | [diff] [blame] | 246 | params.fflag = 1; |
Bartlomiej Sieka | 9d25438 | 2008-03-11 12:34:47 +0100 | [diff] [blame] | 247 | goto NXTARG; |
Simon Glass | 80e4df8 | 2013-06-13 15:10:03 -0700 | [diff] [blame] | 248 | case 'k': |
| 249 | if (--argc <= 0) |
| 250 | usage(); |
| 251 | params.keydir = *++argv; |
| 252 | goto NXTARG; |
Simon Glass | e29495d | 2013-06-13 15:10:04 -0700 | [diff] [blame] | 253 | case 'K': |
| 254 | if (--argc <= 0) |
| 255 | usage(); |
| 256 | params.keydest = *++argv; |
| 257 | goto NXTARG; |
wdenk | 5b1d713 | 2002-11-03 00:07:02 +0000 | [diff] [blame] | 258 | case 'n': |
| 259 | if (--argc <= 0) |
| 260 | usage (); |
Prafulla Wadaskar | 89a4d6b | 2009-08-19 17:36:46 +0530 | [diff] [blame] | 261 | params.imagename = *++argv; |
wdenk | 5b1d713 | 2002-11-03 00:07:02 +0000 | [diff] [blame] | 262 | goto NXTARG; |
Simon Glass | 399c744 | 2013-06-13 15:10:07 -0700 | [diff] [blame] | 263 | case 'r': |
| 264 | params.require_keys = 1; |
| 265 | break; |
Shaohui Xie | 5d898a0 | 2012-08-10 02:49:35 +0000 | [diff] [blame] | 266 | case 'R': |
| 267 | if (--argc <= 0) |
| 268 | usage(); |
| 269 | /* |
| 270 | * This entry is for the second configuration |
| 271 | * file, if only one is not enough. |
| 272 | */ |
| 273 | params.imagename2 = *++argv; |
| 274 | goto NXTARG; |
Stefano Babic | f066210 | 2011-09-15 23:50:16 +0000 | [diff] [blame] | 275 | case 's': |
| 276 | params.skipcpy = 1; |
| 277 | break; |
wdenk | 5b1d713 | 2002-11-03 00:07:02 +0000 | [diff] [blame] | 278 | case 'v': |
Prafulla Wadaskar | 89a4d6b | 2009-08-19 17:36:46 +0530 | [diff] [blame] | 279 | params.vflag++; |
wdenk | 5b1d713 | 2002-11-03 00:07:02 +0000 | [diff] [blame] | 280 | break; |
Wolfgang Denk | 976b38c | 2011-02-12 10:37:11 +0100 | [diff] [blame] | 281 | case 'V': |
| 282 | printf("mkimage version %s\n", PLAIN_VERSION); |
| 283 | exit(EXIT_SUCCESS); |
wdenk | 5b1d713 | 2002-11-03 00:07:02 +0000 | [diff] [blame] | 284 | case 'x': |
Prafulla Wadaskar | 89a4d6b | 2009-08-19 17:36:46 +0530 | [diff] [blame] | 285 | params.xflag++; |
wdenk | 5b1d713 | 2002-11-03 00:07:02 +0000 | [diff] [blame] | 286 | break; |
| 287 | default: |
| 288 | usage (); |
| 289 | } |
| 290 | } |
| 291 | NXTARG: ; |
| 292 | } |
| 293 | |
Prafulla Wadaskar | 89a4d6b | 2009-08-19 17:36:46 +0530 | [diff] [blame] | 294 | if (argc != 1) |
| 295 | usage (); |
wdenk | 5b1d713 | 2002-11-03 00:07:02 +0000 | [diff] [blame] | 296 | |
Prafulla Wadaskar | 89a4d6b | 2009-08-19 17:36:46 +0530 | [diff] [blame] | 297 | /* set tparams as per input type_id */ |
| 298 | tparams = mkimage_get_type(params.type); |
| 299 | if (tparams == NULL) { |
| 300 | fprintf (stderr, "%s: unsupported type %s\n", |
| 301 | params.cmdname, genimg_get_type_name(params.type)); |
| 302 | exit (EXIT_FAILURE); |
| 303 | } |
| 304 | |
| 305 | /* |
| 306 | * check the passed arguments parameters meets the requirements |
| 307 | * as per image type to be generated/listed |
| 308 | */ |
| 309 | if (tparams->check_params) |
| 310 | if (tparams->check_params (¶ms)) |
| 311 | usage (); |
| 312 | |
| 313 | if (!params.eflag) { |
| 314 | params.ep = params.addr; |
wdenk | 5b1d713 | 2002-11-03 00:07:02 +0000 | [diff] [blame] | 315 | /* If XIP, entry point must be after the U-Boot header */ |
Prafulla Wadaskar | 89a4d6b | 2009-08-19 17:36:46 +0530 | [diff] [blame] | 316 | if (params.xflag) |
| 317 | params.ep += tparams->header_size; |
wdenk | 5b1d713 | 2002-11-03 00:07:02 +0000 | [diff] [blame] | 318 | } |
| 319 | |
Prafulla Wadaskar | 89a4d6b | 2009-08-19 17:36:46 +0530 | [diff] [blame] | 320 | params.imagefile = *argv; |
wdenk | 5b1d713 | 2002-11-03 00:07:02 +0000 | [diff] [blame] | 321 | |
Peter Tyser | c81296c | 2009-11-24 16:42:10 -0600 | [diff] [blame] | 322 | if (params.fflag){ |
| 323 | if (tparams->fflag_handle) |
| 324 | /* |
| 325 | * in some cases, some additional processing needs |
| 326 | * to be done if fflag is defined |
| 327 | * |
| 328 | * For ex. fit_handle_file for Fit file support |
| 329 | */ |
| 330 | retval = tparams->fflag_handle(¶ms); |
wdenk | 5b1d713 | 2002-11-03 00:07:02 +0000 | [diff] [blame] | 331 | |
Peter Tyser | c81296c | 2009-11-24 16:42:10 -0600 | [diff] [blame] | 332 | if (retval != EXIT_SUCCESS) |
| 333 | exit (retval); |
wdenk | 5b1d713 | 2002-11-03 00:07:02 +0000 | [diff] [blame] | 334 | } |
| 335 | |
Peter Tyser | c81296c | 2009-11-24 16:42:10 -0600 | [diff] [blame] | 336 | if (params.lflag || params.fflag) { |
| 337 | ifd = open (params.imagefile, O_RDONLY|O_BINARY); |
| 338 | } else { |
| 339 | ifd = open (params.imagefile, |
| 340 | O_RDWR|O_CREAT|O_TRUNC|O_BINARY, 0666); |
| 341 | } |
| 342 | |
| 343 | if (ifd < 0) { |
| 344 | fprintf (stderr, "%s: Can't open %s: %s\n", |
| 345 | params.cmdname, params.imagefile, |
| 346 | strerror(errno)); |
| 347 | exit (EXIT_FAILURE); |
| 348 | } |
| 349 | |
| 350 | if (params.lflag || params.fflag) { |
wdenk | 5b1d713 | 2002-11-03 00:07:02 +0000 | [diff] [blame] | 351 | /* |
| 352 | * list header information of existing image |
| 353 | */ |
| 354 | if (fstat(ifd, &sbuf) < 0) { |
| 355 | fprintf (stderr, "%s: Can't stat %s: %s\n", |
Prafulla Wadaskar | 89a4d6b | 2009-08-19 17:36:46 +0530 | [diff] [blame] | 356 | params.cmdname, params.imagefile, |
| 357 | strerror(errno)); |
wdenk | 5b1d713 | 2002-11-03 00:07:02 +0000 | [diff] [blame] | 358 | exit (EXIT_FAILURE); |
| 359 | } |
| 360 | |
Prafulla Wadaskar | 89a4d6b | 2009-08-19 17:36:46 +0530 | [diff] [blame] | 361 | if ((unsigned)sbuf.st_size < tparams->header_size) { |
wdenk | 5b1d713 | 2002-11-03 00:07:02 +0000 | [diff] [blame] | 362 | fprintf (stderr, |
Prafulla Wadaskar | 89a4d6b | 2009-08-19 17:36:46 +0530 | [diff] [blame] | 363 | "%s: Bad size: \"%s\" is not valid image\n", |
| 364 | params.cmdname, params.imagefile); |
wdenk | 5b1d713 | 2002-11-03 00:07:02 +0000 | [diff] [blame] | 365 | exit (EXIT_FAILURE); |
| 366 | } |
| 367 | |
Mike Frysinger | fa956fd | 2008-05-01 04:13:05 -0400 | [diff] [blame] | 368 | ptr = mmap(0, sbuf.st_size, PROT_READ, MAP_SHARED, ifd, 0); |
| 369 | if (ptr == MAP_FAILED) { |
wdenk | 5b1d713 | 2002-11-03 00:07:02 +0000 | [diff] [blame] | 370 | fprintf (stderr, "%s: Can't read %s: %s\n", |
Prafulla Wadaskar | 89a4d6b | 2009-08-19 17:36:46 +0530 | [diff] [blame] | 371 | params.cmdname, params.imagefile, |
| 372 | strerror(errno)); |
wdenk | 5b1d713 | 2002-11-03 00:07:02 +0000 | [diff] [blame] | 373 | exit (EXIT_FAILURE); |
| 374 | } |
| 375 | |
Prafulla Wadaskar | 89a4d6b | 2009-08-19 17:36:46 +0530 | [diff] [blame] | 376 | /* |
| 377 | * scan through mkimage registry for all supported image types |
| 378 | * and verify the input image file header for match |
| 379 | * Print the image information for matched image type |
| 380 | * Returns the error code if not matched |
| 381 | */ |
| 382 | retval = mkimage_verify_print_header (ptr, &sbuf); |
wdenk | 5b1d713 | 2002-11-03 00:07:02 +0000 | [diff] [blame] | 383 | |
wdenk | 5b1d713 | 2002-11-03 00:07:02 +0000 | [diff] [blame] | 384 | (void) munmap((void *)ptr, sbuf.st_size); |
| 385 | (void) close (ifd); |
| 386 | |
Prafulla Wadaskar | f7644c0 | 2009-08-10 18:49:37 +0530 | [diff] [blame] | 387 | exit (retval); |
wdenk | 5b1d713 | 2002-11-03 00:07:02 +0000 | [diff] [blame] | 388 | } |
| 389 | |
| 390 | /* |
Stefano Babic | f066210 | 2011-09-15 23:50:16 +0000 | [diff] [blame] | 391 | * In case there an header with a variable |
| 392 | * length will be added, the corresponding |
| 393 | * function is called. This is responsible to |
| 394 | * allocate memory for the header itself. |
wdenk | 5b1d713 | 2002-11-03 00:07:02 +0000 | [diff] [blame] | 395 | */ |
Stefano Babic | f066210 | 2011-09-15 23:50:16 +0000 | [diff] [blame] | 396 | if (tparams->vrec_header) |
Stefano Babic | 9bac0bb | 2013-08-19 19:03:19 +0200 | [diff] [blame] | 397 | pad_len = tparams->vrec_header(¶ms, tparams); |
Stefano Babic | f066210 | 2011-09-15 23:50:16 +0000 | [diff] [blame] | 398 | else |
| 399 | memset(tparams->hdr, 0, tparams->header_size); |
wdenk | 5b1d713 | 2002-11-03 00:07:02 +0000 | [diff] [blame] | 400 | |
Prafulla Wadaskar | 89a4d6b | 2009-08-19 17:36:46 +0530 | [diff] [blame] | 401 | if (write(ifd, tparams->hdr, tparams->header_size) |
| 402 | != tparams->header_size) { |
wdenk | 5b1d713 | 2002-11-03 00:07:02 +0000 | [diff] [blame] | 403 | fprintf (stderr, "%s: Write error on %s: %s\n", |
Prafulla Wadaskar | 89a4d6b | 2009-08-19 17:36:46 +0530 | [diff] [blame] | 404 | params.cmdname, params.imagefile, strerror(errno)); |
wdenk | 5b1d713 | 2002-11-03 00:07:02 +0000 | [diff] [blame] | 405 | exit (EXIT_FAILURE); |
| 406 | } |
| 407 | |
Christian Riesch | d1be8f9 | 2011-12-09 09:47:38 +0000 | [diff] [blame] | 408 | if (!params.skipcpy) { |
| 409 | if (params.type == IH_TYPE_MULTI || |
| 410 | params.type == IH_TYPE_SCRIPT) { |
| 411 | char *file = params.datafile; |
| 412 | uint32_t size; |
wdenk | 5b1d713 | 2002-11-03 00:07:02 +0000 | [diff] [blame] | 413 | |
Christian Riesch | d1be8f9 | 2011-12-09 09:47:38 +0000 | [diff] [blame] | 414 | for (;;) { |
| 415 | char *sep = NULL; |
wdenk | 5b1d713 | 2002-11-03 00:07:02 +0000 | [diff] [blame] | 416 | |
Christian Riesch | d1be8f9 | 2011-12-09 09:47:38 +0000 | [diff] [blame] | 417 | if (file) { |
| 418 | if ((sep = strchr(file, ':')) != NULL) { |
| 419 | *sep = '\0'; |
| 420 | } |
| 421 | |
| 422 | if (stat (file, &sbuf) < 0) { |
| 423 | fprintf (stderr, "%s: Can't stat %s: %s\n", |
| 424 | params.cmdname, file, strerror(errno)); |
| 425 | exit (EXIT_FAILURE); |
| 426 | } |
| 427 | size = cpu_to_uimage (sbuf.st_size); |
| 428 | } else { |
| 429 | size = 0; |
wdenk | 5b1d713 | 2002-11-03 00:07:02 +0000 | [diff] [blame] | 430 | } |
| 431 | |
Christian Riesch | d1be8f9 | 2011-12-09 09:47:38 +0000 | [diff] [blame] | 432 | if (write(ifd, (char *)&size, sizeof(size)) != sizeof(size)) { |
| 433 | fprintf (stderr, "%s: Write error on %s: %s\n", |
| 434 | params.cmdname, params.imagefile, |
| 435 | strerror(errno)); |
wdenk | 5b1d713 | 2002-11-03 00:07:02 +0000 | [diff] [blame] | 436 | exit (EXIT_FAILURE); |
| 437 | } |
Christian Riesch | d1be8f9 | 2011-12-09 09:47:38 +0000 | [diff] [blame] | 438 | |
| 439 | if (!file) { |
| 440 | break; |
| 441 | } |
| 442 | |
| 443 | if (sep) { |
| 444 | *sep = ':'; |
| 445 | file = sep + 1; |
| 446 | } else { |
| 447 | file = NULL; |
| 448 | } |
wdenk | 5b1d713 | 2002-11-03 00:07:02 +0000 | [diff] [blame] | 449 | } |
| 450 | |
Christian Riesch | d1be8f9 | 2011-12-09 09:47:38 +0000 | [diff] [blame] | 451 | file = params.datafile; |
wdenk | 5b1d713 | 2002-11-03 00:07:02 +0000 | [diff] [blame] | 452 | |
Christian Riesch | d1be8f9 | 2011-12-09 09:47:38 +0000 | [diff] [blame] | 453 | for (;;) { |
| 454 | char *sep = strchr(file, ':'); |
| 455 | if (sep) { |
| 456 | *sep = '\0'; |
| 457 | copy_file (ifd, file, 1); |
| 458 | *sep++ = ':'; |
| 459 | file = sep; |
| 460 | } else { |
| 461 | copy_file (ifd, file, 0); |
| 462 | break; |
| 463 | } |
wdenk | 5b1d713 | 2002-11-03 00:07:02 +0000 | [diff] [blame] | 464 | } |
Shaohui Xie | 5d898a0 | 2012-08-10 02:49:35 +0000 | [diff] [blame] | 465 | } else if (params.type == IH_TYPE_PBLIMAGE) { |
| 466 | /* PBL has special Image format, implements its' own */ |
| 467 | pbl_load_uboot(ifd, ¶ms); |
Christian Riesch | d1be8f9 | 2011-12-09 09:47:38 +0000 | [diff] [blame] | 468 | } else { |
Stefano Babic | 9bac0bb | 2013-08-19 19:03:19 +0200 | [diff] [blame] | 469 | copy_file(ifd, params.datafile, pad_len); |
wdenk | 5b1d713 | 2002-11-03 00:07:02 +0000 | [diff] [blame] | 470 | } |
wdenk | 5b1d713 | 2002-11-03 00:07:02 +0000 | [diff] [blame] | 471 | } |
| 472 | |
| 473 | /* We're a bit of paranoid */ |
Prafulla Wadaskar | 89a4d6b | 2009-08-19 17:36:46 +0530 | [diff] [blame] | 474 | #if defined(_POSIX_SYNCHRONIZED_IO) && \ |
| 475 | !defined(__sun__) && \ |
| 476 | !defined(__FreeBSD__) && \ |
| 477 | !defined(__APPLE__) |
wdenk | 5b1d713 | 2002-11-03 00:07:02 +0000 | [diff] [blame] | 478 | (void) fdatasync (ifd); |
| 479 | #else |
| 480 | (void) fsync (ifd); |
| 481 | #endif |
| 482 | |
| 483 | if (fstat(ifd, &sbuf) < 0) { |
| 484 | fprintf (stderr, "%s: Can't stat %s: %s\n", |
Prafulla Wadaskar | 89a4d6b | 2009-08-19 17:36:46 +0530 | [diff] [blame] | 485 | params.cmdname, params.imagefile, strerror(errno)); |
wdenk | 5b1d713 | 2002-11-03 00:07:02 +0000 | [diff] [blame] | 486 | exit (EXIT_FAILURE); |
| 487 | } |
| 488 | |
Mike Frysinger | fa956fd | 2008-05-01 04:13:05 -0400 | [diff] [blame] | 489 | ptr = mmap(0, sbuf.st_size, PROT_READ|PROT_WRITE, MAP_SHARED, ifd, 0); |
| 490 | if (ptr == MAP_FAILED) { |
wdenk | 5b1d713 | 2002-11-03 00:07:02 +0000 | [diff] [blame] | 491 | fprintf (stderr, "%s: Can't map %s: %s\n", |
Prafulla Wadaskar | 89a4d6b | 2009-08-19 17:36:46 +0530 | [diff] [blame] | 492 | params.cmdname, params.imagefile, strerror(errno)); |
wdenk | 5b1d713 | 2002-11-03 00:07:02 +0000 | [diff] [blame] | 493 | exit (EXIT_FAILURE); |
| 494 | } |
| 495 | |
Prafulla Wadaskar | 89a4d6b | 2009-08-19 17:36:46 +0530 | [diff] [blame] | 496 | /* Setup the image header as per input image type*/ |
| 497 | if (tparams->set_header) |
| 498 | tparams->set_header (ptr, &sbuf, ifd, ¶ms); |
| 499 | else { |
| 500 | fprintf (stderr, "%s: Can't set header for %s: %s\n", |
| 501 | params.cmdname, tparams->name, strerror(errno)); |
| 502 | exit (EXIT_FAILURE); |
| 503 | } |
wdenk | 5b1d713 | 2002-11-03 00:07:02 +0000 | [diff] [blame] | 504 | |
Prafulla Wadaskar | 89a4d6b | 2009-08-19 17:36:46 +0530 | [diff] [blame] | 505 | /* Print the image information by processing image header */ |
| 506 | if (tparams->print_header) |
| 507 | tparams->print_header (ptr); |
| 508 | else { |
| 509 | fprintf (stderr, "%s: Can't print header for %s: %s\n", |
| 510 | params.cmdname, tparams->name, strerror(errno)); |
| 511 | exit (EXIT_FAILURE); |
| 512 | } |
wdenk | 5b1d713 | 2002-11-03 00:07:02 +0000 | [diff] [blame] | 513 | |
| 514 | (void) munmap((void *)ptr, sbuf.st_size); |
| 515 | |
| 516 | /* We're a bit of paranoid */ |
Prafulla Wadaskar | 89a4d6b | 2009-08-19 17:36:46 +0530 | [diff] [blame] | 517 | #if defined(_POSIX_SYNCHRONIZED_IO) && \ |
| 518 | !defined(__sun__) && \ |
| 519 | !defined(__FreeBSD__) && \ |
| 520 | !defined(__APPLE__) |
wdenk | 5b1d713 | 2002-11-03 00:07:02 +0000 | [diff] [blame] | 521 | (void) fdatasync (ifd); |
| 522 | #else |
| 523 | (void) fsync (ifd); |
| 524 | #endif |
| 525 | |
| 526 | if (close(ifd)) { |
| 527 | fprintf (stderr, "%s: Write error on %s: %s\n", |
Prafulla Wadaskar | 89a4d6b | 2009-08-19 17:36:46 +0530 | [diff] [blame] | 528 | params.cmdname, params.imagefile, strerror(errno)); |
wdenk | 5b1d713 | 2002-11-03 00:07:02 +0000 | [diff] [blame] | 529 | exit (EXIT_FAILURE); |
| 530 | } |
| 531 | |
| 532 | exit (EXIT_SUCCESS); |
| 533 | } |
| 534 | |
| 535 | static void |
| 536 | copy_file (int ifd, const char *datafile, int pad) |
| 537 | { |
| 538 | int dfd; |
| 539 | struct stat sbuf; |
| 540 | unsigned char *ptr; |
| 541 | int tail; |
| 542 | int zero = 0; |
Stefano Babic | 9bac0bb | 2013-08-19 19:03:19 +0200 | [diff] [blame] | 543 | uint8_t zeros[4096]; |
wdenk | 5b1d713 | 2002-11-03 00:07:02 +0000 | [diff] [blame] | 544 | int offset = 0; |
| 545 | int size; |
Prafulla Wadaskar | 89a4d6b | 2009-08-19 17:36:46 +0530 | [diff] [blame] | 546 | struct image_type_params *tparams = mkimage_get_type (params.type); |
wdenk | 5b1d713 | 2002-11-03 00:07:02 +0000 | [diff] [blame] | 547 | |
Stefano Babic | 9bac0bb | 2013-08-19 19:03:19 +0200 | [diff] [blame] | 548 | if (pad >= sizeof(zeros)) { |
| 549 | fprintf(stderr, "%s: Can't pad to %d\n", |
| 550 | params.cmdname, pad); |
| 551 | exit(EXIT_FAILURE); |
| 552 | } |
| 553 | |
| 554 | memset(zeros, 0, sizeof(zeros)); |
| 555 | |
Prafulla Wadaskar | 89a4d6b | 2009-08-19 17:36:46 +0530 | [diff] [blame] | 556 | if (params.vflag) { |
wdenk | 5b1d713 | 2002-11-03 00:07:02 +0000 | [diff] [blame] | 557 | fprintf (stderr, "Adding Image %s\n", datafile); |
| 558 | } |
| 559 | |
wdenk | ef1464c | 2003-10-08 22:14:02 +0000 | [diff] [blame] | 560 | if ((dfd = open(datafile, O_RDONLY|O_BINARY)) < 0) { |
wdenk | 5b1d713 | 2002-11-03 00:07:02 +0000 | [diff] [blame] | 561 | fprintf (stderr, "%s: Can't open %s: %s\n", |
Prafulla Wadaskar | 89a4d6b | 2009-08-19 17:36:46 +0530 | [diff] [blame] | 562 | params.cmdname, datafile, strerror(errno)); |
wdenk | 5b1d713 | 2002-11-03 00:07:02 +0000 | [diff] [blame] | 563 | exit (EXIT_FAILURE); |
| 564 | } |
| 565 | |
| 566 | if (fstat(dfd, &sbuf) < 0) { |
| 567 | fprintf (stderr, "%s: Can't stat %s: %s\n", |
Prafulla Wadaskar | 89a4d6b | 2009-08-19 17:36:46 +0530 | [diff] [blame] | 568 | params.cmdname, datafile, strerror(errno)); |
wdenk | 5b1d713 | 2002-11-03 00:07:02 +0000 | [diff] [blame] | 569 | exit (EXIT_FAILURE); |
| 570 | } |
| 571 | |
Mike Frysinger | fa956fd | 2008-05-01 04:13:05 -0400 | [diff] [blame] | 572 | ptr = mmap(0, sbuf.st_size, PROT_READ, MAP_SHARED, dfd, 0); |
| 573 | if (ptr == MAP_FAILED) { |
wdenk | 5b1d713 | 2002-11-03 00:07:02 +0000 | [diff] [blame] | 574 | fprintf (stderr, "%s: Can't read %s: %s\n", |
Prafulla Wadaskar | 89a4d6b | 2009-08-19 17:36:46 +0530 | [diff] [blame] | 575 | params.cmdname, datafile, strerror(errno)); |
wdenk | 5b1d713 | 2002-11-03 00:07:02 +0000 | [diff] [blame] | 576 | exit (EXIT_FAILURE); |
| 577 | } |
| 578 | |
Prafulla Wadaskar | 89a4d6b | 2009-08-19 17:36:46 +0530 | [diff] [blame] | 579 | if (params.xflag) { |
wdenk | 5b1d713 | 2002-11-03 00:07:02 +0000 | [diff] [blame] | 580 | unsigned char *p = NULL; |
| 581 | /* |
| 582 | * XIP: do not append the image_header_t at the |
| 583 | * beginning of the file, but consume the space |
| 584 | * reserved for it. |
| 585 | */ |
| 586 | |
Prafulla Wadaskar | 89a4d6b | 2009-08-19 17:36:46 +0530 | [diff] [blame] | 587 | if ((unsigned)sbuf.st_size < tparams->header_size) { |
wdenk | 5b1d713 | 2002-11-03 00:07:02 +0000 | [diff] [blame] | 588 | fprintf (stderr, |
| 589 | "%s: Bad size: \"%s\" is too small for XIP\n", |
Prafulla Wadaskar | 89a4d6b | 2009-08-19 17:36:46 +0530 | [diff] [blame] | 590 | params.cmdname, datafile); |
wdenk | 5b1d713 | 2002-11-03 00:07:02 +0000 | [diff] [blame] | 591 | exit (EXIT_FAILURE); |
| 592 | } |
| 593 | |
Prafulla Wadaskar | 89a4d6b | 2009-08-19 17:36:46 +0530 | [diff] [blame] | 594 | for (p = ptr; p < ptr + tparams->header_size; p++) { |
wdenk | 5b1d713 | 2002-11-03 00:07:02 +0000 | [diff] [blame] | 595 | if ( *p != 0xff ) { |
| 596 | fprintf (stderr, |
| 597 | "%s: Bad file: \"%s\" has invalid buffer for XIP\n", |
Prafulla Wadaskar | 89a4d6b | 2009-08-19 17:36:46 +0530 | [diff] [blame] | 598 | params.cmdname, datafile); |
wdenk | 5b1d713 | 2002-11-03 00:07:02 +0000 | [diff] [blame] | 599 | exit (EXIT_FAILURE); |
| 600 | } |
| 601 | } |
| 602 | |
Prafulla Wadaskar | 89a4d6b | 2009-08-19 17:36:46 +0530 | [diff] [blame] | 603 | offset = tparams->header_size; |
wdenk | 5b1d713 | 2002-11-03 00:07:02 +0000 | [diff] [blame] | 604 | } |
| 605 | |
| 606 | size = sbuf.st_size - offset; |
| 607 | if (write(ifd, ptr + offset, size) != size) { |
| 608 | fprintf (stderr, "%s: Write error on %s: %s\n", |
Prafulla Wadaskar | 89a4d6b | 2009-08-19 17:36:46 +0530 | [diff] [blame] | 609 | params.cmdname, params.imagefile, strerror(errno)); |
wdenk | 5b1d713 | 2002-11-03 00:07:02 +0000 | [diff] [blame] | 610 | exit (EXIT_FAILURE); |
| 611 | } |
| 612 | |
Stefano Babic | 9bac0bb | 2013-08-19 19:03:19 +0200 | [diff] [blame] | 613 | tail = size % 4; |
| 614 | if ((pad == 1) && (tail != 0)) { |
wdenk | 5b1d713 | 2002-11-03 00:07:02 +0000 | [diff] [blame] | 615 | |
| 616 | if (write(ifd, (char *)&zero, 4-tail) != 4-tail) { |
| 617 | fprintf (stderr, "%s: Write error on %s: %s\n", |
Prafulla Wadaskar | 89a4d6b | 2009-08-19 17:36:46 +0530 | [diff] [blame] | 618 | params.cmdname, params.imagefile, |
| 619 | strerror(errno)); |
wdenk | 5b1d713 | 2002-11-03 00:07:02 +0000 | [diff] [blame] | 620 | exit (EXIT_FAILURE); |
| 621 | } |
Stefano Babic | 9bac0bb | 2013-08-19 19:03:19 +0200 | [diff] [blame] | 622 | } else if (pad > 1) { |
| 623 | if (write(ifd, (char *)&zeros, pad) != pad) { |
| 624 | fprintf(stderr, "%s: Write error on %s: %s\n", |
| 625 | params.cmdname, params.imagefile, |
| 626 | strerror(errno)); |
| 627 | exit(EXIT_FAILURE); |
| 628 | } |
wdenk | 5b1d713 | 2002-11-03 00:07:02 +0000 | [diff] [blame] | 629 | } |
| 630 | |
| 631 | (void) munmap((void *)ptr, sbuf.st_size); |
| 632 | (void) close (dfd); |
| 633 | } |
| 634 | |
| 635 | void |
| 636 | usage () |
| 637 | { |
| 638 | fprintf (stderr, "Usage: %s -l image\n" |
Bartlomiej Sieka | 9d25438 | 2008-03-11 12:34:47 +0100 | [diff] [blame] | 639 | " -l ==> list image header information\n", |
Prafulla Wadaskar | 89a4d6b | 2009-08-19 17:36:46 +0530 | [diff] [blame] | 640 | params.cmdname); |
Bartlomiej Sieka | 9d25438 | 2008-03-11 12:34:47 +0100 | [diff] [blame] | 641 | fprintf (stderr, " %s [-x] -A arch -O os -T type -C comp " |
| 642 | "-a addr -e ep -n name -d data_file[:data_file...] image\n" |
| 643 | " -A ==> set architecture to 'arch'\n" |
wdenk | 5b1d713 | 2002-11-03 00:07:02 +0000 | [diff] [blame] | 644 | " -O ==> set operating system to 'os'\n" |
| 645 | " -T ==> set image type to 'type'\n" |
| 646 | " -C ==> set compression type 'comp'\n" |
| 647 | " -a ==> set load address to 'addr' (hex)\n" |
| 648 | " -e ==> set entry point to 'ep' (hex)\n" |
| 649 | " -n ==> set image name to 'name'\n" |
| 650 | " -d ==> use image data from 'datafile'\n" |
Bartlomiej Sieka | 9d25438 | 2008-03-11 12:34:47 +0100 | [diff] [blame] | 651 | " -x ==> set XIP (execute in place)\n", |
Prafulla Wadaskar | 89a4d6b | 2009-08-19 17:36:46 +0530 | [diff] [blame] | 652 | params.cmdname); |
Simon Glass | 95d77b4 | 2013-06-13 15:10:05 -0700 | [diff] [blame] | 653 | fprintf(stderr, " %s [-D dtc_options] [-f fit-image.its|-F] fit-image\n", |
Prafulla Wadaskar | 89a4d6b | 2009-08-19 17:36:46 +0530 | [diff] [blame] | 654 | params.cmdname); |
Simon Glass | 80e4df8 | 2013-06-13 15:10:03 -0700 | [diff] [blame] | 655 | fprintf(stderr, " -D => set options for device tree compiler\n" |
| 656 | " -f => input filename for FIT source\n"); |
| 657 | #ifdef CONFIG_FIT_SIGNATURE |
Simon Glass | 399c744 | 2013-06-13 15:10:07 -0700 | [diff] [blame] | 658 | fprintf(stderr, "Signing / verified boot options: [-k keydir] [-K dtb] [ -c <comment>] [-r]\n" |
Simon Glass | e29495d | 2013-06-13 15:10:04 -0700 | [diff] [blame] | 659 | " -k => set directory containing private keys\n" |
Simon Glass | 95d77b4 | 2013-06-13 15:10:05 -0700 | [diff] [blame] | 660 | " -K => write public keys to this .dtb file\n" |
Simon Glass | 4f61042 | 2013-06-13 15:10:06 -0700 | [diff] [blame] | 661 | " -c => add comment in signature node\n" |
Simon Glass | 399c744 | 2013-06-13 15:10:07 -0700 | [diff] [blame] | 662 | " -F => re-sign existing FIT image\n" |
| 663 | " -r => mark keys used as 'required' in dtb\n"); |
Simon Glass | 80e4df8 | 2013-06-13 15:10:03 -0700 | [diff] [blame] | 664 | #else |
| 665 | fprintf(stderr, "Signing / verified boot not supported (CONFIG_FIT_SIGNATURE undefined)\n"); |
| 666 | #endif |
Wolfgang Denk | 976b38c | 2011-02-12 10:37:11 +0100 | [diff] [blame] | 667 | fprintf (stderr, " %s -V ==> print version information and exit\n", |
| 668 | params.cmdname); |
Bartlomiej Sieka | 9d25438 | 2008-03-11 12:34:47 +0100 | [diff] [blame] | 669 | |
wdenk | 5b1d713 | 2002-11-03 00:07:02 +0000 | [diff] [blame] | 670 | exit (EXIT_FAILURE); |
| 671 | } |