Skip to contentSkip to conversation

tools: mkimage: hdr_size used to facilitate customized support

PATCH Superseded Prafulla Wadaskar 2 participants 3 messages Jul 21, 2009 – Jul 22, 2009

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/4 tools: mkimage: hdr_size used to facilitate customized support

hdr_size variable is initialized
at the begining of image creation algorithm instead of reading it each time. This facilitate to use the common code for other image type implementations for ex. kwbimage

---
hdr_size declaration moved at the top

 tools/mkimage.c |   18 ++++++++----------
 1 files changed, 8 insertions(+), 10 deletions(-)
tools/mkimage.c +8 -10
index 967fe9a..40363a9 100644
@@ -66,6 +66,7 @@ main (int argc, char **argv)
 	struct stat sbuf;
 	unsigned char *ptr;
 	char *name = "";
+	int hdr_size;
 
 	cmdname = *argv;
 
@@ -250,9 +251,9 @@ NXTARG:		;
 	 *
 	 * write dummy header, to be fixed later
 	 */
-	memset (hdr, 0, image_get_header_size ());
-
-	if (write(ifd, hdr, image_get_header_size ()) != image_get_header_size ()) {
+	hdr_size = image_get_header_size ();
+	memset (hdr, 0, hdr_size);
+	if (write(ifd, hdr, hdr_size) != hdr_size) {
 		fprintf (stderr, "%s: Write error on %s: %s\n",
 			cmdname, imagefile, strerror(errno));
 		exit (EXIT_FAILURE);
@@ -339,14 +340,12 @@ NXTARG:		;
 	hdr = (image_header_t *)ptr;
 
 	checksum = crc32 (0,
-			  (const char *)(ptr + image_get_header_size ()),
-			  sbuf.st_size - image_get_header_size ()
-			 );
-
+			(const char *)(ptr + hdr_size),
+			sbuf.st_size - hdr_size);
 	/* Build new header */
 	image_set_magic (hdr, IH_MAGIC);
 	image_set_time (hdr, sbuf.st_mtime);
-	image_set_size (hdr, sbuf.st_size - image_get_header_size ());
+	image_set_size (hdr, sbuf.st_size - hdr_size);
 	image_set_load (hdr, addr);
 	image_set_ep (hdr, ep);
 	image_set_dcrc (hdr, checksum);
@@ -354,10 +353,9 @@ NXTARG:		;
 	image_set_arch (hdr, opt_arch);
 	image_set_type (hdr, opt_type);
 	image_set_comp (hdr, opt_comp);
-
 	image_set_name (hdr, name);
 
-	checksum = crc32 (0, (const char *)hdr, image_get_header_size ());
+	checksum = crc32 (0, (const char *)hdr, hdr_size);
 
 	image_set_hcrc (hdr, checksum);
 
Signature · 1 line
1.5.3.4
#1 lore raw

PATCH v2 1/4 tools: mkimage: hdr_size used to facilitate customized support

Dear Prafulla Wadaskar,

Quoted 8 lines · In message <[email protected]> you wrote:

hdr_size variable is initialized
at the begining of image creation algorithm instead of reading it each time. This facilitate to use the common code for other image type implementations for ex. kwbimage

---
hdr_size declaration moved at the top

I received this patch 4 times? What's going on?

Best regards,

Wolfgang Denk

Signature · 8 lines
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
In the beginning, I was made. I didn't ask to be made. No one consul-
ted with me or considered my feelings  in  this  matter.  But  if  it
brought  some  passing fancy to some lowly humans as they haphazardly
pranced their way through life's mournful jungle, then so be it.
- Marvin the Paranoid Android
#2 lore raw

PATCH v2 1/4 tools: mkimage: hdr_size used to facilitate customized support

Quoted 11 lines

-----Original Message-----
From: Wolfgang Denk [mailto:wd at denx.de]
Sent: Wednesday, July 22, 2009 2:48 PM
To: Prafulla Wadaskar
Cc: u-boot at lists.denx.de; Ashish Karkare
Subject: Re: [U-Boot] [PATCH v2 1/4] tools: mkimage: hdr_size used to facilitate customized support

Quoted 1 line

I received this patch 4 times? What's going on?

Sorry for that, I send it 4 times because
after git-send Status was okay but I could not
see its post on http://lists.denx.de/pipermail/u-boot/2009-July/date.html
And pending email in my mailq for hours..

Regards..
Prafulla . .