summaryrefslogtreecommitdiff
path: root/tools/mkimage.c
diff options
context:
space:
mode:
authorMinkyu Kang <mk7.kang@samsung.com>2010-01-15 22:41:58 +0900
committerMinkyu Kang <mk7.kang@samsung.com>2010-01-15 22:41:58 +0900
commite598dfc22c8789991d165714bec53b2390fc999d (patch)
treecf3c704c4b00e06605bdfe23384b8af97022efa6 /tools/mkimage.c
parente7ae13a57b4cbaa2cd3da8ffca614853d9d84230 (diff)
parent1c2a8e359ebbec0dbef62f5b54c72f9cd72ccd59 (diff)
downloadu-boot-imx-e598dfc22c8789991d165714bec53b2390fc999d.zip
u-boot-imx-e598dfc22c8789991d165714bec53b2390fc999d.tar.gz
u-boot-imx-e598dfc22c8789991d165714bec53b2390fc999d.tar.bz2
Merge branch 'master' of git://git.denx.de/u-boot-arm
Conflicts: cpu/arm_cortexa8/s5pc1xx/cache.c include/asm-arm/arch-s5pc1xx/sys_proto.h include/sja1000.h Signed-off-by: Minkyu Kang <mk7.kang@samsung.com>
Diffstat (limited to 'tools/mkimage.c')
-rw-r--r--tools/mkimage.c56
1 files changed, 31 insertions, 25 deletions
diff --git a/tools/mkimage.c b/tools/mkimage.c
index ab6ea32..1bed933 100644
--- a/tools/mkimage.c
+++ b/tools/mkimage.c
@@ -229,6 +229,11 @@ main (int argc, char **argv)
case 'f':
if (--argc <= 0)
usage ();
+ /*
+ * 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;
@@ -292,23 +297,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 || 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
*/
@@ -346,17 +363,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);
}
/*