From: Prafulla Wadaskar <prafulla@marvell.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 1/3] tools: mkimage: hdr_size used to facilitate customized support
Date: Sun, 19 Jul 2009 07:15:56 +0530 [thread overview]
Message-ID: <1247967958-4446-1-git-send-email-prafulla@marvell.com> (raw)
hdr_size variable is initialized
at the start 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
Signed-off-by: Prafulla Wadaskar <prafulla@marvell.com>
---
tools/mkimage.c | 18 ++++++++----------
1 files changed, 8 insertions(+), 10 deletions(-)
diff --git a/tools/mkimage.c b/tools/mkimage.c
index 967fe9a..c5b593c 100644
--- a/tools/mkimage.c
+++ b/tools/mkimage.c
@@ -250,9 +250,10 @@ 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 ()) {
+ int hdr_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);
--
1.5.3.4
next reply other threads:[~2009-07-19 1:45 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-07-19 1:45 Prafulla Wadaskar [this message]
2009-07-18 21:33 ` [U-Boot] [PATCH 1/3] tools: mkimage: hdr_size used to facilitate customized support Wolfgang Denk
2009-07-19 5:41 ` Prafulla Wadaskar
2009-07-19 1:45 ` [U-Boot] [PATCH 2/3] tools: mkimage (type=kwbimage) kirkwood boot image support Prafulla Wadaskar
2009-07-18 21:25 ` Jean-Christophe PLAGNIOL-VILLARD
2009-07-20 6:55 ` Prafulla Wadaskar
2009-07-18 22:02 ` Wolfgang Denk
2009-07-19 5:27 ` Prafulla Wadaskar
2009-07-20 6:24 ` Prafulla Wadaskar
2009-07-20 15:05 ` Wolfgang Denk
2009-07-20 14:57 ` Wolfgang Denk
2009-07-22 7:20 ` Prafulla Wadaskar
2009-07-19 1:45 ` [U-Boot] [PATCH 3/3] Kirkwood: Sheevaplug: kwimage configuration Prafulla Wadaskar
2009-07-18 21:26 ` Jean-Christophe PLAGNIOL-VILLARD
2009-07-19 4:41 ` Prafulla Wadaskar
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1247967958-4446-1-git-send-email-prafulla@marvell.com \
--to=prafulla@marvell.com \
--cc=u-boot@lists.denx.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox