Skip to contentSkip to conversation

patchset4 - assorted patches

PATCH Superseded Bartlomiej Sieka 3 participants 16 messages Feb 20, 2008 – Feb 21, 2008

lore
Share & tools
lore
#0 lore raw

cover patchset4 - assorted patches

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

#1 lore raw

PATCH 1/6 Pull in libfdt if CONFIG_FIT is enabled

From: Marian Balakowicz <[email protected]>

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.

---

 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(-)
cpu/mpc5xxx/cpu.c +1 -1
index e4d6168..7522afe 100644
@@ -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;
cpu/mpc8260/cpu.c +1 -1
index 55e61a1..414759e 100644
@@ -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;
cpu/mpc8xx/cpu.c +1 -1
index c878352..5d4ab82 100644
@@ -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;
include/image.h +9 -0
index dbbbee9..ecfce72 100644
@@ -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
#2 lore raw

PATCH 2/6 Fix compilation errors is fdt_support.c

In reply to Bartlomiej Sieka

From: Marian Balakowicz <[email protected]>

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

---

 common/fdt_support.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)
common/fdt_support.c +3 -3
index a13c140..628bbdd 100644
@@ -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");
#3 lore raw

PATCH 2/6 Fix compilation errors is fdt_support.c

Quoted 6 lines · Bartlomiej Sieka

From: Marian Balakowicz <[email protected]>

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

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 <[email protected]>

		Wed, 13 Feb 2008 21:09:58 +0000 (15:09 -0600)
committer	Wolfgang Denk <[email protected]>
		Wed, 13 Feb 2008 22:58:18 +0000 (23:58 +0100)

commit d9ad115bbf7bb0842de7dbd2502b7e430f83cc3d
tree 5261939c31d5e6114eb928a6667e25b68baddf00
parent 10bbb38a402a2faf18858c451bcdc63d45888e6e

Best regards,
gvb

#5 lore raw

PATCH 2/6 Fix compilation errors is fdt_support.c

Kumar Gala wrote:
[...]

Quoted 7 lines
Quoted 5 lines

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

---

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...

Quoted 2 lines

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

#6 lore raw

PATCH 3/6 Add gen_get_image() routine

In reply to Bartlomiej Sieka

From: Marian Balakowicz <[email protected]>

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.

---

 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(-)
common/cmd_bootm.c +3 -19
index 2ddb191..ebb6b69 100644
@@ -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) {
common/image.c +103 -21

148 lines not on this page · raw message

include/image.h +6 -0
index ecfce72..b4de49d 100644
@@ -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);
lib_ppc/bootm.c +5 -0
index 69ec459..04a9665 100644
@@ -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) {
#7 lore raw

PATCH 3/6 Add gen_get_image() routine

Quoted 21 lines

+/**
+ * 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
+ */

common/image.c +9 -0
+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

common/image.c const char* image_get_comp_name (uint8_t comp) · line 373

Quoted 10 lines
common/image.c +10 -0
+
+#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?

Quoted 33 lines
common/image.c +33 -0
+
+	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;
+}
#8 lore raw

PATCH 3/6 Add gen_get_image() routine

Quoted 24 lines · Kumar Gala
Quoted 24 lines

+/**
+ * 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
+ */

common/image.c +13 -0
+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;
Quoted 8 lines

common/image.c const char* image_get_comp_name (uint8_t comp) · line 373

Quoted 6 lines
common/image.c +6 -0
+        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

#9 lore raw

PATCH 3/6 Add gen_get_image() routine

Quoted 35 lines · Bartlomiej Sieka
Quoted 25 lines · Kumar Gala
Quoted 25 lines

+/**
+ * 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
+ */

common/image.c +12 -0
+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)){
Quoted 8 lines

common/image.c const char* image_get_comp_name (uint8_t comp) · line 373

Quoted 7 lines
common/image.c +7 -0
+        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?

Quoted 1 line

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

#10 lore raw

PATCH 3/6 Add gen_get_image() routine

Quoted 44 lines · Kumar Gala
Quoted 33 lines
Quoted 24 lines
Quoted 24 lines

+/**
+ * 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
+ */

common/image.c +12 -0
+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)){
Quoted 8 lines

common/image.c const char* image_get_comp_name (uint8_t comp) · line 373

Quoted 7 lines
common/image.c +7 -0
+        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?

Quoted 1 line

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;
Quoted 3 lines

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

#11 lore raw

PATCH 4/6 Add fit_parse_conf() and fit_parse_subimage() routines

In reply to Bartlomiej Sieka

From: Marian Balakowicz <[email protected]>

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

---

 common/image.c  |   78 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
 include/image.h |   10 +++++++
 2 files changed, 88 insertions(+), 0 deletions(-)
common/image.c +78 -0
index 8d5ca4e..c9a09ce 100644
@@ -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 */
include/image.h +10 -0
index b4de49d..4923612 100644
@@ -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__ */
#12 lore raw

PATCH 4/6 Add fit_parse_conf() and fit_parse_subimage() routines

Quoted 5 lines · Bartlomiej Sieka

From: Marian Balakowicz <[email protected]>

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.

Quoted 4 lines

---

- k

#13 lore raw

PATCH 4/6 Add fit_parse_conf() and fit_parse_subimage() routines

Quoted 5 lines · Kumar Gala
Quoted 2 lines · Bartlomiej Sieka

From: Marian Balakowicz <[email protected]>

Quoted 7 lines
Quoted 3 lines

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

#14 lore raw

PATCH 5/6 Rename and move print_image_hdr() routine

In reply to Bartlomiej Sieka

From: Marian Balakowicz <[email protected]>

---

 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(-)
board/mpl/common/common_util.c +1 -1
index 30c6ca9..b171ca5 100644
@@ -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;
common/cmd_bootm.c +3 -57

90 lines not on this page · raw message

common/cmd_doc.c +1 -1
index b20a2e1..70bbd31 100644
@@ -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;
common/cmd_fdc.c +1 -1
index 3b8f80b..c97abfb 100644
@@ -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;
common/cmd_ide.c +1 -1
index bcd1325..a396643 100644
@@ -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;
common/cmd_nand.c +2 -2
index bfa39d7..7fd6667 100644
@@ -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;
common/cmd_scsi.c +1 -1
index c2b27a5..5aae7ec 100644
@@ -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;
common/cmd_usb.c +1 -1
index db2e754..2d7a85a 100644
@@ -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;
common/cmd_ximg.c +1 -1
index ab579cd..7d83dc3 100644
@@ -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)) {
common/image.c +55 -1

74 lines not on this page · raw message

include/common.h +0 -3
index c4ee3e2..92baac9 100644
@@ -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 */
include/image.h +1 -0
index 4923612..502d35a 100644
@@ -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
lib_ppc/bootm.c +1 -1
index 04a9665..d2ee3dc 100644
@@ -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);
#15 lore raw

PATCH 6/6 Fix erroneous use of image_get_magic() in fdc/usb cmds

In reply to Bartlomiej Sieka

From: Marian Balakowicz <[email protected]>

---

 common/cmd_fdc.c |    2 +-
 common/cmd_usb.c |    2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
common/cmd_fdc.c +1 -1
index c97abfb..9ddc59b 100644
@@ -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;
 	}
common/cmd_usb.c +1 -1
index 2d7a85a..3f1aa7d 100644
@@ -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;
 	}