]> git.kernelconcepts.de Git - karo-tx-uboot.git/commitdiff
[new uImage] Update naming convention for bootm/uImage related code
authorMarian Balakowicz <m8@semihalf.com>
Fri, 29 Feb 2008 13:58:34 +0000 (14:58 +0100)
committerMarian Balakowicz <m8@semihalf.com>
Fri, 29 Feb 2008 13:58:34 +0000 (14:58 +0100)
This patch introduces the following prefix convention for the
image format handling and bootm related code:

genimg_ - dual format shared code
image_ - legacy uImage format specific code
fit_ - new uImage format specific code
boot_ - booting process related code

Related routines are renamed and a few pieces of code are moved around and
re-grouped.

Signed-off-by: Marian Balakowicz <m8@semihalf.com>
25 files changed:
board/cray/L1/L1.c
board/esd/common/auto_update.c
board/mcc200/auto_update.c
board/mpl/common/common_util.c
board/siemens/common/fpga.c
board/trab/auto_update.c
common/cmd_autoscript.c
common/cmd_bootm.c
common/cmd_doc.c
common/cmd_fdc.c
common/cmd_fpga.c
common/cmd_ide.c
common/cmd_nand.c
common/cmd_scsi.c
common/cmd_usb.c
common/cmd_ximg.c
common/image.c
include/image.h
lib_arm/bootm.c
lib_avr32/bootm.c
lib_i386/bootm.c
lib_m68k/bootm.c
lib_mips/bootm.c
lib_ppc/bootm.c
tools/mkimage.c

index c00acc87aeaacd661b47a7dcf19f454175017aab..77f7f48a6ecb3f2a9234783ec65538d50f87f576 100644 (file)
@@ -141,7 +141,7 @@ int misc_init_r (void)
 
        hdr = (image_header_t *) (CFG_MONITOR_BASE - image_get_header_size ());
 #if defined(CONFIG_FIT)
