]> www.infradead.org Git - users/rw/armboot.git/commitdiff
Removed some excessive (and even buggy) mem-to-mem copying
authorrobertkaiser <robertkaiser>
Mon, 17 Mar 2003 22:15:36 +0000 (22:15 +0000)
committerrobertkaiser <robertkaiser>
Mon, 17 Mar 2003 22:15:36 +0000 (22:15 +0000)
common/armlinux.c
common/cmd_bootm.c

index 8878889f68a7a625021ac0705c911fa075ac91c6..094565d45f5708dd68731604873a6c9e23b36fab 100644 (file)
@@ -55,17 +55,17 @@ void boot_linux(cmd_tbl_t *cmdtp,
                int   verify)
 {
     ulong len = 0, checksum;
-    ulong initrd_start, initrd_end;
+    ulong initrd_start = 0, initrd_end;
     ulong data;
     char *commandline = getenv(bd, "bootargs");
     void (*theKernel)(int zero, int arch);
     image_header_t *hdr = &header;
 
     /*
-     * get the kernel entry address *before* we possibly
-     * clobber the header buffer when verifying a ramdisk image
+     * get the kernel entry address and initrd address *before* we
+     * possibly clobber the header buffer when verifying a ramdisk image
      */
-    theKernel = (void (*)(int, int))SWAP32(hdr->ih_ep);
+    theKernel    = (void (*)(int, int))SWAP32(hdr->ih_ep);
    
     /*
      * Check if there is an initrd image
@@ -117,7 +117,15 @@ void boot_linux(cmd_tbl_t *cmdtp,
            printf ("No Linux ARM Ramdisk Image\n");
            do_reset (cmdtp, bd, flag, argc, argv);
        }
-       
+
+       /* if the header specifies a load address, use it */
+       if(hdr->ih_load) {
+           initrd_start = SWAP32(hdr->ih_load);
+       }
+       else {
+           initrd_start = data;
+       }
+
        /*
         * Now check if we have a multifile image
         */
@@ -136,6 +144,7 @@ void boot_linux(cmd_tbl_t *cmdtp,
            data += 4 - tail;
        }
        
+       initrd_start = data;
        len   = SWAP32(len_ptr[1]);
        
     } else {
@@ -152,12 +161,17 @@ void boot_linux(cmd_tbl_t *cmdtp,
 #endif
     
     if (data) {
-       initrd_start = SWAP32(hdr->ih_load);
+       /* if initrd is in flash, copy it to load_addr */
+       if (addr2info(initrd_start) != NULL) {
+           initrd_start = load_addr;
+       }
        initrd_end   = initrd_start + len;
-       printf ("   Loading Ramdisk to %08lx, end %08lx ... ",
+       if(initrd_start != data) {
+           printf ("   Loading Ramdisk to %08lx, end %08lx ... ",
                initrd_start, initrd_end);
-       memmove ((void *)initrd_start, (void *)data, len);
-       printf ("OK\n");
+           memmove ((void *)initrd_start, (void *)data, len);
+           printf ("OK\n");
+       }
     } else {
        initrd_start = 0;
        initrd_end = 0;
index 522ce9a7ccf651d9a15214d41026bc0f49c5a838..cdd561a77dafb81f356ffa64f0afba8f9947863b 100644 (file)
@@ -60,7 +60,7 @@ extern void boot_linux(cmd_tbl_t *cmdtp,
 int do_bootm (cmd_tbl_t *cmdtp, bd_t *bd, int flag, int argc, char *argv[])
 {
        ulong   iflag;
-       ulong   addr, ram_addr;
+       ulong   addr;
        ulong   data, len, checksum;
        ulong  *len_ptr;
        int     i, verify;
@@ -98,23 +98,6 @@ int do_bootm (cmd_tbl_t *cmdtp, bd_t *bd, int flag, int argc, char *argv[])
                return 1;
        }
 
-       /************************************************************/
-       /* BIG FAT WARNING:                                         */
-       /* SOME PARTS OF THIS CODE WILL OVERWRITE THE IMAGE         */
-       /* IF THE IMAGE RESIDES IN FLASH, FLASH WILL BE OVERWRITTEN */
-       /* SO WE TRANSFER THE IMAGE TO RAM FIRST                    */
-       /************************************************************/
-
-       if (addr2info(addr) != NULL)
-       {
-               ram_addr = load_addr; /* should be a env-var ... */
-               printf ("## Copy image from flash %08lx to ram %08lx ...\n", addr, ram_addr);
-
-               /* we copy the whole to ram (load_addr) */
-               memcpy ((char *)ram_addr, (char *)addr, SWAP32(hdr->ih_size) + sizeof(image_header_t));
-               addr = ram_addr;
-       }
-
        /* for multi-file images we need the data part, too */
        print_image_hdr ((image_header_t *)addr);