[new uImage] Add gen_get_image() routine

This routine assures that image (whether legacy or FIT) is not
in a special dataflash storage.

If image address is a dataflash address image is moved to system RAM.

Signed-off-by: Marian Balakowicz <m8@semihalf.com>
This commit is contained in:
Marian Balakowicz
2008-02-21 17:20:19 +01:00
parent 75d3e8fbd9
commit fff888a199
4 changed files with 119 additions and 40 deletions

View File

@@ -44,10 +44,6 @@
#include <hush.h>
#endif
#ifdef CONFIG_HAS_DATAFLASH
#include <dataflash.h>
#endif
DECLARE_GLOBAL_DATA_PTR;
extern int gunzip (void *dst, int dstlen, unsigned char *src, unsigned long *lenp);
@@ -304,12 +300,8 @@ static image_header_t *get_kernel (cmd_tbl_t *cmdtp, int flag,
show_boot_progress (1);
printf ("## Booting image at %08lx ...\n", img_addr);
#ifdef CONFIG_HAS_DATAFLASH
if (addr_dataflash (img_addr)){
hdr = (image_header_t *)CFG_LOAD_ADDR;
read_dataflash (img_addr, image_get_header_size (), (char *)hdr);
} else
#endif
/* copy from dataflash if needed */
img_addr = gen_get_image (img_addr);
hdr = (image_header_t *)img_addr;
if (!image_check_magic(hdr)) {
@@ -324,16 +316,8 @@ static image_header_t *get_kernel (cmd_tbl_t *cmdtp, int flag,
show_boot_progress (-2);
return NULL;
}
show_boot_progress (3);
#ifdef CONFIG_HAS_DATAFLASH
if (addr_dataflash (img_addr))
read_dataflash (img_addr + image_get_header_size (),
image_get_data_size (hdr),
(char *)image_get_data (hdr));
#endif
/* uImage is in a system RAM, pointed to by hdr */
print_image_hdr (hdr);
if (verify) {