summaryrefslogtreecommitdiffstats
path: root/tools/mkimage.c
diff options
context:
space:
mode:
authorWolfgang Denk <wd@denx.de>2009-12-05 02:11:59 +0100
committerWolfgang Denk <wd@denx.de>2009-12-05 02:11:59 +0100
commit2a49bf3149e34e6f910e70bbc0a26e81cfdbdf70 (patch)
treee19b3def6c8f41f56cdb5e8b71aa53d8f72f5812 /tools/mkimage.c
parentcd514aeb996e2f7aefbe1f78481965d9d074aed4 (diff)
parentf68ab43de67f59925542efb6bcec30f4a84fe695 (diff)
downloadbootable_bootloader_goldelico_gta04-2a49bf3149e34e6f910e70bbc0a26e81cfdbdf70.zip
bootable_bootloader_goldelico_gta04-2a49bf3149e34e6f910e70bbc0a26e81cfdbdf70.tar.gz
bootable_bootloader_goldelico_gta04-2a49bf3149e34e6f910e70bbc0a26e81cfdbdf70.tar.bz2
Merge branch 'master' into next
Conflicts: board/esd/plu405/plu405.c drivers/rtc/ftrtc010.c Signed-off-by: Wolfgang Denk <wd@denx.de>
Diffstat (limited to 'tools/mkimage.c')
-rw-r--r--tools/mkimage.c58
1 files changed, 33 insertions, 25 deletions
diff --git a/tools/mkimage.c b/tools/mkimage.c
index ab6ea32..6826eae 100644
--- a/tools/mkimage.c
+++ b/tools/mkimage.c
@@ -229,8 +229,15 @@ main (int argc, char **argv)
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;
goto NXTARG;
case 'n':
if (--argc <= 0)
@@ -292,23 +299,35 @@ NXTARG: ;
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(&params);
- 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) {
+ 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 || params.fflag) {
/*
* list header information of existing image
*/
@@ -346,17 +365,6 @@ NXTARG: ;
(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(&params);
-
- exit (retval);
}
/*