All of lore.kernel.org
 help / color / mirror / Atom feed
* [U-Boot] [PATCH 1/3] tools/mkimage: Assume FDT image type for FIT images
@ 2009-11-24 22:42 Peter Tyser
  2009-11-24 22:42 ` [U-Boot] [PATCH 2/3] tools/fit_image.c: Remove unused fit_set_header() Peter Tyser
                   ` (3 more replies)
  0 siblings, 4 replies; 9+ messages in thread
From: Peter Tyser @ 2009-11-24 22:42 UTC (permalink / raw)
  To: u-boot

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 <ptyser@xes-inc.com>
---
Ideally this patch would make it into the upcoming release as its a
regression.  I don't really care when 2/3 and 3/3 are applied, they
aren't really bug fixes.

 tools/mkimage.c |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/tools/mkimage.c b/tools/mkimage.c
index ab6ea32..07a9a6f 100644
--- a/tools/mkimage.c
+++ b/tools/mkimage.c
@@ -231,6 +231,12 @@ main (int argc, char **argv)
 					usage ();
 				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)
-- 
1.6.2.1

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [U-Boot] [PATCH 2/3] tools/fit_image.c: Remove unused fit_set_header()
  2009-11-24 22:42 [U-Boot] [PATCH 1/3] tools/mkimage: Assume FDT image type for FIT images Peter Tyser
@ 2009-11-24 22:42 ` Peter Tyser
  2009-12-05  0:11   ` Wolfgang Denk
  2009-11-24 22:42 ` [U-Boot] [PATCH 3/3] tools/mkimage: Print FIT image contents after creation Peter Tyser
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 9+ messages in thread
From: Peter Tyser @ 2009-11-24 22:42 UTC (permalink / raw)
  To: u-boot

The FIT fit_set_header() function was copied from the standard uImage's
image_set_header() function during mkimage reorganization.  However, the
fit_set_header() function is not used since FIT images use a standard
device tree blob header.

Signed-off-by: Peter Tyser <ptyser@xes-inc.com>
---
 tools/fit_image.c |   34 +---------------------------------
 1 files changed, 1 insertions(+), 33 deletions(-)

diff --git a/tools/fit_image.c b/tools/fit_image.c
index d1e612f..ef9ffee 100644
--- a/tools/fit_image.c
+++ b/tools/fit_image.c
@@ -155,38 +155,6 @@ static int fit_handle_file (struct mkimage_params *params)
 	return (EXIT_SUCCESS);
 }
 
-static void fit_set_header (void *ptr, struct stat *sbuf, int ifd,
-				struct mkimage_params *params)
-{
-	uint32_t checksum;
-
-	image_header_t * hdr = (image_header_t *)ptr;
-
-	checksum = crc32 (0,
-			(const unsigned char *)(ptr +
-				sizeof(image_header_t)),
-			sbuf->st_size - sizeof(image_header_t));
-
-	/* Build new header */
-	image_set_magic (hdr, IH_MAGIC);
-	image_set_time (hdr, sbuf->st_mtime);
-	image_set_size (hdr, sbuf->st_size - sizeof(image_header_t));
-	image_set_load (hdr, params->addr);
-	image_set_ep (hdr, params->ep);
-	image_set_dcrc (hdr, checksum);
-	image_set_os (hdr, params->os);
-	image_set_arch (hdr, params->arch);
-	image_set_type (hdr, params->type);
-	image_set_comp (hdr, params->comp);
-
-	image_set_name (hdr, params->imagename);
-
-	checksum = crc32 (0, (const unsigned char *)hdr,
-				sizeof(image_header_t));
-
-	image_set_hcrc (hdr, checksum);
-}
-
 static int fit_check_params (struct mkimage_params *params)
 {
 	return	((params->dflag && (params->fflag || params->lflag)) ||
@@ -202,7 +170,7 @@ static struct image_type_params fitimage_params = {
 	.print_header = fit_print_contents,
 	.check_image_type = fit_check_image_types,
 	.fflag_handle = fit_handle_file,
-	.set_header = fit_set_header,
+	.set_header = NULL,	/* FIT images use DTB header */
 	.check_params = fit_check_params,
 };
 
-- 
1.6.2.1

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [U-Boot] [PATCH 3/3] tools/mkimage: Print FIT image contents after creation
  2009-11-24 22:42 [U-Boot] [PATCH 1/3] tools/mkimage: Assume FDT image type for FIT images Peter Tyser
  2009-11-24 22:42 ` [U-Boot] [PATCH 2/3] tools/fit_image.c: Remove unused fit_set_header() Peter Tyser
