From c81296c16fd9d12422c9968cc0f1d9bf440a7d88 Mon Sep 17 00:00:00 2001 From: Peter Tyser Date: Tue, 24 Nov 2009 16:42:10 -0600 Subject: tools/mkimage: Print FIT image contents after creation 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@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@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@1' Configuration 0 (config@1) Description: Default Linux kernel Kernel: kernel@1 FDT: fdt@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 --- tools/mkimage.c | 51 ++++++++++++++++++++++++++------------------------- 1 file changed, 26 insertions(+), 25 deletions(-) (limited to 'tools/mkimage.c') diff --git a/tools/mkimage.c b/tools/mkimage.c index 2bf9a5b5eb..6826eae771 100644 --- a/tools/mkimage.c +++ b/tools/mkimage.c @@ -299,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(¶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 */ @@ -352,17 +364,6 @@ NXTARG: ; (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); } -- cgit v1.2.1