.type = IH_TYPE_KERNEL,
.comp = IH_COMP_GZIP,
.dtc = MKIMAGE_DEFAULT_DTC_OPTIONS,
+ .imagename = "",
};
/*
{
int ifd = -1;
struct stat sbuf;
- unsigned char *ptr;
+ char *ptr;
int retval = 0;
struct image_type_params *tparams = NULL;
/* 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 Default image generation/list support */
case 'a':
if (--argc <= 0)
usage ();
- params.addr = strtoul (*++argv,
- (char **)&ptr, 16);
+ params.addr = strtoul (*++argv, &ptr, 16);
if (*ptr) {
fprintf (stderr,
"%s: invalid load address %s\n",
case 'e':
if (--argc <= 0)
usage ();
- params.ep = strtoul (*++argv,
- (char **)&ptr, 16);
+ params.ep = strtoul (*++argv, &ptr, 16);
if (*ptr) {
fprintf (stderr,
"%s: invalid entry point %s\n",
case 'f':
if (--argc <= 0)
usage ();
- params.type = IH_TYPE_FLATDT;
- params.datafile = *++argv;
- params.fflag = 1;
-
/*
* The flattened image tree (FIT) format
* requires a flattened device tree image type
*/
params.type = IH_TYPE_FLATDT;
+ params.datafile = *++argv;
+ params.fflag = 1;
goto NXTARG;
case 'n':
if (--argc <= 0)
params.ep += tparams->header_size;
}
- /*
- * If XIP, ensure the entry point is equal to the load address plus
- * the size of the U-Boot header.
- */
- if (params.xflag) {
- if (params.ep != params.addr + tparams->header_size) {
- fprintf (stderr,
- "%s: For XIP, the entry point must be the load addr + %lu\n",
- params.cmdname,
- (unsigned long)tparams->header_size);
- exit (EXIT_FAILURE);
- }
- }
-
params.imagefile = *argv;
- if (!params.fflag){
- if (params.lflag) {
- ifd = open (params.imagefile, O_RDONLY|O_BINARY);
- } else {
- ifd = open (params.imagefile,
- O_RDWR|O_CREAT|O_TRUNC|O_BINARY, 0666);
- }
+ if (params.fflag){
+ if (tparams->fflag_handle)
+ /*
+ * in some cases, some additional processing needs
+ * to be done if fflag is defined
+ *
+ * For ex. fit_handle_file for Fit file support
+ */
+ retval = tparams->fflag_handle(¶ms);
- if (ifd < 0) {
- fprintf (stderr, "%s: Can't open %s: %s\n",
- params.cmdname, params.imagefile,
- strerror(errno));
- exit (EXIT_FAILURE);
- }
+ if (retval != EXIT_SUCCESS)
+ exit (retval);
+ }
+
+ if (params.lflag || params.fflag) {
+ ifd = open (params.imagefile, O_RDONLY|O_BINARY);
+ } else {
+ ifd = open (params.imagefile,
+ O_RDWR|O_CREAT|O_TRUNC|O_BINARY, 0666);
+ }
+
+ if (ifd < 0) {
+ fprintf (stderr, "%s: Can't open %s: %s\n",
+ params.cmdname, params.imagefile,
+ strerror(errno));
+ exit (EXIT_FAILURE);
}
- if (params.lflag) {
+ if (params.lflag || params.fflag) {
/*
* list header information of existing image
*/
(void) munmap((void *)ptr, sbuf.st_size);
(void) close (ifd);
- exit (retval);
- } else if (params.fflag) {
- if (tparams->fflag_handle)
- /*
- * in some cases, some additional processing needs
- * to be done if fflag is defined
- *
- * For ex. fit_handle_file for Fit file support
- */
- retval = tparams->fflag_handle(¶ms);
-
exit (retval);
}