tools: mkimage: Making genimg_print_size API global
PATCH 1/4 tools: mkimage: Making genimg_print_size API global
Currently it is used by image.c only
This API can be used by additional mkimage types supports for ex. kwbimage, to use it the API is made global
--- common/image.c | 3 +-- include/image.h | 1 + 2 files changed, 2 insertions(+), 2 deletions(-)
common/image.c +1 -2
@@ -158,7 +158,6 @@ static table_entry_t uimage_comp[] = {uint32_t crc32 (uint32_t ,const unsigned char *,uint );uint32_t crc32_wd (uint32_t ,const unsigned char *,uint ,uint ); -static void genimg_print_size (uint32_t size);#if defined(CONFIG_TIMESTAMP ) || defined(CONFIG_CMD_DATE ) || defined(USE_HOSTCC )static void genimg_print_time (time_t timestamp);#endif
@@ -473,7 +472,7 @@ void memmove_wd (void *to, void *from, size_t len, ulong chunksz) }#endif /* !USE_HOSTCC */ -static void genimg_print_size (uint32_t size) +void genimg_print_size (uint32_t size) {#ifndef USE_HOSTCC printf ("%d Bytes = " , size);
include/image.h +1 -0
@@ -292,6 +292,7 @@ int genimg_get_os_id (const char *name);int genimg_get_arch_id (const char *name);int genimg_get_type_id (const char *name);int genimg_get_comp_id (const char *name); +void genimg_print_size (uint32_t size);#ifndef USE_HOSTCC /* Image format types, returned by _get_format() routine */
Signature · 1 line
1.5.3.4
PATCH v2 2/4 tools: mkimage: Making table_entry code global
1. get_table_entry_id API made global
2. get_table_entry_name API made global
3. struct table_entry moved to image.h
Currently it is used by image.c only
These APIs are very usefull and can be used by other part of code
This patch makes these APIs and struct global
---
change log:
updated as per review comments for v1 added some comments
common/image.c | 10 ++-------- include/image.h | 26 ++++++++++++++++++++++++++ 2 files changed, 28 insertions(+), 8 deletions(-)
common/image.c +2 -8
@@ -74,12 +74,6 @@ static image_header_t* image_get_ramdisk (ulong rd_addr, uint8_t arch,#include <image.h> #endif /* !USE_HOSTCC*/ -typedef struct table_entry { -int id;/* as defined in image.h */ -char *sname;/* short (input) name */ -char *lname;/* long (output) name */ -}table_entry_t ; -static table_entry_t uimage_arch[] = { {IH_ARCH_INVALID ,NULL ,"Invalid ARCH" , }, {IH_ARCH_ALPHA ,"alpha" ,"Alpha" , },
@@ -514,7 +508,7 @@ static void genimg_print_time (time_t timestamp)* long entry name if translation succeeds * msg otherwise */ -static char *get_table_entry_name (table_entry_t *table,char *msg,int id) +char *get_table_entry_name (table_entry_t *table,char *msg,int id) {for (; table->id >=0 ; ++table) {if (table->id == id)
@@ -561,7 +555,7 @@ const char *genimg_get_comp_name (uint8_t comp)* entry id if translation succeeds * -1 otherwise */ -static int get_table_entry_id (table_entry_t *table, +int get_table_entry_id (table_entry_t *table,const char *table_name,const char *name) {table_entry_t *t;
include/image.h +26 -0
@@ -284,6 +284,32 @@ typedef struct bootm_headers {#define uimage_to_cpu (x) be32_to_cpu(x)#define cpu_to_uimage (x) cpu_to_be32(x) +/* +* Translation table for entries of a specific type +* This structue is used by the global functions get_table_entry_id, +* get_table_entry_name and these functions and this structure can also be +* referred by other part of code +*/ +typedef struct table_entry { +int id; +char *sname;/* name used to find table entry */ +char *lname;/* name used to print for messages */ +}table_entry_t ; + +/* +* get_table_entry_id() will go over translation table trying to find +* entry that matches given short name. If matching entry is found, +* its id returned to the caller. +*/ +int get_table_entry_id (table_entry_t *table, +const char *table_name,const char *name); +/* +* get_table_entry_name() will go over translation table trying to find +* entry that matches given id. If matching entry is found, its long +* name is returned to the caller. +*/ +char *get_table_entry_name (table_entry_t *table,char *msg,int id); +const char *genimg_get_os_name (uint8_t os);const char *genimg_get_arch_name (uint8_t arch);const char *genimg_get_type_name (uint8_t type);
Signature · 1 line
1.5.3.4
PATCH 3/4 Kirkwood: Sheevaplug: kwimage configuration
--- board/Marvell/sheevaplug/config.mk | 3 + board/Marvell/sheevaplug/kwbimage.cfg | 162 +++++++++++++++++++++++++++++++++ 2 files changed, 165 insertions(+), 0 deletions(-) create mode 100644 board/Marvell/sheevaplug/kwbimage.cfg
board/Marvell/sheevaplug/config.mk +3 -0
@@ -23,3 +23,6 @@ # TEXT_BASE = 0x00600000 + +# Kirkwood Boot Image configuration file +KWD_CONFIG = $(SRCTREE)/board/$(BOARDDIR)/kwbimage.cfg
board/Marvell/sheevaplug/kwbimage.cfg new file +162 -0
162 lines not on this page · raw message
Signature · 1 line
1.5.3.4
PATCH v2 4/4 tools: mkimage: Add: Kirkwood Boot Image support (kwbimage)
This patch adds type kwbimabe support for new mkimage core For more details refer docs/README.kwbimage
This patch is tested with Sheevaplug board
---
Change log:
v2: updated as per review comments for v1 added len checks in checksum functions added printable strings for each valid table entry
Makefile | 5 + common/image.c | 1 + doc/README.kwbimage | 93 ++++++++++++ include/image.h | 1 + tools/Makefile | 5 +- tools/kwbimage.c | 401 +++++++++++++++++++++++++++++++++++++++++++++++++++ tools/kwbimage.h | 106 ++++++++++++++ tools/mkimage.c | 2 + 8 files changed, 613 insertions(+), 1 deletions(-) create mode 100644 doc/README.kwbimage create mode 100644 tools/kwbimage.c create mode 100644 tools/kwbimage.h
Makefile +5 -0
@@ -314,6 +314,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
@@ -3671,6 +3675,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
@@ -139,6 +139,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
@@ -155,6 +155,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 +4 -1
@@ -184,7 +184,7 @@ $(obj)inca-swap-bytes$(SFX): $(obj)inca-swap-bytes.o $(STRIP) $@ $(obj)mkimage$(SFX): $(obj)crc32.o $(obj)default_image.o $(obj)fit_image.o $(obj)image.o \ - $(obj)md5.o $(obj)mkimage.o \ + $(obj)kwbimage.o $(obj)md5.o $(obj)mkimage.o \ $(obj)os_support.o $(obj)sha1.o $(LIBFDT_OBJS) $(CC) $(CFLAGS) $(HOST_LDFLAGS) -o $@ $^ $(STRIP) $@
@@ -210,6 +210,9 @@ $(obj)fit_image.o: $(SRCTREE)/tools/fit_image.c $(obj)image.o: $(SRCTREE)/common/image.c $(CC) -g $(FIT_CFLAGS) -c -o $@ $< +$(obj)kwbimage.o: $(SRCTREE)/tools/kwbimage.c + $(CC) -g $(FIT_CFLAGS) -c -o $@ $< + $(obj)mkimage.o: $(SRCTREE)/tools/mkimage.c $(CC) -g $(FIT_CFLAGS) -c -o $@ $<
tools/kwbimage.c new file +401 -0
401 lines not on this page · raw message
tools/kwbimage.h new file +106 -0
106 lines not on this page · raw message
tools/mkimage.c +2 -0
@@ -149,6 +149,8 @@ main (int argc, char **argv)int retval =0 ;struct image_type_params *tparams =NULL ; +/* Init Kirkwood Boot image generation/list support */ +init_kwb_image_type ();/* Init FIT image generation/list support */ init_fit_image_type ();/* Init Default image generation/list support */
Signature · 1 line
1.5.3.4