@ 2009-11-24 22:42 ` Peter Tyser
  2009-12-05  0:14   ` Wolfgang Denk
  2009-11-25  8:55 ` [U-Boot] [PATCH 1/3] tools/mkimage: Assume FDT image type for FIT images Stefano Babic
  2009-12-05  0:13 ` Wolfgang Denk
  3 siblings, 1 reply; 9+ messages in thread
From: Peter Tyser @ 2009-11-24 22:42 UTC (permalink / raw)
  To: u-boot

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@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

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [U-Boot] [PATCH 1/3] tools/mkimage: Assume FDT image type for FIT images
  2009-11-24 22:42 [U-Boot] [PATCH 1/3] tools/mkimage: Assume FDT image type for FIT images Peter Tyser
  2009-11-24 22:42 ` [U-Boot] [PATCH 2/3] tools/fit_image.c: Remove unused fit_set_header() Peter Tyser
  2009-11-24 22:42 ` [U-Boot] [PATCH 3/3] tools/mkimage: Print FIT image contents after creation Peter Tyser
@ 2009-11-25  8:55 ` Stefano Babic
  2009-12-05  0:13 ` Wolfgang Denk
  3 siblings, 0 replies; 9+ messages in thread
From: Stefano Babic @ 2009-11-25  8:55 UTC (permalink / raw)
  To: u-boot

Peter Tyser wrote:
> 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.

I have found that recent commit 6a590c5f5fd12cdd27f3153522acfac3854590e7
has already fix this issue.

Regards,
Stefano

-- 
=====================================================================
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-0 Fax: +49-8142-66989-80  Email: office at denx.de
=====================================================================

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [U-Boot] [PATCH 2/3] tools/fit_image.c: Remove unused fit_set_header()
  2009-11-24 22:42 ` [U-Boot] [PATCH 2/3] tools/fit_image.c: Remove unused fit_set_header() Peter Tyser
@ 2009-12-05  0:11   ` Wolfgang Denk
  0 siblings, 0 replies; 9+ messages in thread
From: Wolfgang Denk @ 2009-12-05  0:11 UTC (permalink / raw)
  To: u-boot

Dear Peter Tyser,

In message <1259102530-32071-2-git-send-email-ptyser@xes-inc.com> you wrote:
> The FIT fit_set_header() function was copied from the standard uImage's
> image_set_header() function during mkimage reorganization.  However, the
> fit_set_header() function is not used since FIT images use a standard
> device tree blob header.
> 
> Signed-off-by: Peter Tyser <ptyser@xes-inc.com>
> ---
>  tools/fit_image.c |   34 +---------------------------------
>  1 files changed, 1 insertions(+), 33 deletions(-)

Applied, thanks.

Best regards,

Wolfgang Denk

-- 
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
Those who hate and fight must stop themselves -- otherwise it is  not
stopped.
	-- Spock, "Day of the Dove", stardate unknown

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [U-Boot] [PATCH 1/3] tools/mkimage: Assume FDT image type for FIT images
  2009-11-24 22:42 [U-Boot] [PATCH 1/3] tools/mkimage: Assume FDT image type for FIT images Peter Tyser
                   ` (2 preceding siblings ...)
  2009-11-25  8:55 ` [U-Boot] [PATCH 1/3] tools/mkimage: Assume FDT image type for FIT images Stefano Babic
@ 2009-12-05  0:13 ` Wolfgang Denk
  2009-12-05  0:18   ` Peter Tyser
  3 siblings, 1 reply; 9+ messages in thread
From: Wolfgang Denk @ 2009-12-05  0:13 UTC (permalink / raw)
  To: u-boot

Dear Peter Tyser,

In message <1259102530-32071-1-git-send-email-ptyser@xes-inc.com> you wrote:
> 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 <ptyser@xes-inc.com>
> ---
> Ideally this patch would make it into the upcoming release as its a
> regression.  I don't really care when 2/3 and 3/3 are applied, they
> aren't really bug fixes.

Not really, but a nice cleanup is as good as a fix :-)

>  tools/mkimage.c |    6 ++++++
>  1 files changed, 6 insertions(+), 0 deletions(-)

Applied, thanks.

Best regards,

Wolfgang Denk

-- 
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
Never underestimate the power of human stupidity  when  it  comes  to
using technology they don't understand.

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [U-Boot] [PATCH 3/3] tools/mkimage: Print FIT image contents after creation
  2009-11-24 22:42 ` [U-Boot] [PATCH 3/3] tools/mkimage: Print FIT image contents after creation Peter Tyser
@ 2009-12-05  0:14   ` Wolfgang Denk
  0 siblings, 0 replies; 9+ messages in thread
From: Wolfgang Denk @ 2009-12-05  0:14 UTC (permalink / raw)
  To: u-boot

Dear Peter Tyser,

In message <1259102530-32071-3-git-send-email-ptyser@xes-inc.com> you wrote:
> 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@xes-inc.com>
> ---
>  tools/mkimage.c |   51 ++++++++++++++++++++++++++-------------------------
>  1 files changed, 26 insertions(+), 25 deletions(-)

Applied, thanks.

Best regards,

Wolfgang Denk

-- 
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
Some programming languages manage to  absorb  change,  but  withstand
progress.          -- Epigrams in Programming, ACM SIGPLAN Sept. 1982

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [U-Boot] [PATCH 1/3] tools/mkimage: Assume FDT image type for FIT images
  2009-12-05  0:13 ` Wolfgang Denk
@ 2009-12-05  0:18   ` Peter Tyser
  2009-12-05  0:51     ` Wolfgang Denk
  0 siblings, 1 reply; 9+ messages in thread
From: Peter Tyser @ 2009-12-05  0:18 UTC (permalink / raw)
  To: u-boot

On Sat, 2009-12-05 at 01:13 +0100, Wolfgang Denk wrote:
> Dear Peter Tyser,
> 
> In message <1259102530-32071-1-git-send-email-ptyser@xes-inc.com> you wrote:
> > 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 <ptyser@xes-inc.com>
> > ---
> > Ideally this patch would make it into the upcoming release as its a
> > regression.  I don't really care when 2/3 and 3/3 are applied, they
> > aren't really bug fixes.
> 
> Not really, but a nice cleanup is as good as a fix :-)
> 
> >  tools/mkimage.c |    6 ++++++
> >  1 files changed, 6 insertions(+), 0 deletions(-)
> 
> Applied, thanks.
> 
> Best regards,
> 
> Wolfgang Denk
> 

Hi Wolfgang,
Thanks for applying patches 2 and 3.  Stefano Babic noticed that this
change was already submitted by Remy and was merged in
6a590c5f5fd12cdd27f3153522acfac3854590e7, so 1/3 shouldn't be necessary.
My fix was nearly identical to Remy's I'm a bit surprised mine would
apply cleanly...

Thanks!
Peter

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [U-Boot] [PATCH 1/3] tools/mkimage: Assume FDT image type for FIT images
  2009-12-05  0:18   ` Peter Tyser
@ 2009-12-05  0:51     ` Wolfgang Denk
  0 siblings, 0 replies; 9+ messages in thread
From: Wolfgang Denk @ 2009-12-05  0:51 UTC (permalink / raw)
  To: u-boot

Dear Peter Tyser,

In message <1259972321.23828.13300.camel@localhost.localdomain> you wrote:
>
> Thanks for applying patches 2 and 3.  Stefano Babic noticed that this
> change was already submitted by Remy and was merged in
> 6a590c5f5fd12cdd27f3153522acfac3854590e7, so 1/3 shouldn't be necessary.
> My fix was nearly identical to Remy's I'm a bit surprised mine would
> apply cleanly...

Git seems to be clever :-)

Best regards,

Wolfgang Denk

-- 
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
The human race has one really effective weapon, and that is laughter.
                                                         - Mark Twain

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2009-12-05  0:51 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-11-24 22:42 [U-Boot] [PATCH 1/3] tools/mkimage: Assume FDT image type for FIT images Peter Tyser
2009-11-24 22:42 ` [U-Boot] [PATCH 2/3] tools/fit_image.c: Remove unused fit_set_header() Peter Tyser
2009-12-05  0:11   ` Wolfgang Denk
2009-11-24 22:42 ` [U-Boot] [PATCH 3/3] tools/mkimage: Print FIT image contents after creation Peter Tyser
2009-12-05  0:14   ` Wolfgang Denk
2009-11-25  8:55 ` [U-Boot] [PATCH 1/3] tools/mkimage: Assume FDT image type for FIT images Stefano Babic
2009-12-05  0:13 ` Wolfgang Denk
2009-12-05  0:18   ` Peter Tyser
2009-12-05  0:51     ` Wolfgang Denk

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.