tools: mkimage (type=kwbimage) kirkwood boot image support
PATCH v3 2/4 tools: mkimage (type=kwbimage) kirkwood boot image support
For more details refer docs/README.kwbimage
---
Change log:
v2: strtok_r() used for simple parser algorithm updated as per feedback for v1
all line checked to be below 78 :-)
v3: braces removed on single-line statements coding styles func() converted to func ()
Makefile | 5 + common/image.c | 1 + doc/README.kwbimage | 93 ++++++++++++++++++ include/image.h | 1 + tools/Makefile | 1 + tools/kwbimage.c | 264 +++++++++++++++++++++++++++++++++++++++++++++++++++ tools/kwbimage.h | 104 ++++++++++++++++++++ tools/mkimage.c | 27 +++++- 8 files changed, 495 insertions(+), 1 deletions(-) create mode 100644 doc/README.kwbimage create mode 100644 tools/kwbimage.c create mode 100644 tools/kwbimage.h
Makefile +5 -0
@@ -339,6 +339,10 @@ $(obj)u-boot.img: $(obj)u-boot.bin sed -e 's/"[ ]*$$/ for $(BOARD) board"/') \ -d $< $@ +$(obj)u-boot.kwb: $(obj)u-boot.bin + $(obj)tools/mkimage -n $(KWD_CONFIG) -T kwbimage \ + -a $(TEXT_BASE) -e $(TEXT_BASE) -d $< $@ + $(obj)u-boot.sha1: $(obj)u-boot.bin $(obj)tools/ubsha1 $(obj)u-boot.bin
@@ -3638,6 +3642,7 @@ clobber: clean @rm -f $(OBJS) $(obj)*.bak $(obj)ctags $(obj)etags $(obj)TAGS \ $(obj)cscope.* $(obj)*.*~ @rm -f $(obj)u-boot $(obj)u-boot.map $(obj)u-boot.hex $(ALL) + @rm -f $(obj)u-boot.kwb @rm -f $(obj)tools/{env/crc32.c,inca-swap-bytes} @rm -f $(obj)cpu/mpc824x/bedbug_603e.c @rm -f $(obj)include/asm/proc $(obj)include/asm/arch $(obj)include/asm
common/image.c +1 -0
@@ -145,6 +145,7 @@ static table_entry_t uimage_type[] = { { IH_TYPE_SCRIPT, "script", "Script", }, { IH_TYPE_STANDALONE, "standalone", "Standalone Program", }, { IH_TYPE_FLATDT, "flat_dt", "Flat Device Tree", }, + { IH_TYPE_KWBIMAGE, "kwbimage", "Kirkwood Boot Image",}, { -1, "", "", }, };
doc/README.kwbimage new file +93 -0
93 lines not on this page · raw message
include/image.h +1 -0
@@ -158,6 +158,7 @@#define IH_TYPE_SCRIPT 6/* Script file */ #define IH_TYPE_FILESYSTEM 7/* Filesystem Image (any type) */ #define IH_TYPE_FLATDT 8/* Binary Flat Device Tree Blob */ +#define IH_TYPE_KWBIMAGE 9/* Kirkwood Boot Image */ /* * Compression Types
tools/Makefile +1 -0
@@ -167,6 +167,7 @@ $(obj)img2srec$(SFX): $(obj)img2srec.o $(STRIP) $@ $(obj)mkimage$(SFX): $(obj)mkimage.o $(obj)crc32.o $(obj)image.o $(obj)md5.o \ + $(obj)kwbimage.o \ $(obj)sha1.o $(LIBFDT_OBJS) $(obj)os_support.o $(CC) $(CFLAGS) $(HOST_LDFLAGS) -o $@ $^ $(STRIP) $@
tools/kwbimage.c new file +264 -0
264 lines not on this page · raw message
tools/kwbimage.h new file +104 -0
104 lines not on this page · raw message
tools/mkimage.c +26 -1
@@ -24,6 +24,7 @@#include "mkimage.h" #include <image.h> +#include "kwbimage.h" extern int errno;
@@ -164,6 +165,10 @@ NXTARG: ; (lflag && (dflag || fflag)))usage (); +if (((argc !=1 ) && (opt_type ==IH_TYPE_KWBIMAGE )) && + (xflag || lflag)) +usage (); +if (!eflag) { ep = addr;/* If XIP, entry point must be after the U-Boot header */
@@ -251,7 +256,12 @@ NXTARG: ;* * write dummy header, to be fixed later */ - 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 +349,20 @@ NXTARG: ; hdr = (image_header_t *)ptr; +/* Build new header */ +if (opt_type ==IH_TYPE_KWBIMAGE ) { + checksum =kwbimage_checksum32 ((uint32_t *)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 +385,7 @@ NXTARG: ;image_print_contents (hdr); + } (void )munmap ((void *)ptr, sbuf.st_size);/* We're a bit of paranoid */
Signature · 1 line
1.5.3.4
PATCH v3 2/4 tools: mkimage (type=kwbimage) kirkwood boot image support
Dear Prafulla Wadaskar,
Quoted 11 lines · In message <[email protected]> you wrote:
For more details refer docs/README.kwbimage
Signed-off-by Prafulla Wadaskar <[email protected]>---
Change log:
v2:strtok_r()used for simple parser algorithm updated as per feedback for v1
all line checked to be below 78 :-)v3: braces removed on single-line statements coding styles
func()converted to func ()
All my other comments still apply, it seems.
Best regards,
Wolfgang Denk
Signature · 5 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
A committee is a group that keeps the minutes and loses hours.
-- Milton Berle