[U-Boot] [PATCH 2/3] tools: mkimage (type=kwbimage) kirkwood boot image support

Prafulla Wadaskar prafulla at marvell.com
Mon Jul 20 08:24:08 CEST 2009


________________________________________
From: u-boot-bounces at lists.denx.de [u-boot-bounces at lists.denx.de] On Behalf Of Prafulla Wadaskar [prafulla at marvell.com]
Sent: Sunday, July 19, 2009 10:57 AM
To: Wolfgang Denk
Cc: Manas Saksena; Ronen Shitrit; Nicolas Pitre; u-boot at lists.denx.de; Ashish Karkare; Prabhanjan Sarnaik; Lennert Buijtenhek
Subject: Re: [U-Boot] [PATCH 2/3] tools: mkimage (type=kwbimage) kirkwood boot image support

Dear Wolfgang
Thanks for your quick feedback

> -----Original Message-----
> From: Wolfgang Denk [mailto:wd at denx.de]
> Sent: Sunday, July 19, 2009 3:33 AM
> To: Prafulla Wadaskar
> Cc: u-boot at lists.denx.de; Manas Saksena; Ronen Shitrit;
> Nicolas Pitre; Ashish Karkare; Prabhanjan Sarnaik; Lennert Buijtenhek
> Subject: Re: [U-Boot] [PATCH 2/3] tools: mkimage
> (type=kwbimage) kirkwood boot image support

<snip..>
> > diff --git a/tools/kwbimage.h b/tools/kwbimage.h new file
> mode 100644
> > index 0000000..c54b701
> > --- /dev/null
> > +++ b/tools/kwbimage.h
> > ...
> > +/* typedefs */
> > +typedef char s8;
> > +typedef unsigned char u8;
> > +
> > +typedef int s32;
> > +typedef unsigned int u32;
> > +
> > +typedef short s16;
> > +typedef unsigned short u16;
> > +
> > +typedef long s64;
> > +typedef unsigned long u64;
>
> Please get rid of these.

Hi Wolfgang
Any suggestions for this?
I could used <linux/types.h> or <asm/types.h> but these typedefs are ifdefed
under __KERNEL_STRICT_NAMES and __KERNEL__.
I don't wish to redefine or disturb them for kwbimage support

Regards..
Prafulla . .

>
> > diff --git a/tools/mkimage.c b/tools/mkimage.c index
> c5b593c..9a11071
> > 100644
> > --- a/tools/mkimage.c
> > +++ b/tools/mkimage.c
> > @@ -24,6 +24,7 @@
> >
> >  #include "mkimage.h"
> >  #include <image.h>
> > +#include "kwbimage.h"
> >
> >  extern int errno;
> >
> > @@ -251,7 +252,13 @@ NXTARG:                ;
> >      * write dummy header, to be fixed later
> >      */
> >     int hdr_size;
> > -   hdr_size = image_get_header_size ();
> > +
> > +   if (opt_type == IH_TYPE_KWBIMAGE) {
> > +           hdr = kwbimage_get_header_ptr();
> > +           hdr_size = kwbimage_get_header_size ();
> > +   } else
> > +           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",
> > @@ -339,6 +346,19 @@ NXTARG:                ;
> >
> >     hdr = (image_header_t *)ptr;
> >
> > +   /* Build new header */
> > +   if (opt_type == IH_TYPE_KWBIMAGE) {
> > +           checksum = kwbimage_checksum32((void *)ptr,
> sbuf.st_size, 0);
> > +
> > +           if (write(ifd, &checksum, sizeof(uint32_t))
> > +                                   != sizeof(uint32_t)) {
> > +                   fprintf (stderr, "%s: Checksum wr err
> on %s: %s\n",
> > +                           cmdname, imagefile, strerror(errno));
> > +                   exit (EXIT_FAILURE);
> > +           }
> > +           sbuf.st_size += sizeof(uint32_t);
> > +           kwbimage_set_header (hdr, &sbuf, addr, ep, name);
> > +   } else {
> >     checksum = crc32 (0,
> >                     (const char *)(ptr + hdr_size),
> >                     sbuf.st_size - hdr_size);
> > @@ -361,6 +381,7 @@ NXTARG:         ;
> >
> >     image_print_contents (hdr);
> >
> > +   }
> >     (void) munmap((void *)ptr, sbuf.st_size);
> >
> >     /* We're a bit of paranoid */
>
> Hmm... it seems you add only image creation code. But "mkimage -l"
> should work on such an image, too. And "imls" in U-Boot
> should be working, too.
Well I will disable other generic mkimage options including -l for kwbimage ;-)
Can we add this in second part which is not required too?
For me great thing is that we can support kwimage generation through mkimage.

Regards..
Prafulla . .

>
> 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 "Plan to throw one away. You will anyway."
>                               - Fred Brooks, "The Mythical Man Month"
>
_______________________________________________
U-Boot mailing list
U-Boot at lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


More information about the U-Boot mailing list