summaryrefslogtreecommitdiff
path: root/common/cmd_bootm.c
diff options
context:
space:
mode:
authorwdenk <wdenk>2003-07-24 23:38:38 +0000
committerwdenk <wdenk>2003-07-24 23:38:38 +0000
commit27b207fd0a0941b03f27e2a82c0468b1a090c745 (patch)
tree4d339d7a2a00889f09a876425ce430be57de56e9 /common/cmd_bootm.c
parent2535d60277cc295adf75cd5721dcecd840c69a63 (diff)
downloadu-boot-imx-27b207fd0a0941b03f27e2a82c0468b1a090c745.zip
u-boot-imx-27b207fd0a0941b03f27e2a82c0468b1a090c745.tar.gz
u-boot-imx-27b207fd0a0941b03f27e2a82c0468b1a090c745.tar.bz2
* Implement new mechanism to export U-Boot's functions to standalone
applications: instead of using (PPC-specific) system calls we now use a jump table; please see doc/README.standalone for details * Patch by Dave Westwood, 24 Jul 2003: added support for Unity OS (a proprietary OS)
Diffstat (limited to 'common/cmd_bootm.c')
-rw-r--r--common/cmd_bootm.c57
1 files changed, 57 insertions, 0 deletions
diff --git a/common/cmd_bootm.c b/common/cmd_bootm.c
index d1d03e3..1343659 100644
--- a/common/cmd_bootm.c
+++ b/common/cmd_bootm.c
@@ -80,6 +80,13 @@ static void zfree(void *, void *, unsigned);
#if (CONFIG_COMMANDS & CFG_CMD_IMI)
static int image_info (unsigned long addr);
#endif
+
+#if (CONFIG_COMMANDS & CFG_CMD_IMLS)
+#include <flash.h>
+extern flash_info_t flash_info[CFG_MAX_FLASH_BANKS]; /* info for FLASH chips */
+static int do_imls (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]);
+#endif
+
static void print_type (image_header_t *hdr);
#ifdef __I386__
@@ -961,6 +968,56 @@ U_BOOT_CMD(
#endif /* CFG_CMD_IMI */
+#if (CONFIG_COMMANDS & CFG_CMD_IMLS)
+/*-----------------------------------------------------------------------
+ * List all images found in flash.
+ */
+int do_imls (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
+{
+ flash_info_t *info;
+ int i, j;
+ image_header_t *hdr;
+ ulong checksum;
+
+ for (i=0, info=&flash_info[0]; i<CFG_MAX_FLASH_BANKS; ++i, ++info) {
+ if (info->flash_id == FLASH_UNKNOWN)
+ goto next_bank;
+ for (j=0; j<CFG_MAX_FLASH_SECT; ++j) {
+
+ if (!(hdr=(image_header_t *)info->start[j]) ||
+ (ntohl(hdr->ih_magic) != IH_MAGIC))
+ goto next_sector;
+
+ /* Copy header so we can blank CRC field for re-calculation */
+ memmove (&header, (char *)hdr, sizeof(image_header_t));
+
+ checksum = ntohl(header.ih_hcrc);
+ header.ih_hcrc = 0;
+
+ if (crc32 (0, (char *)&header, sizeof(image_header_t))
+ != checksum)
+ goto next_sector;
+
+ printf ("Image at %08lX:\n", (ulong)hdr);
+ print_image_hdr( hdr );
+ putc ('\n');
+ next_sector:
+ }
+ next_bank:
+ }
+
+ return (0);
+}
+
+U_BOOT_CMD(
+ imls, 1, 1, do_imls,
+ "imls - list all images found in flash\n",
+ "\n"
+ " - Prints information about all images found at sector\n"
+ " boundaries in flash.\n"
+);
+#endif /* CFG_CMD_IMLS */
+
void
print_image_hdr (image_header_t *hdr)
{