[U-Boot] [PATCH v2] tools: mkimage: split code into core, default and FIT image specific

Wolfgang Denk wd at denx.de
Wed Aug 19 11:54:11 CEST 2009


Dear Prafulla Wadaskar,

In message <1250683606-25278-1-git-send-email-prafulla at marvell.com> you wrote:
> This is first step towards cleaning mkimage code for kwbimage
> support in clean way. Current mkimage code is very specific to
> uimg generation whereas the same framework can be used to
> generate other image types like Kirkwood boot image (kwbimage-TBD).
> For this, the architecture of mkimage code need to modified.
> 
> Here is the brief plan for the same:-
> a) Split mkimage code into core and image specific support
> b) Implement callback function for image specific functions
> c) Move image type specific code to respective c files
>        Currently there are two types of file generation/list
>        supported (i.e uimg, FIT), the code is abstracted from
>        mkimage.c/h and put in default_image.c and fit_image.c
>        all code in these file is static except init function call
> d) mkimage_register API is added to add new image type support
> All above is addressed in this patch
> e) Add kwbimage type support to this new framework (TBD)
> 
> Signed-off-by: Prafulla Wadaskar <prafulla at marvell.com>
> ---
> Change log:
> v2: patch generated on mkimage branch
> 
>  tools/Makefile        |    9 +-
>  tools/default_image.c |  149 ++++++++++++++
>  tools/fit_image.c     |  212 +++++++++++++++++++
>  tools/mkimage.c       |  539 +++++++++++++++++++++++--------------------------
>  tools/mkimage.h       |  101 +++++++++-
>  5 files changed, 720 insertions(+), 290 deletions(-)
>  create mode 100644 tools/default_image.c
>  create mode 100644 tools/fit_image.c

Thanks, applied.

I edited the commit message a bit.

I had to clean up some compile warnings:
tools/default_image.c:141: warning: initialization from incompatible pointer type
tools/fit_image.c:202: warning: initialization from incompatible pointer type
I added some "const" attributes while doing this. See patch posted.

Please see the current "mkimage" branch.

> diff --git a/tools/Makefile b/tools/Makefile
> index 6f36f23..10547e1 100644
> --- a/tools/Makefile
> +++ b/tools/Makefile
> @@ -183,7 +183,8 @@ $(obj)inca-swap-bytes$(SFX):	$(obj)inca-swap-bytes.o
>  	$(CC) $(CFLAGS) $(HOST_LDFLAGS) -o $@ $^
>  	$(STRIP) $@
>  
> -$(obj)mkimage$(SFX):	$(obj)crc32.o $(obj)mkimage.o $(obj)image.o $(obj)md5.o $(obj)mkimage.o \
> +$(obj)mkimage$(SFX):	$(obj)crc32.o $(obj)default_image.o $(obj)fit_image.o $(obj)image.o \
> +			$(obj)md5.o $(obj)mkimage.o \
>  			$(obj)os_support.o $(obj)sha1.o $(LIBFDT_OBJS)

This line was still too long, I split it.

> diff --git a/tools/fit_image.c b/tools/fit_image.c
> new file mode 100644
> index 0000000..6f5c8c6
> --- /dev/null
> +++ b/tools/fit_image.c
> @@ -0,0 +1,212 @@
> +/*
> + * (C) Copyright 2008 Semihalf
> + *
> + * (C) Copyright 2000-2004
> + * DENX Software Engineering
> + * Wolfgang Denk, wd at denx.de
> + *
> + * Updated-by: Prafulla Wadaskar <prafulla at marvell.com>
> + *		fir image specific code abstracted from mkimage.c

I fixed the "fir" typo.

> + *		some functions added to address abstraction

In general, just add your (C) Copyright, please. We have the git
commit message to document such changes.


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
It is easier to write an incorrect program than understand a  correct
one.


More information about the U-Boot mailing list