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
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
*/
data += 4 - tail;
}
+ initrd_start = data;
len = SWAP32(len_ptr[1]);
} else {
#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;
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;
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);