X-Git-Url: https://git.kernelconcepts.de/?a=blobdiff_plain;f=tools%2Fmkimage.c;h=e43b09f76612e58b26e07244929d2bc7c535b5fe;hb=612404c28a64a6df300642a1550a65dcc8e01f82;hp=7215d0f2ea97b6b4a0557c2a7d64672524142e7a;hpb=7816f2cf813326505970922021b3ed6490863e78;p=karo-tx-uboot.git diff --git a/tools/mkimage.c b/tools/mkimage.c index 7215d0f2ea..e43b09f766 100644 --- a/tools/mkimage.c +++ b/tools/mkimage.c @@ -39,6 +39,7 @@ struct mkimage_params params = { .comp = IH_COMP_GZIP, .dtc = MKIMAGE_DEFAULT_DTC_OPTIONS, .imagename = "", + .imagename2 = "", }; /* @@ -150,16 +151,22 @@ main (int argc, char **argv) int retval = 0; struct image_type_params *tparams = NULL; + /* Init Freescale PBL Boot image generation/list support */ + init_pbl_image_type(); /* Init Kirkwood Boot image generation/list support */ init_kwb_image_type (); /* Init Freescale imx Boot image generation/list support */ init_imx_image_type (); /* Init FIT image generation/list support */ init_fit_image_type (); + /* Init TI OMAP Boot image generation/list support */ + init_omap_image_type(); /* Init Default image generation/list support */ init_default_image_type (); /* Init Davinci UBL support */ init_ubl_image_type(); + /* Init Davinci AIS support */ + init_ais_image_type(); params.cmdname = *argv; params.addr = params.ep = 0; @@ -246,6 +253,18 @@ main (int argc, char **argv) usage (); params.imagename = *++argv; goto NXTARG; + case 'R': + if (--argc <= 0) + usage(); + /* + * This entry is for the second configuration + * file, if only one is not enough. + */ + params.imagename2 = *++argv; + goto NXTARG; + case 's': + params.skipcpy = 1; + break; case 'v': params.vflag++; break; @@ -359,11 +378,15 @@ NXTARG: ; } /* - * Must be -w then: - * - * write dummy header, to be fixed later + * In case there an header with a variable + * length will be added, the corresponding + * function is called. This is responsible to + * allocate memory for the header itself. */ - memset (tparams->hdr, 0, tparams->header_size); + if (tparams->vrec_header) + tparams->vrec_header(¶ms, tparams); + else + memset(tparams->hdr, 0, tparams->header_size); if (write(ifd, tparams->hdr, tparams->header_size) != tparams->header_size) { @@ -372,63 +395,69 @@ NXTARG: ; exit (EXIT_FAILURE); } - if (params.type == IH_TYPE_MULTI || params.type == IH_TYPE_SCRIPT) { - char *file = params.datafile; - uint32_t size; - - for (;;) { - char *sep = NULL; - - if (file) { - if ((sep = strchr(file, ':')) != NULL) { - *sep = '\0'; + if (!params.skipcpy) { + if (params.type == IH_TYPE_MULTI || + params.type == IH_TYPE_SCRIPT) { + char *file = params.datafile; + uint32_t size; + + for (;;) { + char *sep = NULL; + + if (file) { + if ((sep = strchr(file, ':')) != NULL) { + *sep = '\0'; + } + + if (stat (file, &sbuf) < 0) { + fprintf (stderr, "%s: Can't stat %s: %s\n", + params.cmdname, file, strerror(errno)); + exit (EXIT_FAILURE); + } + size = cpu_to_uimage (sbuf.st_size); + } else { + size = 0; } - if (stat (file, &sbuf) < 0) { - fprintf (stderr, "%s: Can't stat %s: %s\n", - params.cmdname, file, strerror(errno)); + if (write(ifd, (char *)&size, sizeof(size)) != sizeof(size)) { + fprintf (stderr, "%s: Write error on %s: %s\n", + params.cmdname, params.imagefile, + strerror(errno)); exit (EXIT_FAILURE); } - size = cpu_to_uimage (sbuf.st_size); - } else { - size = 0; - } - if (write(ifd, (char *)&size, sizeof(size)) != sizeof(size)) { - fprintf (stderr, "%s: Write error on %s: %s\n", - params.cmdname, params.imagefile, - strerror(errno)); - exit (EXIT_FAILURE); - } + if (!file) { + break; + } - if (!file) { - break; + if (sep) { + *sep = ':'; + file = sep + 1; + } else { + file = NULL; + } } - if (sep) { - *sep = ':'; - file = sep + 1; - } else { - file = NULL; - } - } + file = params.datafile; - file = params.datafile; - - for (;;) { - char *sep = strchr(file, ':'); - if (sep) { - *sep = '\0'; - copy_file (ifd, file, 1); - *sep++ = ':'; - file = sep; - } else { - copy_file (ifd, file, 0); - break; + for (;;) { + char *sep = strchr(file, ':'); + if (sep) { + *sep = '\0'; + copy_file (ifd, file, 1); + *sep++ = ':'; + file = sep; + } else { + copy_file (ifd, file, 0); + break; + } } + } else if (params.type == IH_TYPE_PBLIMAGE) { + /* PBL has special Image format, implements its' own */ + pbl_load_uboot(ifd, ¶ms); + } else { + copy_file (ifd, params.datafile, 0); } - } else { - copy_file (ifd, params.datafile, 0); } /* We're a bit of paranoid */