public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [U-Boot-Users] [PATCH 0/6] [new uImage] patchset4 - assorted patches
@ 2008-02-20 17:19 Bartlomiej Sieka
  2008-02-20 17:19 ` [U-Boot-Users] [PATCH 1/6] [new uImage] Pull in libfdt if CONFIG_FIT is enabled Bartlomiej Sieka
                   ` (5 more replies)
  0 siblings, 6 replies; 16+ messages in thread
From: Bartlomiej Sieka @ 2008-02-20 17:19 UTC (permalink / raw)
  To: u-boot

This patchset encompasses some clean-ups and fixes, and adds the new uImage
#define knob (CONFIG_FIT), which is enabled by default. The patchset also adds
some new uImage-specific functionality: (1) a routine to parse new-style
arguments to bootm (and other commands), (2) a generic function for retrieving
images. It lays foundation for the soon-to-follow:
- low-level new uImage handling functions
- mkimage extensions to allow generation of new format images
- U-Boot support for booting new format images

Code from this patchset will be soon available from the new-image branch of
the u-boot-testing repository.

Please review, test and provide comments.


Marian Balakowicz (6):
      [new uImage] Fix erroneous use of image_get_magic() in fdc/usb cmds
      [new uImage] Rename and move print_image_hdr() routine
      [new uImage] Add fit_parse_conf() and fit_parse_subimage() routines
      [new uImage] Add gen_get_image() routine
      [libfdt] Fix compilation errors is fdt_support.c
      [new uImage] Pull in libfdt if CONFIG_FIT is enabled



Regards,
Bartlomiej

^ permalink raw reply	[flat|nested] 16+ messages in thread

* [U-Boot-Users] [PATCH 1/6] [new uImage] Pull in libfdt if CONFIG_FIT is enabled
  2008-02-20 17:19 [U-Boot-Users] [PATCH 0/6] [new uImage] patchset4 - assorted patches Bartlomiej Sieka
@ 2008-02-20 17:19 ` Bartlomiej Sieka
  2008-02-20 17:20 ` [U-Boot-Users] [PATCH 2/6] [libfdt] Fix compilation errors is fdt_support.c Bartlomiej Sieka
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 16+ messages in thread
From: Bartlomiej Sieka @ 2008-02-20 17:19 UTC (permalink / raw)
  To: u-boot

From: Marian Balakowicz <m8@semihalf.com>

New uImage format (Flattened Image Tree) requires libfdt
functionality, print out error message if CONFIG_OF_LIBFDT
is not defined.

New uImage support is enabled by defining CONFIG_FIT (and CONFIG_OF_LIBFDT).
This commit turns it on by default.

Signed-off-by: Marian Balakowicz <m8@semihalf.com>
---

 cpu/mpc5xxx/cpu.c |    2 +-
 cpu/mpc8260/cpu.c |    2 +-
 cpu/mpc8xx/cpu.c  |    2 +-
 include/image.h   |    9 +++++++++
 4 files changed, 12 insertions(+), 3 deletions(-)

diff --git a/cpu/mpc5xxx/cpu.c b/cpu/mpc5xxx/cpu.c
index e4d6168..7522afe 100644
--- a/cpu/mpc5xxx/cpu.c
+++ b/cpu/mpc5xxx/cpu.c
@@ -114,7 +114,7 @@ unsigned long get_tbclk (void)
 
 /* ------------------------------------------------------------------------- */
 
-#ifdef CONFIG_OF_LIBFDT
+#if defined(CONFIG_OF_LIBFDT) && defined (CONFIG_OF_BOARD_SETUP)
 void ft_cpu_setup(void *blob, bd_t *bd)
 {
 	int div = in_8((void*)CFG_MBAR + 0x204) & 0x0020 ? 8 : 4;
diff --git a/cpu/mpc8260/cpu.c b/cpu/mpc8260/cpu.c
index 55e61a1..414759e 100644
--- a/cpu/mpc8260/cpu.c
+++ b/cpu/mpc8260/cpu.c
@@ -300,7 +300,7 @@ void watchdog_reset (void)
 #endif /* CONFIG_WATCHDOG */
 
 /* ------------------------------------------------------------------------- */
-#if defined(CONFIG_OF_LIBFDT)
+#if defined(CONFIG_OF_LIBFDT) && defined (CONFIG_OF_BOARD_SETUP)
 void ft_cpu_setup (void *blob, bd_t *bd)
 {
 	char * cpu_path = "/cpus/" OF_CPU;
diff --git a/cpu/mpc8xx/cpu.c b/cpu/mpc8xx/cpu.c
index c878352..5d4ab82 100644
--- a/cpu/mpc8xx/cpu.c
+++ b/cpu/mpc8xx/cpu.c
@@ -638,7 +638,7 @@ void reset_8xx_watchdog (volatile immap_t * immr)
 #endif /* CONFIG_WATCHDOG */
 
 /* ------------------------------------------------------------------------- */
-#if defined(CONFIG_OF_LIBFDT)
+#if defined(CONFIG_OF_LIBFDT) && defined (CONFIG_OF_BOARD_SETUP)
 void ft_cpu_setup (void *blob, bd_t *bd)
 {
 	char * cpu_path = "/cpus/" OF_CPU;
diff --git a/include/image.h b/include/image.h
index dbbbee9..ecfce72 100644
--- a/include/image.h
+++ b/include/image.h
@@ -35,10 +35,19 @@
 
 #include <asm/byteorder.h>
 #include <command.h>
+
 #ifndef USE_HOSTCC
 #include <linux/string.h>
 #include <asm/u-boot.h>
+
+/* new uImage format support enabled by default */
+#define CONFIG_FIT		1
+#define CONFIG_OF_LIBFDT	1
+
+#if defined(CONFIG_FIT) && !defined(CONFIG_OF_LIBFDT)
+#error "CONFIG_OF_LIBFDT not enabled, required by CONFIG_FIT!"
 #endif
+#endif /* USE_HOSTCC */
 
 /*
  * Operating System Codes

^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [U-Boot-Users] [PATCH 2/6] [libfdt] Fix compilation errors is fdt_support.c
  2008-02-20 17:19 [U-Boot-Users] [PATCH 0/6] [new uImage] patchset4 - assorted patches Bartlomiej Sieka
  2008-02-20 17:19 ` [U-Boot-Users] [PATCH 1/6] [new uImage] Pull in libfdt if CONFIG_FIT is enabled Bartlomiej Sieka
@ 2008-02-20 17:20 ` Bartlomiej Sieka
  2008-02-20 17:33   ` Jerry Van Baren
  2008-02-20 19:10   ` Kumar Gala
  2008-02-20 17:20 ` [U-Boot-Users] [PATCH 3/6] [new uImage] Add gen_get_image() routine Bartlomiej Sieka
                   ` (3 subsequent siblings)
  5 siblings, 2 replies; 16+ messages in thread
From: Bartlomiej Sieka @ 2008-02-20 17:20 UTC (permalink / raw)
  To: u-boot

From: Marian Balakowicz <m8@semihalf.com>

fdt_support.c does not compile with the DEBUG enabled,
correct arguments passed to debug() calls.

Signed-off-by: Marian Balakowicz <m8@semihalf.com>
---

 common/fdt_support.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/common/fdt_support.c b/common/fdt_support.c
index a13c140..628bbdd 100644
--- a/common/fdt_support.c
+++ b/common/fdt_support.c
@@ -418,7 +418,7 @@ void do_fixup_by_path(void *fdt, const char *path, const char *prop,
 {
 #if defined(DEBUG)
 	int i;
-	debug("Updating property '%s/%s' = ", node, prop);
+	debug("Updating property %s, path '%s' = ", prop, path);
 	for (i = 0; i < len; i++)
 		debug(" %.2x", *(u8*)(val+i));
 	debug("\n");
@@ -444,7 +444,7 @@ void do_fixup_by_prop(void *fdt,
 	int off;
 #if defined(DEBUG)
 	int i;
-	debug("Updating property '%s/%s' = ", node, prop);
+	debug("Updating property '%s', pname '%s' = ", prop, pname);
 	for (i = 0; i < len; i++)
 		debug(" %.2x", *(u8*)(val+i));
 	debug("\n");
@@ -471,7 +471,7 @@ void do_fixup_by_compat(void *fdt, const char *compat,
 	int off = -1;
 #if defined(DEBUG)
 	int i;
-	debug("Updating property '%s/%s' = ", node, prop);
+	debug("Updating property '%s', compat '%s' = ", prop, compat);
 	for (i = 0; i < len; i++)
 		debug(" %.2x", *(u8*)(val+i));
 	debug("\n");

^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [U-Boot-Users] [PATCH 3/6] [new uImage] Add gen_get_image() routine
  2008-02-20 17:19 [U-Boot-Users] [PATCH 0/6] [new uImage] patchset4 - assorted patches Bartlomiej Sieka
  2008-02-20 17:19 ` [U-Boot-Users] [PATCH 1/6] [new uImage] Pull in libfdt if CONFIG_FIT is enabled Bartlomiej Sieka
  2008-02-20 17:20 ` [U-Boot-Users] [PATCH 2/6] [libfdt] Fix compilation errors is fdt_support.c Bartlomiej Sieka
@ 2008-02-20 17:20 ` Bartlomiej Sieka
  2008-02-20 19:19   ` Kumar Gala
  2008-02-20 17:20 ` [U-Boot-Users] [PATCH 4/6] [new uImage] Add fit_parse_conf() and fit_parse_subimage() routines Bartlomiej Sieka
                   ` (2 subsequent siblings)
  5 siblings, 1 reply; 16+ messages in thread
From: Bartlomiej Sieka @ 2008-02-20 17:20 UTC (permalink / raw)
  To: u-boot

From: Marian Balakowicz <m8@semihalf.com>

This routine assures that image (whether legacy or FIT) is not
in a special dataflash storage.

If image address is a dataflash address image is moved to system RAM.

Signed-off-by: Marian Balakowicz <m8@semihalf.com>
---

 common/cmd_bootm.c |   22 +--------
 common/image.c     |  124 +++++++++++++++++++++++++++++++++++++++++++---------
 include/image.h    |    6 +++
 lib_ppc/bootm.c    |    5 ++
 4 files changed, 117 insertions(+), 40 deletions(-)

diff --git a/common/cmd_bootm.c b/common/cmd_bootm.c
index 2ddb191..ebb6b69 100644
--- a/common/cmd_bootm.c
+++ b/common/cmd_bootm.c
@@ -44,10 +44,6 @@
 #include <hush.h>
 #endif
 
-#ifdef CONFIG_HAS_DATAFLASH
-#include <dataflash.h>
-#endif
-
 DECLARE_GLOBAL_DATA_PTR;
 
 extern int gunzip (void *dst, int dstlen, unsigned char *src, unsigned long *lenp);
@@ -304,12 +300,8 @@ static image_header_t *get_kernel (cmd_tbl_t *cmdtp, int flag,
 	show_boot_progress (1);
 	printf ("## Booting image at %08lx ...\n", img_addr);
 
-#ifdef CONFIG_HAS_DATAFLASH
-	if (addr_dataflash (img_addr)){
-		hdr = (image_header_t *)CFG_LOAD_ADDR;
-		read_dataflash (img_addr, image_get_header_size (), (char *)hdr);
-	} else
-#endif
+	/* copy from dataflash if needed */
+	img_addr = gen_get_image (img_addr);
 	hdr = (image_header_t *)img_addr;
 
 	if (!image_check_magic(hdr)) {
@@ -324,16 +316,8 @@ static image_header_t *get_kernel (cmd_tbl_t *cmdtp, int flag,
 		show_boot_progress (-2);
 		return NULL;
 	}
-	show_boot_progress (3);
 
-#ifdef CONFIG_HAS_DATAFLASH
-	if (addr_dataflash (img_addr))
-		read_dataflash (img_addr + image_get_header_size (),
-				image_get_data_size (hdr),
-				(char *)image_get_data (hdr));
-#endif
-
-	/* uImage is in a system RAM, pointed to by hdr */
+	show_boot_progress (3);
 	print_image_hdr (hdr);
 
 	if (verify) {
diff --git a/common/image.c b/common/image.c
index 39e5f23..8d5ca4e 100644
--- a/common/image.c
+++ b/common/image.c
@@ -41,6 +41,12 @@
 #include <logbuff.h>
 #endif
 
+#if defined(CONFIG_FIT)
+#include <fdt.h>
+#include <libfdt.h>
+#include <fdt_support.h>
+#endif
+
 extern int do_reset (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]);
 
 #ifdef CONFIG_CMD_BDI
@@ -305,6 +311,101 @@ const char* image_get_comp_name (uint8_t comp)
 }
 
 /**
+ * gen_image_get_format - get image format type
+ * @img_addr: image start address
+ *
+ * gen_image_get_format() checks whether provided address points to a valid
+ * legacy or FIT image.
+ *
+ * returns:
+ *     image format type or IMAGE_FORMAT_INVALID if no image is present
+ */
+int gen_image_get_format (void *img_addr)
+{
+	ulong		format = IMAGE_FORMAT_INVALID;
+	image_header_t	*hdr;
+#if defined(CONFIG_FIT)
+	char		*fit_hdr;
+#endif
+
+	hdr = (image_header_t *)img_addr;
+	if (image_check_magic(hdr))
+		format = IMAGE_FORMAT_LEGACY;
+#if defined(CONFIG_FIT)
+	else {
+		fit_hdr = (char *)img_addr;
+		if (fdt_check_header (fit_hdr) == 0)
+			format = IMAGE_FORMAT_FIT;
+	}
+#endif
+
+	return format;
+}
+
+/**
+ * gen_get_image - get image from special storage (if necessary)
+ * @img_addr: image start address
+ *
+ * gen_get_image() checks if provided image start adddress is located
+ * in a dataflash storage. If so, image is moved to a system RAM memory.
+ *
+ * returns:
+ *     image start address after possible relocation from special storage
+ */
+ulong gen_get_image (ulong img_addr)
+{
+	ulong ram_addr, h_size, d_size;
+
+	h_size = image_get_header_size ();
+#if defined(CONFIG_FIT)
+	if (sizeof(struct fdt_header) > h_size)
+		h_size = sizeof(struct fdt_header);
+#endif
+
+#ifdef CONFIG_HAS_DATAFLASH
+	if (addr_dataflash (img_addr)){
+		ram_addr = CFG_LOAD_ADDR;
+		debug ("   Reading image header from dataflash address "
+			"%08lx to RAM address %08lx\n", img_addr, ram_addr);
+		read_dataflash (img_addr, h_size, (char *)ram_addr);
+	} else
+#endif
+	ram_addr = img_addr;
+
+	switch (gen_image_get_format ((void *)ram_addr)) {
+	case IMAGE_FORMAT_LEGACY:
+		d_size = image_get_data_size ((image_header_t *)ram_addr);
+		debug ("   Legacy format image found at 0x%08lx, size 0x%08lx\n",
+				ram_addr, d_size);
+		break;
+#if defined(CONFIG_FIT)
+	case IMAGE_FORMAT_FIT:
+		d_size = fdt_totalsize((void *)ram_addr) - h_size;
+		debug ("   FIT/FDT format image found at 0x%08lx, size 0x%08lx\n",
+				ram_addr, d_size);
+
+		break;
+#endif
+	default:
+		printf ("   No valid image found at 0x%08lx\n", img_addr);
+		return ram_addr;
+	}
+
+#ifdef CONFIG_HAS_DATAFLASH
+	if (addr_dataflash (img_addr)) {
+		debug ("   Reading image remaining data from dataflash address "
+			"%08lx to RAM address %08lx\n", img_addr + h_size,
+			ram_addr + h_size);
+
+		read_dataflash (img_addr + h_size, d_size,
+				(char *)(ram_addr + h_size));
+	}
+#endif
+
+	return ram_addr;
+}
+
+/**
  * image_get_ramdisk - get and verify ramdisk image
  * @cmdtp: command table pointer
  * @flag: command flag
@@ -334,15 +435,8 @@ image_header_t* image_get_ramdisk (cmd_tbl_t *cmdtp, int flag,
 
 	show_boot_progress (9);
 
-#ifdef CONFIG_HAS_DATAFLASH
-	if (addr_dataflash (rd_addr)) {
-		rd_hdr = (image_header_t *)CFG_LOAD_ADDR;
-		debug ("   Reading Ramdisk image header from dataflash address "
-			"%08lx to %08lx\n", rd_addr, (ulong)rd_hdr);
-		read_dataflash (rd_addr, image_get_header_size (),
-				(char *)rd_hdr);
-	} else
-#endif
+	/* copy from dataflash if needed */
+	rd_addr = gen_get_image (rd_addr);
 	rd_hdr = (image_header_t *)rd_addr;
 
 	if (!image_check_magic (rd_hdr)) {
@@ -360,18 +454,6 @@ image_header_t* image_get_ramdisk (cmd_tbl_t *cmdtp, int flag,
 	show_boot_progress (10);
 	print_image_hdr (rd_hdr);
 
-#ifdef CONFIG_HAS_DATAFLASH
-	if (addr_dataflash (rd_addr)) {
-		debug ("   Reading Ramdisk image data from dataflash address "
-			"%08lx to %08lx\n", rd_addr + image_get_header_size,
-			(ulong)image_get_data (rd_hdr));
-
-		read_dataflash (rd_addr + image_get_header_size (),
-				image_get_data_size (rd_hdr),
-				(char *)image_get_data (rd_hdr));
-	}
-#endif
-
 	if (verify) {
 		puts("   Verifying Checksum ... ");
 		if (!image_check_dcrc_wd (rd_hdr, CHUNKSZ)) {
diff --git a/include/image.h b/include/image.h
index ecfce72..b4de49d 100644
--- a/include/image.h
+++ b/include/image.h
@@ -343,6 +343,12 @@ const char* image_get_arch_name (uint8_t arch);
 const char* image_get_type_name (uint8_t type);
 const char* image_get_comp_name (uint8_t comp);
 
+#define IMAGE_FORMAT_INVALID	0x00
+#define IMAGE_FORMAT_LEGACY	0x01
+#define IMAGE_FORMAT_FIT	0x02
+int gen_image_get_format (void *img_addr);
+ulong gen_get_image (ulong img_addr);
+
 image_header_t* image_get_ramdisk (cmd_tbl_t *cmdtp, int flag,
 		int argc, char *argv[],
 		ulong rd_addr, uint8_t arch, int verify);
diff --git a/lib_ppc/bootm.c b/lib_ppc/bootm.c
index 69ec459..04a9665 100644
--- a/lib_ppc/bootm.c
+++ b/lib_ppc/bootm.c
@@ -234,6 +234,11 @@ static ulong get_fdt (ulong alloc_current,
 
 	if(argc > 3) {
 		fdt = (char *)simple_strtoul (argv[3], NULL, 16);
+
+		debug ("## Checking for 'FDT'/'FDT image' at %08lx\n", fdt);
+
+		/* copy from dataflash if needed */
+		fdt = (char *)gen_get_image ((ulong)fdt);
 		fdt_hdr = (image_header_t *)fdt;
 
 		if (fdt_check_header (fdt) == 0) {

^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [U-Boot-Users] [PATCH 4/6] [new uImage] Add fit_parse_conf() and fit_parse_subimage() routines
  2008-02-20 17:19 [U-Boot-Users] [PATCH 0/6] [new uImage] patchset4 - assorted patches Bartlomiej Sieka
                   ` (2 preceding siblings ...)
  2008-02-20 17:20 ` [U-Boot-Users] [PATCH 3/6] [new uImage] Add gen_get_image() routine Bartlomiej Sieka
@ 2008-02-20 17:20 ` Bartlomiej Sieka
  2008-02-20 19:27   ` Kumar Gala
  2008-02-20 17:20 ` [U-Boot-Users] [PATCH 5/6] [new uImage] Rename and move print_image_hdr() routine Bartlomiej Sieka
  2008-02-20 17:20 ` [U-Boot-Users] [PATCH 6/6] [new uImage] Fix erroneous use of image_get_magic() in fdc/usb cmds Bartlomiej Sieka
  5 siblings, 1 reply; 16+ messages in thread
From: Bartlomiej Sieka @ 2008-02-20 17:20 UTC (permalink / raw)
  To: u-boot

From: Marian Balakowicz <m8@semihalf.com>

New routines for parsing new uImage format bootm arguments:
[<addr>]#<conf>		- configuration spec
[<addr>]:<subimg>	- subimage spec

Signed-off-by: Marian Balakowicz <m8@semihalf.com>
---

 common/image.c  |   78 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
 include/image.h |   10 +++++++
 2 files changed, 88 insertions(+), 0 deletions(-)

diff --git a/common/image.c b/common/image.c
index 8d5ca4e..c9a09ce 100644
--- a/common/image.c
+++ b/common/image.c
@@ -772,4 +772,82 @@ ulong get_boot_kbd (ulong alloc_current, bd_t **kbd)
 }
 #endif /* CONFIG_PPC || CONFIG_M68K */
 
+#if defined(CONFIG_FIT)
+/*****************************************************************************/
+/* New uImage format routines */
+/*****************************************************************************/
+static int fit_parse_spec (const char *spec, char sepc, ulong addr_curr,
+		ulong *addr, const char **name)
+{
+	const char *sep;
+
+	*addr = addr_curr;
+	*name = NULL;
+
+	sep = strchr (spec, sepc);
+	if (sep) {
+		if (sep - spec > 0)
+			*addr = simple_strtoul (spec, NULL, 16);
+
+		*name = sep + 1;
+		return 1;
+	}
+
+	return 0;
+}
+
+/**
+ * fit_parse_conf - parse FIT configuration spec
+ * @spec: input string, containing configuration spec
+ * @add_curr: current image address (to be used as a possible default)
+ * @addr: pointer to a ulong variable, will hold FIT image address of a given
+ * configuration
+ * @conf_name double pointer to a char, will hold pointer to a configuration
+ * unit name
+ *
+ * fit_parse_conf() expects configuration spec in the for of [<addr>]#<conf>,
+ * where <addr> is a FIT image address that contains configuration
+ * with a <conf> unit name.
+ *
+ * Address part is optional, and if omitted default add_curr will
+ * be used instead.
+ *
+ * returns:
+ *     1 if spec is a valid configuration string,
+ *     addr and conf_name are set accordingly
+ *     0 otherwise
+ */
+inline int fit_parse_conf (const char *spec, ulong addr_curr,
+		ulong *addr, const char **conf_name)
+{
+	return fit_parse_spec (spec, '#', addr_curr, addr, conf_name);
+}
+
+/**
+ * fit_parse_subimage - parse FIT subimage spec
+ * @spec: input string, containing subimage spec
+ * @add_curr: current image address (to be used as a possible default)
+ * @addr: pointer to a ulong variable, will hold FIT image address of a given
+ * subimage
+ * @image_name: double pointer to a char, will hold pointer to a subimage name
+ *
+ * fit_parse_subimage() expects subimage spec in the for of
+ * [<addr>]:<subimage>, where <addr> is a FIT image address that contains
+ * subimage with a <subimg> unit name.
+ *
+ * Address part is optional, and if omitted default add_curr will
+ * be used instead.
+ *
+ * returns:
+ *     1 if spec is a valid subimage string,
+ *     addr and image_name are set accordingly
+ *     0 otherwise
+ */
+inline int fit_parse_subimage (const char *spec, ulong addr_curr,
+		ulong *addr, const char **image_name)
+{
+	return fit_parse_spec (spec, ':', addr_curr, addr, image_name);
+}
+#endif /* CONFIG_FIT */
+
 #endif /* USE_HOSTCC */
diff --git a/include/image.h b/include/image.h
index b4de49d..4923612 100644
--- a/include/image.h
+++ b/include/image.h
@@ -367,6 +367,16 @@ ulong get_boot_cmdline (ulong alloc_current, ulong *cmd_start, ulong *cmd_end);
 ulong get_boot_kbd (ulong alloc_current, bd_t **kbd);
 #endif /* CONFIG_PPC || CONFIG_M68K */
 
+#if defined(CONFIG_FIT)
+/*
+ * New uImage format
+ */
+inline int fit_parse_conf (const char *spec, ulong addr_curr,
+		ulong *addr, const char **conf_name);
+inline int fit_parse_subimage (const char *spec, ulong addr_curr,
+		ulong *addr, const char **image_name);
+#endif /* CONFIG_FIT */
+
 #endif /* USE_HOSTCC */
 
 #endif	/* __IMAGE_H__ */

^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [U-Boot-Users] [PATCH 5/6] [new uImage] Rename and move print_image_hdr() routine
  2008-02-20 17:19 [U-Boot-Users] [PATCH 0/6] [new uImage] patchset4 - assorted patches Bartlomiej Sieka
                   ` (3 preceding siblings ...)
  2008-02-20 17:20 ` [U-Boot-Users] [PATCH 4/6] [new uImage] Add fit_parse_conf() and fit_parse_subimage() routines Bartlomiej Sieka
@ 2008-02-20 17:20 ` Bartlomiej Sieka
  2008-02-20 17:20 ` [U-Boot-Users] [PATCH 6/6] [new uImage] Fix erroneous use of image_get_magic() in fdc/usb cmds Bartlomiej Sieka
  5 siblings, 0 replies; 16+ messages in thread
From: Bartlomiej Sieka @ 2008-02-20 17:20 UTC (permalink / raw)
  To: u-boot

From: Marian Balakowicz <m8@semihalf.com>

Signed-off-by: Marian Balakowicz <m8@semihalf.com>
---

 board/mpl/common/common_util.c |    2 +
 common/cmd_bootm.c             |   60 ++--------------------------------------
 common/cmd_doc.c               |    2 +
 common/cmd_fdc.c               |    2 +
 common/cmd_ide.c               |    2 +
 common/cmd_nand.c              |    4 +--
 common/cmd_scsi.c              |    2 +
 common/cmd_usb.c               |    2 +
 common/cmd_ximg.c              |    2 +
 common/image.c                 |   56 +++++++++++++++++++++++++++++++++++++
 include/common.h               |    3 --
 include/image.h                |    1 +
 lib_ppc/bootm.c                |    2 +
 13 files changed, 69 insertions(+), 71 deletions(-)

diff --git a/board/mpl/common/common_util.c b/board/mpl/common/common_util.c
index 30c6ca9..b171ca5 100644
--- a/board/mpl/common/common_util.c
+++ b/board/mpl/common/common_util.c
@@ -185,7 +185,7 @@ mpl_prg_image(uchar *ld_addr)
 		puts("Bad Magic Number\n");
 		return 1;
 	}
-	print_image_hdr(hdr);
+	image_print_contents (hdr);
 	if (!image_check_os (hdr, IH_OS_U_BOOT)) {
 		puts("No U-Boot Image\n");
 		return 1;
diff --git a/common/cmd_bootm.c b/common/cmd_bootm.c
index ebb6b69..846af3e 100644
--- a/common/cmd_bootm.c
+++ b/common/cmd_bootm.c
@@ -36,10 +36,6 @@
 #include <environment.h>
 #include <asm/byteorder.h>
 
-#if defined(CONFIG_TIMESTAMP) || defined(CONFIG_CMD_DATE)
-#include <rtc.h>
-#endif
-
 #ifdef CFG_HUSH_PARSER
 #include <hush.h>
 #endif
@@ -318,7 +314,7 @@ static image_header_t *get_kernel (cmd_tbl_t *cmdtp, int flag,
 	}
 
 	show_boot_progress (3);
-	print_image_hdr (hdr);
+	image_print_contents (hdr);
 
 	if (verify) {
 		puts ("   Verifying Checksum ... ");
@@ -445,7 +441,7 @@ static int image_info (ulong addr)
 		return 1;
 	}
 
-	print_image_hdr (hdr);
+	image_print_contents (hdr);
 
 	puts ("   Verifying Checksum ... ");
 	if (!image_check_dcrc (hdr)) {
@@ -493,7 +489,7 @@ int do_imls (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
 				goto next_sector;
 
 			printf ("Image at %08lX:\n", (ulong)hdr);
-			print_image_hdr (hdr);
+			image_print_contents (hdr);
 
 			puts ("   Verifying Checksum ... ");
 			if (!image_check_dcrc (hdr)) {
@@ -521,56 +517,6 @@ U_BOOT_CMD(
 /*******************************************************************/
 /* helper routines */
 /*******************************************************************/
-void print_image_hdr (image_header_t *hdr)
-{
-#if defined(CONFIG_TIMESTAMP) || defined(CONFIG_CMD_DATE)
-	time_t timestamp = (time_t)image_get_time (hdr);
-	struct rtc_time tm;
-#endif
-
-	printf ("   Image Name:   %.*s\n", IH_NMLEN, image_get_name (hdr));
-
-#if defined(CONFIG_TIMESTAMP) || defined(CONFIG_CMD_DATE)
-	to_tm (timestamp, &tm);
-	printf ("   Created:      %4d-%02d-%02d  %2d:%02d:%02d UTC\n",
-		tm.tm_year, tm.tm_mon, tm.tm_mday,
-		tm.tm_hour, tm.tm_min, tm.tm_sec);
-#endif
-	puts ("   Image Type:   ");
-	print_type (hdr);
-
-	printf ("\n   Data Size:    %d Bytes = ", image_get_data_size (hdr));
-	print_size (image_get_data_size (hdr), "\n");
-	printf ("   Load Address: %08x\n"
-		"   Entry Point:  %08x\n",
-		 image_get_load (hdr), image_get_ep (hdr));
-
-	if (image_check_type (hdr, IH_TYPE_MULTI)) {
-		int i;
-		ulong data, len;
-		ulong count = image_multi_count (hdr);
-
-		puts ("   Contents:\n");
-		for (i = 0; i < count; i++) {
-			image_multi_getimg (hdr, i, &data, &len);
-			printf ("   Image %d: %8ld Bytes = ", i, len);
-			print_size (len, "\n");
-		}
-	}
-}
-
-static void print_type (image_header_t *hdr)
-{
-	const char *os, *arch, *type, *comp;
-
-	os = image_get_os_name (image_get_os (hdr));
-	arch = image_get_arch_name (image_get_arch (hdr));
-	type = image_get_type_name (image_get_type (hdr));
-	comp = image_get_comp_name (image_get_comp (hdr));
-
-	printf ("%s %s %s (%s)", arch, os, type, comp);
-}
-
 #ifdef CONFIG_SILENT_CONSOLE
 static void fixup_silent_linux ()
 {
diff --git a/common/cmd_doc.c b/common/cmd_doc.c
index b20a2e1..70bbd31 100644
--- a/common/cmd_doc.c
+++ b/common/cmd_doc.c
@@ -265,7 +265,7 @@ int do_docboot (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
 
 	if (image_check_magic (hdr)) {
 
-		print_image_hdr (hdr);
+		image_print_contents (hdr);
 
 		cnt = image_get_image_size (hdr);
 		cnt -= SECTORSIZE;
diff --git a/common/cmd_fdc.c b/common/cmd_fdc.c
index 3b8f80b..c97abfb 100644
--- a/common/cmd_fdc.c
+++ b/common/cmd_fdc.c
@@ -840,7 +840,7 @@ int do_fdcboot (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
 		printf ("Bad Magic Number\n");
 		return 1;
 	}
-	print_image_hdr (hdr);
+	image_print_contents (hdr);
 
 	imsize= image_get_image_size (hdr);
 	nrofblk=imsize/512;
diff --git a/common/cmd_ide.c b/common/cmd_ide.c
index bcd1325..a396643 100644
--- a/common/cmd_ide.c
+++ b/common/cmd_ide.c
@@ -462,7 +462,7 @@ int do_diskboot (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
 	}
 	show_boot_progress (50);
 
-	print_image_hdr (hdr);
+	image_print_contents (hdr);
 
 	cnt = image_get_image_size (hdr);
 	cnt += info.blksz - 1;
diff --git a/common/cmd_nand.c b/common/cmd_nand.c
index bfa39d7..7fd6667 100644
--- a/common/cmd_nand.c
+++ b/common/cmd_nand.c
@@ -521,7 +521,7 @@ static int nand_load_image(cmd_tbl_t *cmdtp, nand_info_t *nand,
 	}
 	show_boot_progress (57);
 
-	print_image_hdr (hdr);
+	image_print_contents (hdr);
 
 	cnt = image_get_image_size (hdr);
 	if (jffs2) {
@@ -984,7 +984,7 @@ int do_nandboot (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
 
 	if (image_check_magic (hdr)) {
 
-		print_image_hdr (hdr);
+		image_print_contents (hdr);
 
 		cnt = image_get_image_size (hdr);
 		cnt -= SECTORSIZE;
diff --git a/common/cmd_scsi.c b/common/cmd_scsi.c
index c2b27a5..5aae7ec 100644
--- a/common/cmd_scsi.c
+++ b/common/cmd_scsi.c
@@ -285,7 +285,7 @@ int do_scsiboot (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
 		return 1;
 	}
 
-	print_image_hdr (hdr);
+	image_print_contents (hdr);
 	cnt = image_get_image_size (hdr);
 	cnt += info.blksz - 1;
 	cnt /= info.blksz;
diff --git a/common/cmd_usb.c b/common/cmd_usb.c
index db2e754..2d7a85a 100644
--- a/common/cmd_usb.c
+++ b/common/cmd_usb.c
@@ -398,7 +398,7 @@ int do_usbboot (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
 		return 1;
 	}
 
-	print_image_hdr (hdr);
+	image_print_contents (hdr);
 
 	cnt = image_get_image_size (hdr);
 	cnt += info.blksz - 1;
diff --git a/common/cmd_ximg.c b/common/cmd_ximg.c
index ab579cd..7d83dc3 100644
--- a/common/cmd_ximg.c
+++ b/common/cmd_ximg.c
@@ -70,7 +70,7 @@ do_imgextract(cmd_tbl_t * cmdtp, int flag, int argc, char *argv[])
 		return 1;
 	}
 #ifdef DEBUG
-	print_image_hdr (hdr);
+	image_print_contents (hdr);
 #endif
 
 	if (!image_check_type (hdr, IH_TYPE_MULTI)) {
diff --git a/common/image.c b/common/image.c
index c9a09ce..42b0d78 100644
--- a/common/image.c
+++ b/common/image.c
@@ -41,6 +41,10 @@
 #include <logbuff.h>
 #endif
 
+#if defined(CONFIG_TIMESTAMP) || defined(CONFIG_CMD_DATE)
+#include <rtc.h>
+#endif
+
 #if defined(CONFIG_FIT)
 #include <fdt.h>
 #include <libfdt.h>
@@ -310,6 +314,56 @@ const char* image_get_comp_name (uint8_t comp)
 	return name;
 }
 
+static void image_print_type (image_header_t *hdr)
+{
+	const char *os, *arch, *type, *comp;
+
+	os = image_get_os_name (image_get_os (hdr));
+	arch = image_get_arch_name (image_get_arch (hdr));
+	type = image_get_type_name (image_get_type (hdr));
+	comp = image_get_comp_name (image_get_comp (hdr));
+
+	printf ("%s %s %s (%s)", arch, os, type, comp);
+}
+
+void image_print_contents (image_header_t *hdr)
+{
+#if defined(CONFIG_TIMESTAMP) || defined(CONFIG_CMD_DATE)
+	time_t timestamp = (time_t)image_get_time (hdr);
+	struct rtc_time tm;
+#endif
+
+	printf ("   Image Name:   %.*s\n", IH_NMLEN, image_get_name (hdr));
+
+#if defined(CONFIG_TIMESTAMP) || defined(CONFIG_CMD_DATE)
+	to_tm (timestamp, &tm);
+	printf ("   Created:      %4d-%02d-%02d  %2d:%02d:%02d UTC\n",
+		tm.tm_year, tm.tm_mon, tm.tm_mday,
+		tm.tm_hour, tm.tm_min, tm.tm_sec);
+#endif
+	puts ("   Image Type:   ");
+	image_print_type (hdr);
+
+	printf ("\n   Data Size:    %d Bytes = ", image_get_data_size (hdr));
+	print_size (image_get_data_size (hdr), "\n");
+	printf ("   Load Address: %08x\n"
+		"   Entry Point:  %08x\n",
+		 image_get_load (hdr), image_get_ep (hdr));
+
+	if (image_check_type (hdr, IH_TYPE_MULTI)) {
+		int i;
+		ulong data, len;
+		ulong count = image_multi_count (hdr);
+
+		puts ("   Contents:\n");
+		for (i = 0; i < count; i++) {
+			image_multi_getimg (hdr, i, &data, &len);
+			printf ("   Image %d: %8ld Bytes = ", i, len);
+			print_size (len, "\n");
+		}
+	}
+}
+
 /**
  * gen_image_get_format - get image format type
  * @img_addr: image start address
@@ -452,7 +506,7 @@ image_header_t* image_get_ramdisk (cmd_tbl_t *cmdtp, int flag,
 	}
 
 	show_boot_progress (10);
-	print_image_hdr (rd_hdr);
+	image_print_contents (rd_hdr);
 
 	if (verify) {
 		puts("   Verifying Checksum ... ");
diff --git a/include/common.h b/include/common.h
index c4ee3e2..92baac9 100644
--- a/include/common.h
+++ b/include/common.h
@@ -221,9 +221,6 @@ void flash_perror (int);
 /* common/cmd_autoscript.c */
 int	autoscript (ulong addr);
 
-/* common/cmd_bootm.c */
-void	print_image_hdr (image_header_t *hdr);
-
 extern ulong load_addr;		/* Default Load Address */
 
 /* common/cmd_nvedit.c */
diff --git a/include/image.h b/include/image.h
index 4923612..502d35a 100644
--- a/include/image.h
+++ b/include/image.h
@@ -342,6 +342,7 @@ const char* image_get_os_name (uint8_t os);
 const char* image_get_arch_name (uint8_t arch);
 const char* image_get_type_name (uint8_t type);
 const char* image_get_comp_name (uint8_t comp);
+void image_print_contents (image_header_t *hdr);
 
 #define IMAGE_FORMAT_INVALID	0x00
 #define IMAGE_FORMAT_LEGACY	0x01
diff --git a/lib_ppc/bootm.c b/lib_ppc/bootm.c
index 04a9665..d2ee3dc 100644
--- a/lib_ppc/bootm.c
+++ b/lib_ppc/bootm.c
@@ -254,7 +254,7 @@ static ulong get_fdt (ulong alloc_current,
 			printf ("## Flattened Device Tree Image@%08lx\n",
 					fdt_hdr);
 
-			print_image_hdr (fdt_hdr);
+			image_print_contents (fdt_hdr);
 
 			image_start = (ulong)fdt_hdr;
 			image_end = image_get_image_end (fdt_hdr);

^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [U-Boot-Users] [PATCH 6/6] [new uImage] Fix erroneous use of image_get_magic() in fdc/usb cmds
  2008-02-20 17:19 [U-Boot-Users] [PATCH 0/6] [new uImage] patchset4 - assorted patches Bartlomiej Sieka
                   ` (4 preceding siblings ...)
  2008-02-20 17:20 ` [U-Boot-Users] [PATCH 5/6] [new uImage] Rename and move print_image_hdr() routine Bartlomiej Sieka
@ 2008-02-20 17:20 ` Bartlomiej Sieka
  5 siblings, 0 replies; 16+ messages in thread
From: Bartlomiej Sieka @ 2008-02-20 17:20 UTC (permalink / raw)
  To: u-boot

From: Marian Balakowicz <m8@semihalf.com>

Signed-off-by: Marian Balakowicz <m8@semihalf.com>
---

 common/cmd_fdc.c |    2 +-
 common/cmd_usb.c |    2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/common/cmd_fdc.c b/common/cmd_fdc.c
index c97abfb..9ddc59b 100644
--- a/common/cmd_fdc.c
+++ b/common/cmd_fdc.c
@@ -836,7 +836,7 @@ int do_fdcboot (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
 		return 1;
 	}
 	hdr = (image_header_t *)addr;
-	if (!image_get_magic (hdr)) {
+	if (!image_check_magic (hdr)) {
 		printf ("Bad Magic Number\n");
 		return 1;
 	}
diff --git a/common/cmd_usb.c b/common/cmd_usb.c
index 2d7a85a..3f1aa7d 100644
--- a/common/cmd_usb.c
+++ b/common/cmd_usb.c
@@ -388,7 +388,7 @@ int do_usbboot (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
 
 	hdr = (image_header_t *)addr;
 
-	if (!image_get_magic (hdr)) {
+	if (!image_check_magic (hdr)) {
 		printf("\n** Bad Magic Number **\n");
 		return 1;
 	}

^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [U-Boot-Users] [PATCH 2/6] [libfdt] Fix compilation errors is fdt_support.c
  2008-02-20 17:20 ` [U-Boot-Users] [PATCH 2/6] [libfdt] Fix compilation errors is fdt_support.c Bartlomiej Sieka
@ 2008-02-20 17:33   ` Jerry Van Baren
  2008-02-20 19:10   ` Kumar Gala
  1 sibling, 0 replies; 16+ messages in thread
From: Jerry Van Baren @ 2008-02-20 17:33 UTC (permalink / raw)
  To: u-boot

Bartlomiej Sieka wrote:
> From: Marian Balakowicz <m8@semihalf.com>
> 
> fdt_support.c does not compile with the DEBUG enabled,
> correct arguments passed to debug() calls.
> 
> Signed-off-by: Marian Balakowicz <m8@semihalf.com>

Hi Bartlomiej,

It would be much better to cherry-pick the version that is in the main 
repository so that git knows that the two patches are the same.  Having 
a separate patch will set ourselves up for a merge conflict.

<http://www.denx.de/cgi-bin/gitweb.cgi?p=u-boot.git;a=commit;h=d9ad115bbf7bb0842de7dbd2502b7e430f83cc3d>

author		Kumar Gala <galak@kernel.crashing.org>
		Wed, 13 Feb 2008 21:09:58 +0000 (15:09 -0600)
committer	Wolfgang Denk <wd@denx.de>
		Wed, 13 Feb 2008 22:58:18 +0000 (23:58 +0100)
commit		d9ad115bbf7bb0842de7dbd2502b7e430f83cc3d
tree		5261939c31d5e6114eb928a6667e25b68baddf00
parent		10bbb38a402a2faf18858c451bcdc63d45888e6e

Best regards,
gvb

^ permalink raw reply	[flat|nested] 16+ messages in thread

* [U-Boot-Users] [PATCH 2/6] [libfdt] Fix compilation errors is fdt_support.c
  2008-02-20 17:20 ` [U-Boot-Users] [PATCH 2/6] [libfdt] Fix compilation errors is fdt_support.c Bartlomiej Sieka
  2008-02-20 17:33   ` Jerry Van Baren
@ 2008-02-20 19:10   ` Kumar Gala
  2008-02-20 20:36     ` Bartlomiej Sieka
  1 sibling, 1 reply; 16+ messages in thread
From: Kumar Gala @ 2008-02-20 19:10 UTC (permalink / raw)
  To: u-boot


On Feb 20, 2008, at 11:20 AM, Bartlomiej Sieka wrote:

> From: Marian Balakowicz <m8@semihalf.com>
>
> fdt_support.c does not compile with the DEBUG enabled,
> correct arguments passed to debug() calls.
>
> Signed-off-by: Marian Balakowicz <m8@semihalf.com>
> ---

This is fixed already.  We need up pull in the changes from 1.3.2-rc1+  
into u-boot-testing (and the branch).

- k

^ permalink raw reply	[flat|nested] 16+ messages in thread

* [U-Boot-Users] [PATCH 3/6] [new uImage] Add gen_get_image() routine
  2008-02-20 17:20 ` [U-Boot-Users] [PATCH 3/6] [new uImage] Add gen_get_image() routine Bartlomiej Sieka
@ 2008-02-20 19:19   ` Kumar Gala
  2008-02-20 20:38     ` Bartlomiej Sieka
  0 siblings, 1 reply; 16+ messages in thread
From: Kumar Gala @ 2008-02-20 19:19 UTC (permalink / raw)
  To: u-boot

> +/**
> + * gen_get_image - get image from special storage (if necessary)
> + * @img_addr: image start address
> + *
> + * gen_get_image() checks if provided image start adddress is located
> + * in a dataflash storage. If so, image is moved to a system RAM  
> memory.
> + *
> + * returns:
> + *     image start address after possible relocation from special  
> storage
> + */
> +ulong gen_get_image (ulong img_addr)
> +{
> +	ulong ram_addr, h_size, d_size;
> +
> +	h_size = image_get_header_size ();
> +#if defined(CONFIG_FIT)
> +	if (sizeof(struct fdt_header) > h_size)
> +		h_size = sizeof(struct fdt_header);
> +#endif
> +
> +#ifdef CONFIG_HAS_DATAFLASH
> +	if (addr_dataflash (img_addr)){
> +		ram_addr = CFG_LOAD_ADDR;
> +		debug ("   Reading image header from dataflash address "
> +			"%08lx to RAM address %08lx\n", img_addr, ram_addr);
> +		read_dataflash (img_addr, h_size, (char *)ram_addr);
> +	} else
> +#endif
> +	ram_addr = img_addr;

can we not early out at this point?

> +
> +	switch (gen_image_get_format ((void *)ram_addr)) {
> +	case IMAGE_FORMAT_LEGACY:
> +		d_size = image_get_data_size ((image_header_t *)ram_addr);
> +		debug ("   Legacy format image found at 0x%08lx, size 0x%08lx\n",
> +				ram_addr, d_size);
> +		break;
> +#if defined(CONFIG_FIT)
> +	case IMAGE_FORMAT_FIT:
> +		d_size = fdt_totalsize((void *)ram_addr) - h_size;
> +		debug ("   FIT/FDT format image found at 0x%08lx, size 0x%08lx\n",
> +				ram_addr, d_size);
> +
> +		break;
> +#endif
> +	default:
> +		printf ("   No valid image found at 0x%08lx\n", img_addr);
> +		return ram_addr;
> +	}
> +
> +#ifdef CONFIG_HAS_DATAFLASH
> +	if (addr_dataflash (img_addr)) {
> +		debug ("   Reading image remaining data from dataflash address "
> +			"%08lx to RAM address %08lx\n", img_addr + h_size,
> +			ram_addr + h_size);
> +
> +		read_dataflash (img_addr + h_size, d_size,
> +				(char *)(ram_addr + h_size));
> +	}
> +#endif
> +
> +	return ram_addr;
> +}

^ permalink raw reply	[flat|nested] 16+ messages in thread

* [U-Boot-Users] [PATCH 4/6] [new uImage] Add fit_parse_conf() and fit_parse_subimage() routines
  2008-02-20 17:20 ` [U-Boot-Users] [PATCH 4/6] [new uImage] Add fit_parse_conf() and fit_parse_subimage() routines Bartlomiej Sieka
@ 2008-02-20 19:27   ` Kumar Gala
  2008-02-20 20:39     ` Bartlomiej Sieka
  0 siblings, 1 reply; 16+ messages in thread
From: Kumar Gala @ 2008-02-20 19:27 UTC (permalink / raw)
  To: u-boot


On Feb 20, 2008, at 11:20 AM, Bartlomiej Sieka wrote:

> From: Marian Balakowicz <m8@semihalf.com>
>
> New routines for parsing new uImage format bootm arguments:
> [<addr>]#<conf>		- configuration spec
> [<addr>]:<subimg>	- subimage spec

I'm sure its be posted previously, but it would probably be nice to  
have more details in the commit message about what <conf> and <subimg>  
are all about.
>
>
> Signed-off-by: Marian Balakowicz <m8@semihalf.com>
> ---

- k

^ permalink raw reply	[flat|nested] 16+ messages in thread

* [U-Boot-Users] [PATCH 2/6] [libfdt] Fix compilation errors is fdt_support.c
  2008-02-20 19:10   ` Kumar Gala
@ 2008-02-20 20:36     ` Bartlomiej Sieka
  0 siblings, 0 replies; 16+ messages in thread
From: Bartlomiej Sieka @ 2008-02-20 20:36 UTC (permalink / raw)
  To: u-boot

Kumar Gala wrote:
[...]
>> fdt_support.c does not compile with the DEBUG enabled,
>> correct arguments passed to debug() calls.
>>
>> Signed-off-by: Marian Balakowicz <m8@semihalf.com>
>> ---
> 
> This is fixed already.

Yes, Jerry has also pointed this out. I haven't caught your fix, and
just posted the above patch while processing my backlog...


 > We need up pull in the changes from 1.3.2-rc1+
> into u-boot-testing (and the branch).

Right. Wolfgang -- could you do the pull? I'll re-base the patches and
resubmit.


Regards,
Bartlomiej

^ permalink raw reply	[flat|nested] 16+ messages in thread

* [U-Boot-Users] [PATCH 3/6] [new uImage] Add gen_get_image() routine
  2008-02-20 19:19   ` Kumar Gala
@ 2008-02-20 20:38     ` Bartlomiej Sieka
  2008-02-20 20:44       ` Kumar Gala
  0 siblings, 1 reply; 16+ messages in thread
From: Bartlomiej Sieka @ 2008-02-20 20:38 UTC (permalink / raw)
  To: u-boot

Kumar Gala wrote:
>> +/**
>> + * gen_get_image - get image from special storage (if necessary)
>> + * @img_addr: image start address
>> + *
>> + * gen_get_image() checks if provided image start adddress is located
>> + * in a dataflash storage. If so, image is moved to a system RAM memory.
>> + *
>> + * returns:
>> + *     image start address after possible relocation from special 
>> storage
>> + */
>> +ulong gen_get_image (ulong img_addr)
>> +{
>> +    ulong ram_addr, h_size, d_size;
>> +
>> +    h_size = image_get_header_size ();
>> +#if defined(CONFIG_FIT)
>> +    if (sizeof(struct fdt_header) > h_size)
>> +        h_size = sizeof(struct fdt_header);
>> +#endif
>> +
>> +#ifdef CONFIG_HAS_DATAFLASH
>> +    if (addr_dataflash (img_addr)){
>> +        ram_addr = CFG_LOAD_ADDR;
>> +        debug ("   Reading image header from dataflash address "
>> +            "%08lx to RAM address %08lx\n", img_addr, ram_addr);
>> +        read_dataflash (img_addr, h_size, (char *)ram_addr);
>> +    } else
>> +#endif
>> +    ram_addr = img_addr;
> 
> can we not early out at this point?

I'm not sure what you mean here -- could you clarify?

Thanks,
Bartlomiej

^ permalink raw reply	[flat|nested] 16+ messages in thread

* [U-Boot-Users] [PATCH 4/6] [new uImage] Add fit_parse_conf() and fit_parse_subimage() routines
  2008-02-20 19:27   ` Kumar Gala
@ 2008-02-20 20:39     ` Bartlomiej Sieka
  0 siblings, 0 replies; 16+ messages in thread
From: Bartlomiej Sieka @ 2008-02-20 20:39 UTC (permalink / raw)
  To: u-boot

Kumar Gala wrote:
> 
> On Feb 20, 2008, at 11:20 AM, Bartlomiej Sieka wrote:
> 
>> From: Marian Balakowicz <m8@semihalf.com>
>>
>> New routines for parsing new uImage format bootm arguments:
>> [<addr>]#<conf>        - configuration spec
>> [<addr>]:<subimg>    - subimage spec
> 
> I'm sure its be posted previously, but it would probably be nice to have 
> more details in the commit message about what <conf> and <subimg> are 
> all about.

OK, will add this in the next round.

Regards,
Bartlomiej

^ permalink raw reply	[flat|nested] 16+ messages in thread

* [U-Boot-Users] [PATCH 3/6] [new uImage] Add gen_get_image() routine
  2008-02-20 20:38     ` Bartlomiej Sieka
@ 2008-02-20 20:44       ` Kumar Gala
  2008-02-21 15:57         ` Bartlomiej Sieka
  0 siblings, 1 reply; 16+ messages in thread
From: Kumar Gala @ 2008-02-20 20:44 UTC (permalink / raw)
  To: u-boot


On Feb 20, 2008, at 2:38 PM, Bartlomiej Sieka wrote:

> Kumar Gala wrote:
>>> +/**
>>> + * gen_get_image - get image from special storage (if necessary)
>>> + * @img_addr: image start address
>>> + *
>>> + * gen_get_image() checks if provided image start adddress is  
>>> located
>>> + * in a dataflash storage. If so, image is moved to a system RAM  
>>> memory.
>>> + *
>>> + * returns:
>>> + *     image start address after possible relocation from special  
>>> storage
>>> + */
>>> +ulong gen_get_image (ulong img_addr)
>>> +{
>>> +    ulong ram_addr, h_size, d_size;
>>> +
>>> +    h_size = image_get_header_size ();
>>> +#if defined(CONFIG_FIT)
>>> +    if (sizeof(struct fdt_header) > h_size)
>>> +        h_size = sizeof(struct fdt_header);
>>> +#endif
>>> +
>>> +#ifdef CONFIG_HAS_DATAFLASH
>>> +    if (addr_dataflash (img_addr)){
>>> +        ram_addr = CFG_LOAD_ADDR;
>>> +        debug ("   Reading image header from dataflash address "
>>> +            "%08lx to RAM address %08lx\n", img_addr, ram_addr);
>>> +        read_dataflash (img_addr, h_size, (char *)ram_addr);
>>> +    } else
>>> +#endif
>>> +    ram_addr = img_addr;
>> can we not early out at this point?
>
> I'm not sure what you mean here -- could you clarify?

Just that it seems like the code should be something like:

#ifdef CONFIG_HAS_DATAFLASH
	if (addr_dataflash(img_addr)) {
		...
	} else
#endif
		return img_addr;

unless I'm missing something the code should return 'img_addr' if we  
don't have to deal with dataflash (either by it not being config'd in  
or 'img_addr' isn't in a dataflash.

- k

^ permalink raw reply	[flat|nested] 16+ messages in thread

* [U-Boot-Users] [PATCH 3/6] [new uImage] Add gen_get_image() routine
  2008-02-20 20:44       ` Kumar Gala
@ 2008-02-21 15:57         ` Bartlomiej Sieka
  0 siblings, 0 replies; 16+ messages in thread
From: Bartlomiej Sieka @ 2008-02-21 15:57 UTC (permalink / raw)
  To: u-boot

Kumar Gala wrote:
>>>> +/**
>>>> + * gen_get_image - get image from special storage (if necessary)
>>>> + * @img_addr: image start address
>>>> + *
>>>> + * gen_get_image() checks if provided image start adddress is located
>>>> + * in a dataflash storage. If so, image is moved to a system RAM 
>>>> memory.
>>>> + *
>>>> + * returns:
>>>> + *     image start address after possible relocation from special 
>>>> storage
>>>> + */
>>>> +ulong gen_get_image (ulong img_addr)
>>>> +{
>>>> +    ulong ram_addr, h_size, d_size;
>>>> +
>>>> +    h_size = image_get_header_size ();
>>>> +#if defined(CONFIG_FIT)
>>>> +    if (sizeof(struct fdt_header) > h_size)
>>>> +        h_size = sizeof(struct fdt_header);
>>>> +#endif
>>>> +
>>>> +#ifdef CONFIG_HAS_DATAFLASH
>>>> +    if (addr_dataflash (img_addr)){
>>>> +        ram_addr = CFG_LOAD_ADDR;
>>>> +        debug ("   Reading image header from dataflash address "
>>>> +            "%08lx to RAM address %08lx\n", img_addr, ram_addr);
>>>> +        read_dataflash (img_addr, h_size, (char *)ram_addr);
>>>> +    } else
>>>> +#endif
>>>> +    ram_addr = img_addr;
>>> can we not early out at this point?
>>
>> I'm not sure what you mean here -- could you clarify?
> 
> Just that it seems like the code should be something like:
> 
> #ifdef CONFIG_HAS_DATAFLASH
>     if (addr_dataflash(img_addr)) {
>         ...
>     } else
> #endif
>         return img_addr;
> 
> unless I'm missing something the code should return 'img_addr' if we 
> don't have to deal with dataflash (either by it not being config'd in or 
> 'img_addr' isn't in a dataflash.

You're right, I'll make this change for the re-spin.

Cheers,
Bartlomiej

^ permalink raw reply	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2008-02-21 15:57 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-02-20 17:19 [U-Boot-Users] [PATCH 0/6] [new uImage] patchset4 - assorted patches Bartlomiej Sieka
2008-02-20 17:19 ` [U-Boot-Users] [PATCH 1/6] [new uImage] Pull in libfdt if CONFIG_FIT is enabled Bartlomiej Sieka
2008-02-20 17:20 ` [U-Boot-Users] [PATCH 2/6] [libfdt] Fix compilation errors is fdt_support.c Bartlomiej Sieka
2008-02-20 17:33   ` Jerry Van Baren
2008-02-20 19:10   ` Kumar Gala
2008-02-20 20:36     ` Bartlomiej Sieka
2008-02-20 17:20 ` [U-Boot-Users] [PATCH 3/6] [new uImage] Add gen_get_image() routine Bartlomiej Sieka
2008-02-20 19:19   ` Kumar Gala
2008-02-20 20:38     ` Bartlomiej Sieka
2008-02-20 20:44       ` Kumar Gala
2008-02-21 15:57         ` Bartlomiej Sieka
2008-02-20 17:20 ` [U-Boot-Users] [PATCH 4/6] [new uImage] Add fit_parse_conf() and fit_parse_subimage() routines Bartlomiej Sieka
2008-02-20 19:27   ` Kumar Gala
2008-02-20 20:39     ` Bartlomiej Sieka
2008-02-20 17:20 ` [U-Boot-Users] [PATCH 5/6] [new uImage] Rename and move print_image_hdr() routine Bartlomiej Sieka
2008-02-20 17:20 ` [U-Boot-Users] [PATCH 6/6] [new uImage] Fix erroneous use of image_get_magic() in fdc/usb cmds Bartlomiej Sieka

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox