Skip to contentSkip to conversation

tools: mkimage: Include default/fit_image.o in the build dependency calculations

PATCH New Prafulla Wadaskar 2 participants 9 messages Sep 7, 2009 – Sep 10, 2009 Kbuild

lore
Share & tools
lore
#0 lore raw

PATCH 1/5 tools: mkimage: Include default/fit_image.o in the build dependency calculations

This makes sure it gets rebuilt if any of the headers it includes are modified

---
 tools/Makefile |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)
tools/Makefile +2 -0
index 858b0e8..d5c23fd 100644
@@ -93,7 +93,9 @@ EXT_OBJ_FILES-y += lib_generic/sha1.o
 # Source files located in the tools directory
 OBJ_FILES-$(CONFIG_LCD_LOGO) += bmp_logo.o
 OBJ_FILES-$(CONFIG_VIDEO_LOGO) += bmp_logo.o
+OBJ_FILES-y += default_image.o
 OBJ_FILES-$(CONFIG_ENV_IS_EMBEDDED) += envcrc.o
+OBJ_FILES-y += fit_image.o
 OBJ_FILES-$(CONFIG_CMD_NET) += gen_eth_addr.o
 OBJ_FILES-$(CONFIG_CMD_LOADS) += img2srec.o
 OBJ_FILES-$(CONFIG_INCA_IP) += inca-swap-bytes.o
Signature · 1 line
1.5.3.3
#1 lore raw

PATCH 2/5 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
index f3dd647..ca8205c 100644
@@ -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
index a62669f..4a7bf78 100644
@@ -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.3
#2 lore raw

PATCH 3/5 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

Acked-by Ron Lee <ron.debian.org>
---
 common/image.c  |   10 ++--------
 include/image.h |   26 ++++++++++++++++++++++++++
 2 files changed, 28 insertions(+), 8 deletions(-)
common/image.c +2 -8
index ca8205c..e8ecfa5 100644
@@ -74,12 +74,6 @@ static const 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
index 4a7bf78..58f13f9 100644
@@ -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.3
#3 lore raw

PATCH 4/5 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
index a4ea769..2bd9f79 100644
@@ -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.3
#4 lore raw

PATCH v4 5/5 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

---
v2: updated as per review comments for v1
added len checks in checksum functions
added printable strings for each valid table entry
use of sccanf not changed since it offers return value for failure

v3: resolved merge issues on mkimage branch

v4: added warning fix on amd64
Use an intermediate type as large as the pointers we do simple arithmetic with. Use a format string type that suits the sizeof type from KWBIMAGE_MAX_CONFIG. The compiler warns about both of these on amd64.
included kwbimage.o in the build dependency calculations
_GNU_SOURCE defined to obtain getline prototype from stdio.h
most of these changes suggested by Ron Lee (in cc list)

 Makefile            |    5 +
 common/image.c      |    1 +
 doc/README.kwbimage |   93 ++++++++++++
 include/image.h     |    1 +
 tools/Makefile      |    5 +
 tools/kwbimage.c    |  405 +++++++++++++++++++++++++++++++++++++++++++++++++++
 tools/kwbimage.h    |  106 +++++++++++++
 tools/mkimage.c     |    2 +
 tools/mkimage.h     |    1 +
 9 files changed, 619 insertions(+), 0 deletions(-)
 create mode 100644 doc/README.kwbimage
 create mode 100644 tools/kwbimage.c
 create mode 100644 tools/kwbimage.h
Makefile +5 -0
index 329e0f5..7d7637a 100644
@@ -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
index e8ecfa5..d0f169d 100644
@@ -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
index 58f13f9..0a5d39b 100644
@@ -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 +5 -0
index d5c23fd..b04e3f3 100644
@@ -99,6 +99,7 @@ OBJ_FILES-y += fit_image.o
 OBJ_FILES-$(CONFIG_CMD_NET) += gen_eth_addr.o
 OBJ_FILES-$(CONFIG_CMD_LOADS) += img2srec.o
 OBJ_FILES-$(CONFIG_INCA_IP) += inca-swap-bytes.o
+OBJ_FILES-y += kwbimage.o
 OBJ_FILES-y += mkimage.o
 OBJ_FILES-$(CONFIG_NETCONSOLE) += ncb.o
 OBJ_FILES-y += os_support.o
@@ -189,6 +190,7 @@ $(obj)mkimage$(SFX):	$(obj)crc32.o \
 			$(obj)default_image.o \
 			$(obj)fit_image.o \
 			$(obj)image.o \
+			$(obj)kwbimage.o \
 			$(obj)md5.o \
 			$(obj)mkimage.o \
 			$(obj)os_support.o \
@@ -218,6 +220,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 +405 -0

405 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
index c43b207..ab6ea32 100644
@@ -148,6 +148,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 */
tools/mkimage.h +1 -0
index 1e92825..47ebc19 100644
@@ -140,6 +140,7 @@ void mkimage_register (struct image_type_params *tparams);
  *
  * Supported image types init functions
  */
+void init_kwb_image_type (void);
 void init_default_image_type (void);
 void init_fit_image_type (void);
 
Signature · 1 line
1.5.3.3
#5 lore raw

PATCH 4/5 Kirkwood: Sheevaplug: kwimage configuration

In reply to Prafulla Wadaskar

Dear Prafulla Wadaskar,

Quoted 6 lines · In message <[email protected]> you wrote:
---
 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

Applied to "mkimage" branch. thanks.

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
Witch!  Witch!  They'll burn ya!
	-- Hag, "Tomorrow is Yesterday", stardate unknown
#6 lore raw

PATCH 3/5 tools: mkimage: Making table_entry code global

In reply to Prafulla Wadaskar

Dear Prafulla Wadaskar,

Quoted 7 lines · In message <[email protected]> you wrote:

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

Quoted 8 lines

This patch makes these APIs and struct global

Acked-by Ron Lee <ron.debian.org>
---
 common/image.c  |   10 ++--------
 include/image.h |   26 ++++++++++++++++++++++++++
 2 files changed, 28 insertions(+), 8 deletions(-)

Applied to "mkimage" branch (with slight edits to the commit message and some comments). thanks.

Best regards,

Wolfgang Denk

Signature · 4 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
You can only live once, but if you do it right, once is enough.
#7 lore raw

PATCH 2/5 tools: mkimage: Making genimg_print_size API global

In reply to Prafulla Wadaskar

Dear Prafulla Wadaskar,

Quoted 9 lines · In message <[email protected]> you wrote:

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(-)

Applied to "mkimage" branch (with some editing of the commit message), thanks.

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
The use of COBOL cripples the mind; its teaching  should,  therefore,
be regarded as a criminal offense.                   - E. W. Dijkstra
#8 lore raw

PATCH 1/5 tools: mkimage: Include default/fit_image.o in the build dependency calculations

In reply to Prafulla Wadaskar

Dear Prafulla Wadaskar,

Quoted 7 lines · In message <[email protected]> you wrote:

This makes sure it gets rebuilt if any of the headers it includes are modified

---
 tools/Makefile |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

Applied to "mkimage" branch (with minor editing of the commit message; lines were too long). Thanks.

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
The IQ of the group is the lowest IQ of a member of the group divided
by the number of people in the group.