From 6a590c5f5fd12cdd27f3153522acfac3854590e7 Mon Sep 17 00:00:00 2001 From: Remy Bohmer Date: Wed, 28 Oct 2009 22:13:35 +0100 Subject: Building of FIT images does not work. The type is not set for generation of the FIT images, resulting in no images being created without printing or returning an error Signed-off-by: Remy Bohmer --- tools/mkimage.c | 1 + 1 file changed, 1 insertion(+) (limited to 'tools/mkimage.c') diff --git a/tools/mkimage.c b/tools/mkimage.c index ab6ea32..8a20594 100644 --- a/tools/mkimage.c +++ b/tools/mkimage.c @@ -229,6 +229,7 @@ main (int argc, char **argv) case 'f': if (--argc <= 0) usage (); + params.type = IH_TYPE_FLATDT; params.datafile = *++argv; params.fflag = 1; goto NXTARG; -- cgit v1.1 From 1a99de2cb4d08eb3bf9fb3f60a9d533150de8c0e Mon Sep 17 00:00:00 2001 From: Peter Tyser Date: Tue, 24 Nov 2009 16:42:08 -0600 Subject: tools/mkimage: Assume FDT image type for FIT images When building a Flattened Image Tree (FIT) the image type needs to be "flat_dt". Commit 89a4d6b12fd6394898b8a454cbabeaf1cd59bae5 introduced a regression which caused the user to need to specify the "-T flat_dt" parameter on the command line when building a FIT image. The "-T flat_dt" parameter should not be needed and is at odds with the current FIT image documentation. Signed-off-by: Peter Tyser --- tools/mkimage.c | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'tools/mkimage.c') diff --git a/tools/mkimage.c b/tools/mkimage.c index 8a20594..2bf9a5b 100644 --- a/tools/mkimage.c +++ b/tools/mkimage.c @@ -232,6 +232,12 @@ main (int argc, char **argv) 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) -- cgit v1.1 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 2bf9a5b..6826eae 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 */ @@ -353,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(¶ms); - - exit (retval); } /* -- cgit v1.1 From fbc1c8f6f6c972524197829c56dd8f2f5da0200a Mon Sep 17 00:00:00 2001 From: Peter Tyser Date: Sun, 6 Dec 2009 01:33:24 -0600 Subject: tools/mkimage: Remove duplicate line of code Recent commits 1a99de2cb4d08eb3bf9fb3f60a9d533150de8c0e and 6a590c5f5fd12cdd27f3153522acfac3854590e7 both fixed the same bug in the same manner. Unfortunately git was "smart" enough to merge both changes which resulted in some duplicate code. Signed-off-by: Peter Tyser Reordered code and comment a bit. Signed-off-by: Wolfgang Denk --- tools/mkimage.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'tools/mkimage.c') diff --git a/tools/mkimage.c b/tools/mkimage.c index 6826eae..1bed933 100644 --- a/tools/mkimage.c +++ b/tools/mkimage.c @@ -229,15 +229,13 @@ 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; + params.datafile = *++argv; + params.fflag = 1; goto NXTARG; case 'n': if (--argc <= 0) -- cgit v1.1