tools: mkimage: split code into core, default and FIT image specific
PATCH v2 1/1 tools: mkimage: split code into core, default and FIT image specific
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)
---
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
tools/Makefile +8 -1
@@ -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) $(CC) $(CFLAGS) $(HOST_LDFLAGS) -o $@ $^ $(STRIP) $@
@@ -200,6 +201,12 @@ $(obj)ubsha1$(SFX): $(obj)os_support.o $(obj)sha1.o $(obj)ubsha1.o $(CC) $(CFLAGS) -o $@ $^ # Some files complain if compiled with -pedantic, use FIT_CFLAGS +$(obj)default_image.o: $(SRCTREE)/tools/default_image.c + $(CC) -g $(FIT_CFLAGS) -c -o $@ $< + +$(obj)fit_image.o: $(SRCTREE)/tools/fit_image.c + $(CC) -g $(FIT_CFLAGS) -c -o $@ $< + $(obj)image.o: $(SRCTREE)/common/image.c $(CC) -g $(FIT_CFLAGS) -c -o $@ $<
tools/default_image.c new file +149 -0
149 lines not on this page · raw message
tools/fit_image.c new file +212 -0
212 lines not on this page · raw message
tools/mkimage.c +251 -288
795 lines not on this page · raw message
tools/mkimage.h +100 -1
116 lines not on this page · raw message
Signature · 1 line
1.5.3.4
Wolfgang Denk
AppliedPATCH v2 1/1 tools: mkimage: split code into core, default and FIT image specific
Dear Prafulla Wadaskar,
Quoted 23 lines · In message <[email protected]> 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 indefault_image.candfit_image.call code in these file is static except init function call
d)mkimage_registerAPI 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 <[email protected]>---
Change log:
v2: patch generated on mkimage branch
Quoted 8 lines
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.
tools/Makefile $(obj)inca-swap-bytes$(SFX): $(obj)inca-swap-bytes.o · line 188
Quoted 12 lines
tools/Makefile +2
-1@@ -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.
Quoted 6 lines
tools/fit_image.c new file +0
-0
tools/fit_image.c line 9
Quoted 9 lines
tools/fit_image.c new file +9
-0@@ -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 <[email protected]> +* fir image specific code abstracted from mkimage.c
I fixed the "fir" typo.
tools/fit_image.c line 10
Quoted 1 line
tools/fit_image.c new file +1
-0+* 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
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 It is easier to write an incorrect program than understand a correct one.