-       if (gen_image_get_format ((void *)hdr) != IMAGE_FORMAT_LEGACY) {
+       if (genimg_get_format ((void *)hdr) != IMAGE_FORMAT_LEGACY) {
                puts ("Non legacy image format not supported\n");
                return -1;
        }
index 976707dfe65edb99c2ce9375165a178ea3bddb23..1bf81c699c804128f4f424e61d42cd0fb821364a 100644 (file)
@@ -92,7 +92,7 @@ int au_check_cksum_valid(int i, long nbytes)
 
        hdr = (image_header_t *)LOAD_ADDR;
 #if defined(CONFIG_FIT)
-       if (gen_image_get_format ((void *)hdr) != IMAGE_FORMAT_LEGACY) {
+       if (genimg_get_format ((void *)hdr) != IMAGE_FORMAT_LEGACY) {
                puts ("Non legacy image format not supported\n");
                return -1;
        }
@@ -125,7 +125,7 @@ int au_check_header_valid(int i, long nbytes)
 
        hdr = (image_header_t *)LOAD_ADDR;
 #if defined(CONFIG_FIT)
-       if (gen_image_get_format ((void *)hdr) != IMAGE_FORMAT_LEGACY) {
+       if (genimg_get_format ((void *)hdr) != IMAGE_FORMAT_LEGACY) {
                puts ("Non legacy image format not supported\n");
                return -1;
        }
@@ -197,7 +197,7 @@ int au_do_update(int i, long sz)
 
        hdr = (image_header_t *)LOAD_ADDR;
 #if defined(CONFIG_FIT)
-       if (gen_image_get_format ((void *)hdr) != IMAGE_FORMAT_LEGACY) {
+       if (genimg_get_format ((void *)hdr) != IMAGE_FORMAT_LEGACY) {
                puts ("Non legacy image format not supported\n");
                return -1;
        }
index fcae35aaf8f227614d55b9d0958032a30dabc569..5580c118878ae4fc76724eb9651311838e6737db 100644 (file)
@@ -144,7 +144,7 @@ int au_check_cksum_valid(int idx, long nbytes)
 
        hdr = (image_header_t *)LOAD_ADDR;
 #if defined(CONFIG_FIT)
-       if (gen_image_get_format ((void *)hdr) != IMAGE_FORMAT_LEGACY) {
+       if (genimg_get_format ((void *)hdr) != IMAGE_FORMAT_LEGACY) {
                puts ("Non legacy image format not supported\n");
                return -1;
        }
@@ -169,7 +169,7 @@ int au_check_header_valid(int idx, long nbytes)
 
        hdr = (image_header_t *)LOAD_ADDR;
 #if defined(CONFIG_FIT)
-       if (gen_image_get_format ((void *)hdr) != IMAGE_FORMAT_LEGACY) {
+       if (genimg_get_format ((void *)hdr) != IMAGE_FORMAT_LEGACY) {
                puts ("Non legacy image format not supported\n");
                return -1;
        }
@@ -247,7 +247,7 @@ int au_do_update(int idx, long sz)
 
        hdr = (image_header_t *)LOAD_ADDR;
 #if defined(CONFIG_FIT)
-       if (gen_image_get_format ((void *)hdr) != IMAGE_FORMAT_LEGACY) {
+       if (genimg_get_format ((void *)hdr) != IMAGE_FORMAT_LEGACY) {
                puts ("Non legacy image format not supported\n");
                return -1;
        }
index fffd25c2be2d968ee212fd7824bf172ea9c0ce41..785d20469640b7b1b6552c67345a62397e951725 100644 (file)
@@ -74,7 +74,7 @@ mpl_prg(uchar *src, ulong size)
        info = &flash_info[0];
 
 #if defined(CONFIG_PIP405) || defined(CONFIG_MIP405) || defined(CONFIG_PATI)
-       if (image_to_cpu (magic[0]) != IH_MAGIC) {
+       if (uimage_to_cpu (magic[0]) != IH_MAGIC) {
                puts("Bad Magic number\n");
                return -1;
        }
@@ -182,7 +182,7 @@ mpl_prg_image(uchar *ld_addr)
        int rc;
 
 #if defined(CONFIG_FIT)
-       if (gen_image_get_format ((void *)hdr) != IMAGE_FORMAT_LEGACY) {
+       if (genimg_get_format ((void *)hdr) != IMAGE_FORMAT_LEGACY) {
                puts ("Non legacy image format not supported\n");
                return -1;
        }
index a9a6dfed69a7ea36ac193be833ded081d18681e6..48c185082f8d3c5fbbcfd76d69a1e8d4f8d77313 100644 (file)
@@ -138,7 +138,7 @@ static int fpga_load (fpga_t* fpga, ulong addr, int checkall)
     int verify, i;
 
 #if defined(CONFIG_FIT)
-    if (gen_image_get_format ((void *)hdr) != IMAGE_FORMAT_LEGACY) {
+    if (genimg_get_format ((void *)hdr) != IMAGE_FORMAT_LEGACY) {
        puts ("Non legacy image format not supported\n");
        return -1;
     }
@@ -341,7 +341,7 @@ int fpga_init (void)
 
        hdr = (image_header_t *)addr;
 #if defined(CONFIG_FIT)
-       if (gen_image_get_format ((void *)hdr) != IMAGE_FORMAT_LEGACY) {
+       if (genimg_get_format ((void *)hdr) != IMAGE_FORMAT_LEGACY) {
           puts ("Non legacy image format not supported\n");
           return -1;
        }
index 8f6753592b6fb08f6543bfdcdc03386f4cd22681..fa08bffecd1d9f7aad65114ab7842a5b99f5eb1b 100644 (file)
@@ -212,7 +212,7 @@ au_check_cksum_valid(int idx, long nbytes)
 
        hdr = (image_header_t *)LOAD_ADDR;
 #if defined(CONFIG_FIT)
-       if (gen_image_get_format ((void *)hdr) != IMAGE_FORMAT_LEGACY) {
+       if (genimg_get_format ((void *)hdr) != IMAGE_FORMAT_LEGACY) {
                puts ("Non legacy image format not supported\n");
                return -1;
        }
@@ -241,7 +241,7 @@ au_check_header_valid(int idx, long nbytes)
 
        hdr = (image_header_t *)LOAD_ADDR;
 #if defined(CONFIG_FIT)
-       if (gen_image_get_format ((void *)hdr) != IMAGE_FORMAT_LEGACY) {
+       if (genimg_get_format ((void *)hdr) != IMAGE_FORMAT_LEGACY) {
                puts ("Non legacy image format not supported\n");
                return -1;
        }
@@ -341,7 +341,7 @@ au_do_update(int idx, long sz)
 
        hdr = (image_header_t *)LOAD_ADDR;
 #if defined(CONFIG_FIT)
-       if (gen_image_get_format ((void *)hdr) != IMAGE_FORMAT_LEGACY) {
+       if (genimg_get_format ((void *)hdr) != IMAGE_FORMAT_LEGACY) {
                puts ("Non legacy image format not supported\n");
                return -1;
        }
@@ -437,7 +437,7 @@ au_update_eeprom(int idx)
 
        hdr = (image_header_t *)LOAD_ADDR;
 #if defined(CONFIG_FIT)
-       if (gen_image_get_format ((void *)hdr) != IMAGE_FORMAT_LEGACY) {
+       if (genimg_get_format ((void *)hdr) != IMAGE_FORMAT_LEGACY) {
                puts ("Non legacy image format not supported\n");
                return -1;
        }
index f9ab1d9a13b15e7956d4acb518932ed17242a26c..60ffc7dbce84d3c974ab3ef44ca2997d056eee6d 100644 (file)
@@ -61,7 +61,7 @@ autoscript (ulong addr)
 
        verify = getenv_verify ();
 
-       switch (gen_image_get_format ((void *)addr)) {
+       switch (genimg_get_format ((void *)addr)) {
        case IMAGE_FORMAT_LEGACY:
                hdr = (image_header_t *)addr;
 
@@ -90,7 +90,7 @@ autoscript (ulong addr)
                /* get length of script */
                data = (ulong *)image_get_data (hdr);
 
-               if ((len = image_to_cpu (*data)) == 0) {
+               if ((len = uimage_to_cpu (*data)) == 0) {
                        puts ("Empty Script\n");
                        return 1;
                }
index 8595ef6889b1ac7674ee5177add6ea35622dadfd..10403aa0fa9ef80ae3f8475fdc17d93329fb4ac6 100644 (file)
@@ -66,7 +66,7 @@ static int do_imls (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]);
 static void fixup_silent_linux (void);
 #endif
 
-static void *get_kernel (cmd_tbl_t *cmdtp, int flag,int argc, char *argv[],
+static void *boot_get_kernel (cmd_tbl_t *cmdtp, int flag,int argc, char *argv[],
                bootm_headers_t *images, ulong *os_data, ulong *os_len);
 extern int do_reset (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]);
 
@@ -143,7 +143,7 @@ int do_bootm (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
        board_lmb_reserve(&lmb);
 
        /* get kernel image header, start address and length */
-       os_hdr = get_kernel (cmdtp, flag, argc, argv,
+       os_hdr = boot_get_kernel (cmdtp, flag, argc, argv,
                        &images, &os_data, &os_len);
        if (os_len == 0)
                return 1;
@@ -151,7 +151,7 @@ int do_bootm (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
        show_boot_progress (6);
 
        /* get image parameters */
-       switch (gen_image_get_format (os_hdr)) {
+       switch (genimg_get_format (os_hdr)) {
        case IMAGE_FORMAT_LEGACY:
                type = image_get_type (os_hdr);
                comp = image_get_comp (os_hdr);
@@ -172,7 +172,7 @@ int do_bootm (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
 
        image_start = (ulong)os_hdr;
        load_end = 0;
-       type_name = image_get_type_name (type);
+       type_name = genimg_get_type_name (type);
 
        /*
         * We have reached the point of no return: we are going to
@@ -309,16 +309,16 @@ int do_bootm (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
 }
 
 /**
- * get_kernel - find kernel image
- * @os_data: pointer to a ulong variable, will hold os data start address
- * @os_len: pointer to a ulong variable, will hold os data length
+ * image_get_kernel - verify legacy format kernel image
+ * @img_addr: in RAM address of the legacy format image to be verified
+ * @verify: data CRC verification flag
  *
- * get_kernel() tries to find a kernel image, verifies its integrity
- * and locates kernel data.
+ * image_get_kernel() verifies legacy image integrity and returns pointer to
+ * legacy image header if image verification was completed successfully.
  *
  * returns:
- *     pointer to image header if valid image was found, plus kernel start
- *     address and length, otherwise NULL
+ *     pointer to a legacy image header if valid image was found
+ *     otherwise return NULL
  */
 static image_header_t *image_get_kernel (ulong img_addr, int verify)
 {
@@ -360,18 +360,18 @@ static image_header_t *image_get_kernel (ulong img_addr, int verify)
 }
 
 /**
- * get_kernel - find kernel image
+ * boot_get_kernel - find kernel image
  * @os_data: pointer to a ulong variable, will hold os data start address
  * @os_len: pointer to a ulong variable, will hold os data length
  *
- * get_kernel() tries to find a kernel image, verifies its integrity
+ * boot_get_kernel() tries to find a kernel image, verifies its integrity
  * and locates kernel data.
  *
  * returns:
  *     pointer to image header if valid image was found, plus kernel start
  *     address and length, otherwise NULL
  */
-static void *get_kernel (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[],
+static void *boot_get_kernel (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[],
                bootm_headers_t *images, ulong *os_data, ulong *os_len)
 {
        image_header_t  *hdr;
@@ -406,10 +406,10 @@ static void *get_kernel (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[],
        printf ("## Booting kernel image at %08lx ...\n", img_addr);
 
        /* copy from dataflash if needed */
-       img_addr = gen_get_image (img_addr);
+       img_addr = genimg_get_image (img_addr);
 
        /* check image type, for FIT images get FIT kernel node */
-       switch (gen_image_get_format ((void *)img_addr)) {
+       switch (genimg_get_format ((void *)img_addr)) {
        case IMAGE_FORMAT_LEGACY:
 
                debug ("*  kernel: legacy format image\n");
@@ -531,7 +531,7 @@ static int image_info (ulong addr)
 
        printf ("\n## Checking Image at %08lx ...\n", addr);
 
-       switch (gen_image_get_format (hdr)) {
+       switch (genimg_get_format (hdr)) {
        case IMAGE_FORMAT_LEGACY:
                puts ("   Legacy image found\n");
                if (!image_check_magic (hdr)) {
@@ -599,7 +599,7 @@ int do_imls (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
                        if (!hdr)
                                goto next_sector;
 
-                       switch (gen_image_get_format (hdr)) {
+                       switch (genimg_get_format (hdr)) {
                        case IMAGE_FORMAT_LEGACY:
                                if (!image_check_magic (hdr))
                                        goto next_sector;
index 3358b04622ed960796e87d9d1c62e3766f6c8bae..293b1aa6745eab3fc6c3cc5eb24cdc72a630f7cf 100644 (file)
@@ -261,7 +261,7 @@ int do_docboot (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
        }
        show_boot_progress (38);
 
-       switch (gen_image_get_format ((void *)addr)) {
+       switch (genimg_get_format ((void *)addr)) {
        case IMAGE_FORMAT_LEGACY:
                hdr = (image_header_t *)addr;
 
index b6e023a5dab3ea79d4fd3f45f5f85677b15d5624..80301b9d527e07241d0bc519be795c966fc782c3 100644 (file)
@@ -836,7 +836,7 @@ int do_fdcboot (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
                return 1;
        }
 
-       switch (gen_image_get_format ((void *)addr)) {
+       switch (genimg_get_format ((void *)addr)) {
        case IMAGE_FORMAT_LEGACY:
                hdr = (image_header_t *)addr;
                if (!image_check_magic (hdr)) {
index 10199f59d464c7cb9365e0cd5022f48acf906321..0bb82f68a8ab66cb9a5257433e170b0ac8a147ec 100644 (file)
@@ -216,7 +216,7 @@ int do_fpga (cmd_tbl_t * cmdtp, int flag, int argc, char *argv[])
                break;
 
        case FPGA_LOADMK:
-               switch (gen_image_get_format (fpga_data)) {
+               switch (genimg_get_format (fpga_data)) {
                case IMAGE_FORMAT_LEGACY:
                        {
                                image_header_t *hdr = (image_header_t *)fpga_data;
index bef04db4f663e282fceed4c9da9367cea02467db..79b7dfb7fc7299bf0f7fd37b5bab0f46e98f31ff 100644 (file)
@@ -446,7 +446,7 @@ int do_diskboot (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
        }
        show_boot_progress (48);
 
-       switch (gen_image_get_format ((void *)addr)) {
+       switch (genimg_get_format ((void *)addr)) {
        case IMAGE_FORMAT_LEGACY:
                hdr = (image_header_t *)addr;
 
index b099afeca0ed035dc69c5c1a7ba7208ac805aece..86959dc2c011d6f28487e10e6fa339c7e6ae3562 100644 (file)
@@ -512,7 +512,7 @@ static int nand_load_image(cmd_tbl_t *cmdtp, nand_info_t *nand,
        }
        show_boot_progress (56);
 
-       switch (gen_image_get_format ((void *)addr)) {
+       switch (genimg_get_format ((void *)addr)) {
        case IMAGE_FORMAT_LEGACY:
                hdr = (image_header_t *)addr;
 
@@ -994,7 +994,7 @@ int do_nandboot (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
        }
        show_boot_progress (56);
 
-       switch (gen_image_get_format ((void *)addr)) {
+       switch (genimg_get_format ((void *)addr)) {
        case IMAGE_FORMAT_LEGACY:
                hdr = (image_header_t *)addr;
 
index 42b3072984375d7792857ca5fb848694d16d07ab..786880521b9c4a4a42ee09cea30e941beaa5ca95 100644 (file)
@@ -273,7 +273,7 @@ int do_scsiboot (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
                return 1;
        }
 
-       switch (gen_image_get_format ((void *)addr)) {
+       switch (genimg_get_format ((void *)addr)) {
        case IMAGE_FORMAT_LEGACY:
                hdr = (image_header_t *)addr;
 
index ad3873c2cb30d58697c691ad01f0fd9b33985355..8ee7d27675eb18393e7cd1b790cb95375ad68194 100644 (file)
@@ -386,7 +386,7 @@ int do_usbboot (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
                return 1;
        }
 
-       switch (gen_image_get_format ((void *)addr)) {
+       switch (genimg_get_format ((void *)addr)) {
        case IMAGE_FORMAT_LEGACY:
                hdr = (image_header_t *)addr;
 
index 4dadc3709d6615c73d7b16363567cc709da3f3a5..360b05e1b36b3117c856d47b212e171444fc4911 100644 (file)
@@ -57,7 +57,7 @@ do_imgextract(cmd_tbl_t * cmdtp, int flag, int argc, char *argv[])
        }
 
 
-       switch (gen_image_get_format ((void *)addr)) {
+       switch (genimg_get_format ((void *)addr)) {
        case IMAGE_FORMAT_LEGACY:
 
                printf("## Copying from legacy image at %08lx ...\n", addr);
@@ -104,7 +104,7 @@ do_imgextract(cmd_tbl_t * cmdtp, int flag, int argc, char *argv[])
                        data += 4;
                        if (argc > 2 && part > i) {
                                u_long tail;
-                               len = image_to_cpu (len_ptr[i]);
+                               len = uimage_to_cpu (len_ptr[i]);
                                tail = len % 4;
                                data += len;
                                if (tail) {
@@ -116,7 +116,7 @@ do_imgextract(cmd_tbl_t * cmdtp, int flag, int argc, char *argv[])
                        printf("Bad Image Part\n");
                        return 1;
                }
-               len = image_to_cpu (len_ptr[part]);
+               len = uimage_to_cpu (len_ptr[part]);
 #if defined(CONFIG_FIT)
        case IMAGE_FORMAT_FIT:
                fit_unsupported ("imxtract");
index 9e446faa730702644b3fa62187301ea2a0399c69..99ed3b8aa86d8cfd4d7cc7e8b8e50067f6f9c797 100644 (file)
@@ -68,6 +68,9 @@ static image_header_t* image_get_ramdisk (cmd_tbl_t *cmdtp, int flag,
 
 unsigned long crc32 (unsigned long, const unsigned char *, unsigned int);
 
+/*****************************************************************************/
+/* Legacy format routines */
+/*****************************************************************************/
 int image_check_hcrc (image_header_t *hdr)
 {
        ulong hcrc;
@@ -120,61 +123,6 @@ int image_check_dcrc_wd (image_header_t *hdr, ulong chunksz)
        return (dcrc == image_get_dcrc (hdr));
 }
 
-int getenv_verify (void)
-{
-       char *s = getenv ("verify");
-       return (s && (*s == 'n')) ? 0 : 1;
-}
-
-int getenv_autostart (void)
-{
-       char *s = getenv ("autostart");
-       return (s && (*s == 'n')) ? 0 : 1;
-}
-
-ulong getenv_bootm_low(void)
-{
-       char *s = getenv ("bootm_low");
-       if (s) {
-               ulong tmp = simple_strtoul (s, NULL, 16);
-               return tmp;
-       }
-
-#ifdef CFG_SDRAM_BASE
-       return CFG_SDRAM_BASE;
-#else
-       return 0;
-#endif
-}
-
-ulong getenv_bootm_size(void)
-{
-       char *s = getenv ("bootm_size");
-       if (s) {
-               ulong tmp = simple_strtoul (s, NULL, 16);
-               return tmp;
-       }
-
-       return gd->bd->bi_memsize;
-}
-
-void memmove_wd (void *to, void *from, size_t len, ulong chunksz)
-{
-#if defined(CONFIG_HW_WATCHDOG) || defined(CONFIG_WATCHDOG)
-       while (len > 0) {
-               size_t tail = (len > chunksz) ? chunksz : len;
-               WATCHDOG_RESET ();
-               memmove (to, from, tail);
-               to += tail;
-               from += tail;
-               len -= tail;
-       }
-#else  /* !(CONFIG_HW_WATCHDOG || CONFIG_WATCHDOG) */
-       memmove (to, from, len);
-#endif /* CONFIG_HW_WATCHDOG || CONFIG_WATCHDOG */
-}
-#endif /* USE_HOSTCC */
-
 /**
  * image_multi_count - get component (sub-image) count
  * @hdr: pointer to the header of the multi component image
@@ -262,7 +210,185 @@ void image_multi_getimg (image_header_t *hdr, ulong idx,
 }
 
 #ifndef USE_HOSTCC
-const char* image_get_os_name (uint8_t os)
+static void image_print_type (image_header_t *hdr)
+{
+       const char *os, *arch, *type, *comp;
+
+       os = genimg_get_os_name (image_get_os (hdr));
+       arch = genimg_get_arch_name (image_get_arch (hdr));
+       type = genimg_get_type_name (image_get_type (hdr));
+       comp = genimg_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");
+               }
+       }
+}
+
+/**
+ * image_get_ramdisk - get and verify ramdisk image
+ * @cmdtp: command table pointer
+ * @flag: command flag
+ * @argc: command argument count
+ * @argv: command argument list
+ * @rd_addr: ramdisk image start address
+ * @arch: expected ramdisk architecture
+ * @verify: checksum verification flag
+ *
+ * image_get_ramdisk() returns a pointer to the verified ramdisk image
+ * header. Routine receives image start address and expected architecture
+ * flag. Verification done covers data and header integrity and os/type/arch
+ * fields checking.
+ *
+ * If dataflash support is enabled routine checks for dataflash addresses
+ * and handles required dataflash reads.
+ *
+ * returns:
+ *     pointer to a ramdisk image header, if image was found and valid
+ *     otherwise, return NULL
+ */
+static image_header_t* image_get_ramdisk (cmd_tbl_t *cmdtp, int flag,
+               int argc, char *argv[],
+               ulong rd_addr, uint8_t arch, int verify)
+{
+       image_header_t *rd_hdr;
+
+       show_boot_progress (9);
+       rd_hdr = (image_header_t *)rd_addr;
+
+       if (!image_check_magic (rd_hdr)) {
+               puts ("Bad Magic Number\n");
+               show_boot_progress (-10);
+               return NULL;
+       }
+
+       if (!image_check_hcrc (rd_hdr)) {
+               puts ("Bad Header Checksum\n");
+               show_boot_progress (-11);
+               return NULL;
+       }
+
+       show_boot_progress (10);
+       image_print_contents (rd_hdr);
+
+       if (verify) {
+               puts("   Verifying Checksum ... ");
+               if (!image_check_dcrc_wd (rd_hdr, CHUNKSZ)) {
+                       puts ("Bad Data CRC\n");
+                       show_boot_progress (-12);
+                       return NULL;
+               }
+               puts("OK\n");
+       }
+
+       show_boot_progress (11);
+
+       if (!image_check_os (rd_hdr, IH_OS_LINUX) ||
+           !image_check_arch (rd_hdr, arch) ||
+           !image_check_type (rd_hdr, IH_TYPE_RAMDISK)) {
+               printf ("No Linux %s Ramdisk Image\n",
+                               genimg_get_arch_name(arch));
+               show_boot_progress (-13);
+               return NULL;
+       }
+
+       return rd_hdr;
+}
+
+/*****************************************************************************/
+/* Shared dual-format routines */
+/*****************************************************************************/
+int getenv_verify (void)
+{
+       char *s = getenv ("verify");
+       return (s && (*s == 'n')) ? 0 : 1;
+}
+
+int getenv_autostart (void)
+{
+       char *s = getenv ("autostart");
+       return (s && (*s == 'n')) ? 0 : 1;
+}
+
+ulong getenv_bootm_low(void)
+{
+       char *s = getenv ("bootm_low");
+       if (s) {
+               ulong tmp = simple_strtoul (s, NULL, 16);
+               return tmp;
+       }
+
+#ifdef CFG_SDRAM_BASE
+       return CFG_SDRAM_BASE;
+#else
+       return 0;
+#endif
+}
+
+ulong getenv_bootm_size(void)
+{
+       char *s = getenv ("bootm_size");
+       if (s) {
+               ulong tmp = simple_strtoul (s, NULL, 16);
+               return tmp;
+       }
+
+       return gd->bd->bi_memsize;
+}
+
+void memmove_wd (void *to, void *from, size_t len, ulong chunksz)
+{
+#if defined(CONFIG_HW_WATCHDOG) || defined(CONFIG_WATCHDOG)
+       while (len > 0) {
+               size_t tail = (len > chunksz) ? chunksz : len;
+               WATCHDOG_RESET ();
+               memmove (to, from, tail);
+               to += tail;
+               from += tail;
+               len -= tail;
+       }
+#else  /* !(CONFIG_HW_WATCHDOG || CONFIG_WATCHDOG) */
+       memmove (to, from, len);
+#endif /* CONFIG_HW_WATCHDOG || CONFIG_WATCHDOG */
+}
+#endif /* USE_HOSTCC */
+
+const char* genimg_get_os_name (uint8_t os)
 {
        const char *name;
 
@@ -286,7 +412,7 @@ const char* image_get_os_name (uint8_t os)
        return name;
 }
 
-const char* image_get_arch_name (uint8_t arch)
+const char* genimg_get_arch_name (uint8_t arch)
 {
        const char *name;
 
@@ -315,7 +441,7 @@ const char* image_get_arch_name (uint8_t arch)
        return name;
 }
 
-const char* image_get_type_name (uint8_t type)
+const char* genimg_get_type_name (uint8_t type)
 {
        const char *name;
 
@@ -334,7 +460,7 @@ const char* image_get_type_name (uint8_t type)
        return name;
 }
 
-const char* image_get_comp_name (uint8_t comp)
+const char* genimg_get_comp_name (uint8_t comp)
 {
        const char *name;
 
@@ -348,71 +474,21 @@ 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
+ * genimg_get_format - get image format type
  * @img_addr: image start address
  *
- * gen_image_get_format() checks whether provided address points to a valid
+ * genimg_get_format() checks whether provided address points to a valid
  * legacy or FIT image.
  *
  * New uImage format and FDT blob are based on a libfdt. FDT blob
  * may be passed directly or embedded in a FIT image. In both situations
- * gen_image_get_format() must be able to dectect libfdt header.
+ * genimg_get_format() must be able to dectect libfdt header.
  *
  * returns:
  *     image format type or IMAGE_FORMAT_INVALID if no image is present
  */
-int gen_image_get_format (void *img_addr)
+int genimg_get_format (void *img_addr)
 {
        ulong           format = IMAGE_FORMAT_INVALID;
        image_header_t  *hdr;
@@ -435,16 +511,16 @@ int gen_image_get_format (void *img_addr)
 }
 
 /**
- * gen_get_image - get image from special storage (if necessary)
+ * genimg_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
+ * genimg_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 genimg_get_image (ulong img_addr)
 {
        ulong ram_addr = img_addr;
 
@@ -469,7 +545,7 @@ ulong gen_get_image (ulong img_addr)
                read_dataflash (img_addr, h_size, (char *)ram_addr);
 
                /* get data size */
-               switch (gen_image_get_format ((void *)ram_addr)) {
+               switch (genimg_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",
@@ -502,77 +578,7 @@ ulong gen_get_image (ulong img_addr)
 }
 
 /**
- * image_get_ramdisk - get and verify ramdisk image
- * @cmdtp: command table pointer
- * @flag: command flag
- * @argc: command argument count
- * @argv: command argument list
- * @rd_addr: ramdisk image start address
- * @arch: expected ramdisk architecture
- * @verify: checksum verification flag
- *
- * image_get_ramdisk() returns a pointer to the verified ramdisk image
- * header. Routine receives image start address and expected architecture
- * flag. Verification done covers data and header integrity and os/type/arch
- * fields checking.
- *
- * If dataflash support is enabled routine checks for dataflash addresses
- * and handles required dataflash reads.
- *
- * returns:
- *     pointer to a ramdisk image header, if image was found and valid
- *     otherwise, return NULL
- */
-static image_header_t* image_get_ramdisk (cmd_tbl_t *cmdtp, int flag,
-               int argc, char *argv[],
-               ulong rd_addr, uint8_t arch, int verify)
-{
-       image_header_t *rd_hdr;
-
-       show_boot_progress (9);
-       rd_hdr = (image_header_t *)rd_addr;
-
-       if (!image_check_magic (rd_hdr)) {
-               puts ("Bad Magic Number\n");
-               show_boot_progress (-10);
-               return NULL;
-       }
-
-       if (!image_check_hcrc (rd_hdr)) {
-               puts ("Bad Header Checksum\n");
-               show_boot_progress (-11);
-               return NULL;
-       }
-
-       show_boot_progress (10);
-       image_print_contents (rd_hdr);
-
-       if (verify) {
-               puts("   Verifying Checksum ... ");
-               if (!image_check_dcrc_wd (rd_hdr, CHUNKSZ)) {
-                       puts ("Bad Data CRC\n");
-                       show_boot_progress (-12);
-                       return NULL;
-               }
-               puts("OK\n");
-       }
-
-       show_boot_progress (11);
-
-       if (!image_check_os (rd_hdr, IH_OS_LINUX) ||
-           !image_check_arch (rd_hdr, arch) ||
-           !image_check_type (rd_hdr, IH_TYPE_RAMDISK)) {
-               printf ("No Linux %s Ramdisk Image\n",
-                               image_get_arch_name(arch));
-               show_boot_progress (-13);
-               return NULL;
-       }
-
-       return rd_hdr;
-}
-
-/**
- * get_ramdisk - main ramdisk handling routine
+ * boot_get_ramdisk - main ramdisk handling routine
  * @cmdtp: command table pointer
  * @flag: command flag
  * @argc: command argument count
@@ -582,7 +588,7 @@ static image_header_t* image_get_ramdisk (cmd_tbl_t *cmdtp, int flag,
  * @rd_start: pointer to a ulong variable, will hold ramdisk start address
  * @rd_end: pointer to a ulong variable, will hold ramdisk end
  *
- * get_ramdisk() is responsible for finding a valid ramdisk image.
+ * boot_get_ramdisk() is responsible for finding a valid ramdisk image.
  * Curently supported are the following ramdisk sources:
  *      - multicomponent kernel/ramdisk image,
  *      - commandline provided address of decicated ramdisk image.
@@ -593,7 +599,7 @@ static image_header_t* image_get_ramdisk (cmd_tbl_t *cmdtp, int flag,
  *     rd_start and rd_end are set to 0 if no ramdisk exists
  *     return 1 if ramdisk image is found but corrupted
  */
-int get_ramdisk (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[],
+int boot_get_ramdisk (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[],
                bootm_headers_t *images, uint8_t arch,
                ulong *rd_start, ulong *rd_end)
 {
@@ -645,14 +651,14 @@ int get_ramdisk (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[],
                /* copy from dataflash if needed */
                printf ("## Loading init Ramdisk Image at %08lx ...\n",
                                rd_addr);
-               rd_addr = gen_get_image (rd_addr);
+               rd_addr = genimg_get_image (rd_addr);
 
                /*
                 * Check if there is an initrd image at the
                 * address provided in the second bootm argument
                 * check image type, for FIT images get FIT node.
                 */
-               switch (gen_image_get_format ((void *)rd_addr)) {
+               switch (genimg_get_format ((void *)rd_addr)) {
                case IMAGE_FORMAT_LEGACY:
 
                        debug ("*  ramdisk: legacy format image\n");
@@ -729,7 +735,7 @@ int get_ramdisk (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[],
 
 #if defined(CONFIG_PPC) || defined(CONFIG_M68K)
 /**
- * ramdisk_high - relocate init ramdisk
+ * boot_ramdisk_high - relocate init ramdisk
  * @lmb: pointer to lmb handle, will be used for memory mgmt
  * @rd_data: ramdisk data start address
  * @rd_len: ramdisk data length
@@ -738,18 +744,18 @@ int get_ramdisk (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[],
  * @initrd_end: pointer to a ulong variable, will hold final init ramdisk
  *      end address (after possible relocation)
  *
- * ramdisk_high() takes a relocation hint from "initrd_high" environement
+ * boot_ramdisk_high() takes a relocation hint from "initrd_high" environement
  * variable and if requested ramdisk data is moved to a specified location.
  *
+ * Initrd_start and initrd_end are set to final (after relocation) ramdisk
+ * start/end addresses if ramdisk image start and len were provided,
+ * otherwise set initrd_start and initrd_end set to zeros.
+ *
  * returns:
- *     - initrd_start and initrd_end are set to final (after relocation) ramdisk
- *     start/end addresses if ramdisk image start and len were provided
- *     otherwise set initrd_start and initrd_end set to zeros
- *     - returns:
- *        0 - success
- *       -1 - failure
+ *      0 - success
+ *     -1 - failure
  */
-int ramdisk_high (struct lmb *lmb, ulong rd_data, ulong rd_len,
+int boot_ramdisk_high (struct lmb *lmb, ulong rd_data, ulong rd_len,
                  ulong *initrd_start, ulong *initrd_end)
 {
        char    *s;
@@ -779,12 +785,12 @@ int ramdisk_high (struct lmb *lmb, ulong rd_data, ulong rd_len,
                        lmb_reserve(lmb, rd_data, rd_len);
                } else {
                        if (initrd_high)
-                               *initrd_start = lmb_alloc_base(lmb, rd_len, 0x1000, initrd_high);
+                               *initrd_start = lmb_alloc_base (lmb, rd_len, 0x1000, initrd_high);
                        else
-                               *initrd_start = lmb_alloc(lmb, rd_len, 0x1000);
+                               *initrd_start = lmb_alloc (lmb, rd_len, 0x1000);
 
                        if (*initrd_start == 0) {
-                               puts("ramdisk - allocation error\n");
+                               puts ("ramdisk - allocation error\n");
                                goto error;
                        }
                        show_boot_progress (12);
@@ -793,7 +799,7 @@ int ramdisk_high (struct lmb *lmb, ulong rd_data, ulong rd_len,
                        printf ("   Loading Ramdisk to %08lx, end %08lx ... ",
                                        *initrd_start, *initrd_end);
 
-                       memmove_wd((void *)*initrd_start,
+                       memmove_wd ((void *)*initrd_start,
                                        (void *)rd_data, rd_len, CHUNKSZ);
 
                        puts ("OK\n");
@@ -804,6 +810,7 @@ int ramdisk_high (struct lmb *lmb, ulong rd_data, ulong rd_len,
        }
        debug ("   ramdisk load start = 0x%08lx, ramdisk load end = 0x%08lx\n",
                        *initrd_start, *initrd_end);
+
        return 0;
 
 error:
@@ -811,14 +818,14 @@ error:
 }
 
 /**
- * get_boot_cmdline - allocate and initialize kernel cmdline
+ * boot_get_cmdline - allocate and initialize kernel cmdline
  * @lmb: pointer to lmb handle, will be used for memory mgmt
  * @cmd_start: pointer to a ulong variable, will hold cmdline start
  * @cmd_end: pointer to a ulong variable, will hold cmdline end
  * @bootmap_base: ulong variable, holds offset in physical memory to
  * base of bootmap
  *
- * get_boot_cmdline() allocates space for kernel command line below
+ * boot_get_cmdline() allocates space for kernel command line below
  * BOOTMAPSZ + bootmap_base address. If "bootargs" U-boot environemnt
  * variable is present its contents is copied to allocated kernel
  * command line.
@@ -827,7 +834,7 @@ error:
  *      0 - success
  *     -1 - failure
  */
-int get_boot_cmdline (struct lmb *lmb, ulong *cmd_start, ulong *cmd_end,
+int boot_get_cmdline (struct lmb *lmb, ulong *cmd_start, ulong *cmd_end,
                        ulong bootmap_base)
 {
        char *cmdline;
@@ -853,13 +860,13 @@ int get_boot_cmdline (struct lmb *lmb, ulong *cmd_start, ulong *cmd_end,
 }
 
 /**
- * get_boot_kbd - allocate and initialize kernel copy of board info
+ * boot_get_kbd - allocate and initialize kernel copy of board info
  * @lmb: pointer to lmb handle, will be used for memory mgmt
  * @kbd: double pointer to board info data
  * @bootmap_base: ulong variable, holds offset in physical memory to
  * base of bootmap
  *
- * get_boot_kbd() allocates space for kernel copy of board info data below
+ * boot_get_kbd() allocates space for kernel copy of board info data below
  * BOOTMAPSZ + bootmap_base address and kernel board info is initialized with
  * the current u-boot board info data.
  *
@@ -867,7 +874,7 @@ int get_boot_cmdline (struct lmb *lmb, ulong *cmd_start, ulong *cmd_end,
  *      0 - success
  *     -1 - failure
  */
-int get_boot_kbd (struct lmb *lmb, bd_t **kbd, ulong bootmap_base)
+int boot_get_kbd (struct lmb *lmb, bd_t **kbd, ulong bootmap_base)
 {
        *kbd = (bd_t *)lmb_alloc_base(lmb, sizeof(bd_t), 0xf,
                                      CFG_BOOTMAPSZ + bootmap_base);
index ee692ac607591c63e06e09eb813a57e667510534..b520691ca1b0174eac9b7312e7385ad6774a11e4 100644 (file)
 #define IH_NMLEN               32      /* Image Name Length            */
 
 /*
- * all data in network byte order (aka natural aka bigendian)
+ * Legacy format image header,
+ * all data in network byte order (aka natural aka bigendian).
  */
-
 typedef struct image_header {
        uint32_t        ih_magic;       /* Image Header Magic Number    */
        uint32_t        ih_hcrc;        /* Image Header CRC Checksum    */
@@ -186,7 +186,7 @@ typedef struct image_header {
 typedef struct bootm_headers {
        /*
         * Legacy os image header, if it is a multi component image
-        * then get_ramdisk() and get_fdt() will attempt to get
+        * then boot_get_ramdisk() and get_fdt() will attempt to get
         * data from second and third component accordingly.
         */
        image_header_t  *legacy_hdr_os;
@@ -216,9 +216,40 @@ typedef struct bootm_headers {
  */
 #define CHUNKSZ (64 * 1024)
 
-#define image_to_cpu(x)                ntohl(x)
-#define cpu_to_image(x)                htonl(x)
+#define uimage_to_cpu(x)               ntohl(x)
+#define cpu_to_uimage(x)               htonl(x)
+
+#ifndef USE_HOSTCC
+/* Image format types, returned by _get_format() routine */
+#define IMAGE_FORMAT_INVALID   0x00
+#define IMAGE_FORMAT_LEGACY    0x01    /* legacy image_header based format */
+#define IMAGE_FORMAT_FIT       0x02    /* new, libfdt based format */
+
+int genimg_get_format (void *img_addr);
+ulong genimg_get_image (ulong img_addr);
+
+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);
+const char* genimg_get_comp_name (uint8_t comp);
+
+int boot_get_ramdisk (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[],
+               bootm_headers_t *images, uint8_t arch,
+               ulong *rd_start, ulong *rd_end);
+
+#if defined(CONFIG_PPC) || defined(CONFIG_M68K)
+int boot_ramdisk_high (struct lmb *lmb, ulong rd_data, ulong rd_len,
+                 ulong *initrd_start, ulong *initrd_end);
+
+int boot_get_cmdline (struct lmb *lmb, ulong *cmd_start, ulong *cmd_end,
+                       ulong bootmap_base);
+int boot_get_kbd (struct lmb *lmb, bd_t **kbd, ulong bootmap_base);
+#endif /* CONFIG_PPC || CONFIG_M68K */
+#endif /* USE_HOSTCC */
 
+/*******************************************************************/
+/* Legacy format specific code (prefixed with image_) */
+/*******************************************************************/
 static inline uint32_t image_get_header_size (void)
 {
        return (sizeof (image_header_t));
@@ -227,7 +258,7 @@ static inline uint32_t image_get_header_size (void)
 #define image_get_hdr_l(f) \
        static inline uint32_t image_get_##f(image_header_t *hdr) \
        { \
-               return image_to_cpu (hdr->ih_##f); \
+               return uimage_to_cpu (hdr->ih_##f); \
        }
 image_get_hdr_l (magic);
 image_get_hdr_l (hcrc);
@@ -285,7 +316,7 @@ static inline ulong image_get_image_end (image_header_t *hdr)
 #define image_set_hdr_l(f) \
        static inline void image_set_##f(image_header_t *hdr, uint32_t val) \
        { \
-               hdr->ih_##f = cpu_to_image (val); \
+               hdr->ih_##f = cpu_to_uimage (val); \
        }
 image_set_hdr_l (magic);
 image_set_hdr_l (hcrc);
@@ -375,33 +406,10 @@ static inline int image_check_target_arch (image_header_t *hdr)
        return 1;
 }
 
-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    /* legacy image_header based format */
-#define IMAGE_FORMAT_FIT       0x02    /* new, libfdt based format */
-
-int gen_image_get_format (void *img_addr);
-ulong gen_get_image (ulong img_addr);
-
-int get_ramdisk (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[],
-               bootm_headers_t *images, uint8_t arch,
-               ulong *rd_start, ulong *rd_end);
-
-#if defined(CONFIG_PPC) || defined(CONFIG_M68K)
-int ramdisk_high (struct lmb *lmb, ulong rd_data, ulong rd_len,
-                 ulong *initrd_start, ulong *initrd_end);
-int get_boot_cmdline (struct lmb *lmb, ulong *cmd_start, ulong *cmd_end,
-                       ulong bootmap_base);
-int get_boot_kbd (struct lmb *lmb, bd_t **kbd, ulong bootmap_base);
-#endif /* CONFIG_PPC || CONFIG_M68K */
-
 /*******************************************************************/
-/* New uImage format */
+/* New uImage format specific code (prefixed with fit_) */
 /*******************************************************************/
 #if defined(CONFIG_FIT)
 inline int fit_parse_conf (const char *spec, ulong addr_curr,
@@ -422,9 +430,7 @@ inline int fit_parse_subimage (const char *spec, ulong addr_curr,
 #define fit_unsupported(msg)
 #define fit_unsupported_reset(msg)
 #endif /* CONFIG_FIT_VERBOSE */
-
 #endif /* CONFIG_FIT */
-
 #endif /* USE_HOSTCC */
 
 #endif /* __IMAGE_H__ */
index 77d35fcc656bc2b6eeeda8243afc67f47571c44d..865e711e91999c746f4f3d5095464a13bab4eceb 100644 (file)
@@ -95,7 +95,7 @@ void do_bootm_linux (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[],
                printf ("Using machid 0x%x from environment\n", machid);
        }
 
-       get_ramdisk (cmdtp, flag, argc, argv, images,
+       boot_get_ramdisk (cmdtp, flag, argc, argv, images,
                        IH_ARCH_ARM, &initrd_start, &initrd_end);
 
        show_boot_progress (15);
index 918e4cfadf5a03c2c2625a262804b7e39da60416..e8e537a2ce33ac4d14f09ff48d3b8f4a8f4b73dc 100644 (file)
@@ -196,7 +196,7 @@ void do_bootm_linux(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[],
        }
        theKernel = (void *)ep;
 
-       get_ramdisk (cmdtp, flag, argc, argv, images,
+       boot_get_ramdisk (cmdtp, flag, argc, argv, images,
                        IH_ARCH_AVR32, &initrd_start, &initrd_end);
 
        show_boot_progress (15);
index 89a423c24375591a283b04388c4ca5dc79d7e68e..76bcf6cd85e3999d818ee060abce57f6ff46eb2e 100644 (file)
@@ -40,7 +40,7 @@ void do_bootm_linux(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[],
        ulong           ep;
        image_header_t  *hdr;
 
-       get_ramdisk (cmdtp, flag, argc, argv, images,
+       boot_get_ramdisk (cmdtp, flag, argc, argv, images,
                        IH_ARCH_I386, &initrd_start, &initrd_end);
 
        if (images->legacy_hdr_valid) {
index e12d1d4aaddea8f2c305e2809ec5039dd57eb727..fba7499090d2dc319a2ccd89cace42a2d2a369e9 100644 (file)
@@ -82,14 +82,14 @@ void do_bootm_linux(cmd_tbl_t * cmdtp, int flag,
        lmb_reserve(lmb, sp, (CFG_SDRAM_BASE + gd->ram_size - sp));
 
        /* allocate space and init command line */
-       ret = get_boot_cmdline (lmb, &cmd_start, &cmd_end, bootmap_base);
+       ret = boot_get_cmdline (lmb, &cmd_start, &cmd_end, bootmap_base);
        if (ret) {
                puts("ERROR with allocation of cmdline\n");
                goto error;
        }
 
        /* allocate space for kernel copy of board info */
-       ret = get_boot_kbd (lmb, &kbd, bootmap_base);
+       ret = boot_get_kbd (lmb, &kbd, bootmap_base);
        if (ret) {
                puts("ERROR with allocation of kernel bd\n");
                goto error;
@@ -111,14 +111,15 @@ void do_bootm_linux(cmd_tbl_t * cmdtp, int flag,
        kernel = (void (*)(bd_t *, ulong, ulong, ulong, ulong))ep;
 
        /* find ramdisk */
-       ret = get_ramdisk (cmdtp, flag, argc, argv, images,
+       ret = boot_get_ramdisk (cmdtp, flag, argc, argv, images,
                        IH_ARCH_M68K, &rd_data_start, &rd_data_end);
 
        if (ret)
                goto error;
 
        rd_len = rd_data_end - rd_data_start;
-       ret = ramdisk_high (lmb, rd_data_start, rd_len, &initrd_start, &initrd_end);
+       ret = boot_ramdisk_high (lmb, rd_data_start, rd_len,
+                       &initrd_start, &initrd_end);
        if (ret)
                goto error;
 
index 39869c18008bee9d9ce381290bb31b05b0700074..b336a364986461e94aab8cea80d660cb54ad31d7 100644 (file)
@@ -68,7 +68,7 @@ void do_bootm_linux (cmd_tbl_t * cmdtp, int flag, int argc, char *argv[],
        }
        theKernel = (void (*)(int, char **, char **, int *))ep;
 
-       get_ramdisk (cmdtp, flag, argc, argv, images,
+       boot_get_ramdisk (cmdtp, flag, argc, argv, images,
                        IH_ARCH_MIPS, &initrd_start, &initrd_end);
 
        show_boot_progress (15);
index 1afef46df7531bbd7467b3e419c4d93af4775fc1..8974ccd81ce07f672bef9bdbaf307157ab0d808c 100644 (file)
@@ -41,9 +41,9 @@
 #include <fdt_support.h>
 
 static void fdt_error (const char *msg);
-static int get_fdt (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[],
+static int boot_get_fdt (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[],
                bootm_headers_t *images, char **of_flat_tree, ulong *of_size);
-static int fdt_relocate (struct lmb *lmb, ulong bootmap_base,
+static int boot_relocate_fdt (struct lmb *lmb, ulong bootmap_base,
                cmd_tbl_t *cmdtp, int flag, int argc, char *argv[],
                char **of_flat_tree, ulong *of_size);
 #endif
@@ -122,7 +122,7 @@ do_bootm_linux(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[],
 
 #if defined(CONFIG_OF_LIBFDT)
        /* find flattened device tree */
-       ret = get_fdt (cmdtp, flag, argc, argv, images, &of_flat_tree, &of_size);
+       ret = boot_get_fdt (cmdtp, flag, argc, argv, images, &of_flat_tree, &of_size);
 
        if (ret)
                goto error;
@@ -130,14 +130,14 @@ do_bootm_linux(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[],
 
        if (!of_size) {
                /* allocate space and init command line */
-               ret = get_boot_cmdline (lmb, &cmd_start, &cmd_end, bootmap_base);
+               ret = boot_get_cmdline (lmb, &cmd_start, &cmd_end, bootmap_base);
                if (ret) {
                        puts("ERROR with allocation of cmdline\n");
                        goto error;
                }
 
                /* allocate space for kernel copy of board info */
-               ret = get_boot_kbd (lmb, &kbd, bootmap_base);
+               ret = boot_get_kbd (lmb, &kbd, bootmap_base);
                if (ret) {
                        puts("ERROR with allocation of kernel bd\n");
                        goto error;
@@ -160,7 +160,7 @@ do_bootm_linux(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[],
        kernel = (void (*)(bd_t *, ulong, ulong, ulong, ulong))ep;
 
        /* find ramdisk */
-       ret = get_ramdisk (cmdtp, flag, argc, argv, images,
+       ret = boot_get_ramdisk (cmdtp, flag, argc, argv, images,
                        IH_ARCH_PPC, &rd_data_start, &rd_data_end);
 
        if (ret)
@@ -169,7 +169,7 @@ do_bootm_linux(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[],
        rd_len = rd_data_end - rd_data_start;
 
 #if defined(CONFIG_OF_LIBFDT)
-       ret = fdt_relocate (lmb, bootmap_base,
+       ret = boot_relocate_fdt (lmb, bootmap_base,
                cmdtp, flag, argc, argv, &of_flat_tree, &of_size);
 
        /*
@@ -201,7 +201,7 @@ do_bootm_linux(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[],
        }
 #endif /* CONFIG_OF_LIBFDT */
 
-       ret = ramdisk_high (lmb, rd_data_start, rd_len, &initrd_start, &initrd_end);
+       ret = boot_ramdisk_high (lmb, rd_data_start, rd_len, &initrd_start, &initrd_end);
        if (ret)
                goto error;
 
@@ -354,7 +354,7 @@ static image_header_t *image_get_fdt (ulong fdt_addr)
        return fdt_hdr;
 }
 
-static int get_fdt (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[],
+static int boot_get_fdt (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[],
                bootm_headers_t *images, char **of_flat_tree, ulong *of_size)
 {
        ulong           fdt_addr;
@@ -403,14 +403,14 @@ static int get_fdt (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[],
                                fdt_addr);
 
                /* copy from dataflash if needed */
-               fdt_addr = gen_get_image (fdt_addr);
+               fdt_addr = genimg_get_image (fdt_addr);
 
                /*
                 * Check if there is an FDT image at the
                 * address provided in the second bootm argument
                 * check image type, for FIT images get a FIT node.
                 */
-               switch (gen_image_get_format ((void *)fdt_addr)) {
+               switch (genimg_get_format ((void *)fdt_addr)) {
                case IMAGE_FORMAT_LEGACY:
                        debug ("*  fdt: legacy format image\n");
 
@@ -527,7 +527,7 @@ error:
        return 1;
 }
 
-static int fdt_relocate (struct lmb *lmb, ulong bootmap_base,
+static int boot_relocate_fdt (struct lmb *lmb, ulong bootmap_base,
                cmd_tbl_t *cmdtp, int flag, int argc, char *argv[],
                char **of_flat_tree, ulong *of_size)
 {
index 8ced9709a63b62f6b717b2e0eecd12bcf89f10bf..5119bc7843354014b9eda29b8534eb03ae019a4d 100644 (file)
@@ -361,7 +361,7 @@ NXTARG:             ;
                                                cmdname, file, strerror(errno));
                                        exit (EXIT_FAILURE);
                                }
-                               size = cpu_to_image (sbuf.st_size);
+                               size = cpu_to_uimage (sbuf.st_size);
                        } else {
                                size = 0;
                        }
@@ -604,7 +604,7 @@ print_header (image_header_t *hdr)
                pos = image_get_header_size () + ptrs * sizeof(long);
                printf ("Contents:\n");
                for (i=0; len_ptr[i]; ++i) {
-                       size = image_to_cpu (len_ptr[i]);
+                       size = uimage_to_cpu (len_ptr[i]);
 
                        printf ("   Image %d: %8d Bytes = %4d kB = %d MB\n",
                                i, size, size>>10, size>>20);