public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Bartlomiej Sieka <tur@semihalf.com>
To: u-boot@lists.denx.de
Subject: [U-Boot-Users] [PATCH 5/6] [new uImage] Rename and move print_image_hdr() routine
Date: Wed, 20 Feb 2008 18:20:21 +0100	[thread overview]
Message-ID: <20080220172021.25624.35330.stgit@pollux.denx.de> (raw)
In-Reply-To: <20080220171950.25624.71201.stgit@pollux.denx.de>

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

  parent reply	other threads:[~2008-02-20 17:20 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 ` Bartlomiej Sieka [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20080220172021.25624.35330.stgit@pollux.denx.de \
    --to=tur@semihalf.com \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox