[U-Boot] [PATCH 3/3] tools/mkimage: Print FIT image contents after creation

Peter Tyser ptyser at xes-inc.com
Tue Nov 24 23:42:10 CET 2009


Previously, there was no indication to the user that a FIT image was
successfully created after executing mkimage.  For example:

  $ mkimage -f uImage.its uImage.itb
  DTC: dts->dtb  on file "uImage.its"

Adding some additional output after creating a FIT image lets the user
know exactly what is contained in their image, eg:

  $ mkimage -f uImage.its uImage.itb
  DTC: dts->dtb  on file "uImage.its"
  FIT description: Linux kernel 2.6.32-rc7-00201-g7550d6f-dirty
  Created:         Tue Nov 24 15:43:01 2009
   Image 0 (kernel at 1)
    Description:  Linux Kernel 2.6.32-rc7-00201-g7550d6f-dirty
    Type:         Kernel Image
    Compression:  gzip compressed
    Data Size:    2707311 Bytes = 2643.86 kB = 2.58 MB
    Architecture: PowerPC
    OS:           Linux
    Load Address: 0x00000000
    Entry Point:  0x00000000
    Hash algo:    crc32
    Hash value:   efe0798b
    Hash algo:    sha1
    Hash value:   ecafba8c95684f2c8fec67e33c41ec88df1534d7
   Image 1 (fdt at 1)
    Description:  Flattened Device Tree blob
    Type:         Flat Device Tree
    Compression:  uncompressed
    Data Size:    12288 Bytes = 12.00 kB = 0.01 MB
    Architecture: PowerPC
    Hash algo:    crc32
    Hash value:   a5cab676
    Hash algo:    sha1
    Hash value:   168722b13e305283cfd6603dfe8248cc329adea6
   Default Configuration: 'config at 1'
   Configuration 0 (config at 1)
    Description:  Default Linux kernel
    Kernel:       kernel at 1
    FDT:          fdt at 1

This brings the behavior of creating a FIT image in line with creating a
standard uImage, which also prints out the uImage contents after
creation.

Signed-off-by: Peter Tyser <ptyser at xes-inc.com>
---
 tools/mkimage.c |   51 ++++++++++++++++++++++++++-------------------------
 1 files changed, 26 insertions(+), 25 deletions(-)

diff --git a/tools/mkimage.c b/tools/mkimage.c
index 07a9a6f..5a82b4e 100644
--- a/tools/mkimage.c
+++ b/tools/mkimage.c
@@ -298,23 +298,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
 		 */
@@ -352,17 +364,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);
 	}
 
 	/*
-- 
1.6.2.1



More information about the U-Boot mailing list