debug ("image_start = 0x%lX, image_end = 0x%lx\n", image_start, image_end);
debug ("load_start = 0x%lx, load_end = 0x%lx\n", load_start, load_end);
- puts ("ERROR: image overwritten - must RESET the board to recover.\n");
- show_boot_progress (-113);
- do_reset (cmdtp, flag, argc, argv);
+ if (images.legacy_hdr_valid) {
+ if (image_get_type (&images.legacy_hdr_os_copy) == IH_TYPE_MULTI)
+ puts ("WARNING: legacy format multi component "
+ "image overwritten\n");
+ } else {
+ puts ("ERROR: new format image overwritten - "
+ "must RESET the board to recover\n");
+ show_boot_progress (-113);
+ do_reset (cmdtp, flag, argc, argv);
+ }
}
show_boot_progress (8);
show_boot_progress (-5);
return NULL;
}
+
+ /*
+ * copy image header to allow for image overwrites during kernel
+ * decompression.
+ */
+ memmove (&images->legacy_hdr_os_copy, hdr, sizeof(image_header_t));
+
+ /* save pointer to image header */
images->legacy_hdr_os = hdr;
- images->legacy_hdr_valid = 1;
+ images->legacy_hdr_valid = 1;
show_boot_progress (6);
break;
#if defined(CONFIG_FIT)
* address of the original image header.
*/
os_hdr = NULL;
- if (image_check_type (hdr, IH_TYPE_MULTI)) {
+ if (image_check_type (&images->legacy_hdr_os_copy, IH_TYPE_MULTI)) {
image_multi_getimg (hdr, 1, &kernel_data, &kernel_len);
if (kernel_len)
os_hdr = hdr;
int argc, char *argv[],
bootm_headers_t *images)
{
- image_header_t *hdr = images->legacy_hdr_os;
+ image_header_t *hdr = &images->legacy_hdr_os_copy;
#if defined(CONFIG_FIT)
if (!images->legacy_hdr_valid) {
int argc, char *argv[],
bootm_headers_t *images)
{
- image_header_t *hdr = images->legacy_hdr_os;
+ image_header_t *hdr = &images->legacy_hdr_os_copy;
void (*entry_point)(bd_t *);
#if defined(CONFIG_FIT)
bootm_headers_t *images)
{
char str[80];
- image_header_t *hdr = images->legacy_hdr_os;
+ image_header_t *hdr = &images->legacy_hdr_os_copy;
#if defined(CONFIG_FIT)
- if (hdr == NULL) {
+ if (!images->legacy_hdr_valid) {
fit_unsupported_reset ("VxWorks");
do_reset (cmdtp, flag, argc, argv);
}
{
char *local_args[2];
char str[16];
- image_header_t *hdr = images->legacy_hdr_os;
+ image_header_t *hdr = &images->legacy_hdr_os_copy;
#if defined(CONFIG_FIT)
if (!images->legacy_hdr_valid) {
int i, j, nxt, len, envno, envsz;
bd_t *kbd;
void (*entry)(bd_t *bd, char *cmdline, char **fwenv, ulong top);
- image_header_t *hdr = images->legacy_hdr_os;
+ image_header_t *hdr = &images->legacy_hdr_os_copy;
#if defined(CONFIG_FIT)
if (!images->legacy_hdr_valid) {
#endif /* CONFIG_B2 || CONFIG_EVB4510 || CONFIG_ARMADILLO */
} else if (images->legacy_hdr_valid &&
- image_check_type (images->legacy_hdr_os, IH_TYPE_MULTI)) {
+ image_check_type (&images->legacy_hdr_os_copy, IH_TYPE_MULTI)) {
/*
* Now check if we have a legacy mult-component image,
* get second entry data start address and len.
* then boot_get_ramdisk() and get_fdt() will attempt to get
* data from second and third component accordingly.
*/
- image_header_t *legacy_hdr_os;
+ image_header_t *legacy_hdr_os; /* image header pointer */
+ image_header_t legacy_hdr_os_copy; /* header copy */
ulong legacy_hdr_valid;
#if defined(CONFIG_FIT)
/* find kernel entry point */
if (images->legacy_hdr_valid) {
- ep = image_get_ep (images->legacy_hdr_os);
+ ep = image_get_ep (&images->legacy_hdr_os_copy);
#if defined(CONFIG_FIT)
} else if (images->fit_uname_os) {
ret = fit_image_get_entry (images->fit_hdr_os,
/* find kernel entry point */
if (images->legacy_hdr_valid) {
- ep = image_get_ep (images->legacy_hdr_os);
+ ep = image_get_ep (&images->legacy_hdr_os_copy);
#if defined(CONFIG_FIT)
} else if (images->fit_uname_os) {
ret = fit_image_get_entry (images->fit_hdr_os,
/* find kernel entry point */
if (images->legacy_hdr_valid) {
- ep = image_get_ep (images->legacy_hdr_os);
+ ep = image_get_ep (&images->legacy_hdr_os_copy);
#if defined(CONFIG_FIT)
} else if (images->fit_uname_os) {
int ret = fit_image_get_entry (images->fit_hdr_os,
/* find kernel entry point */
if (images->legacy_hdr_valid) {
- ep = image_get_ep (images->legacy_hdr_os);
+ ep = image_get_ep (&images->legacy_hdr_os_copy);
#if defined(CONFIG_FIT)
} else if (images->fit_uname_os) {
ret = fit_image_get_entry (images->fit_hdr_os,
/* find kernel entry point */
if (images->legacy_hdr_valid) {
- ep = image_get_ep (images->legacy_hdr_os);
+ ep = image_get_ep (&images->legacy_hdr_os_copy);
#if defined(CONFIG_FIT)
} else if (images->fit_uname_os) {
int ret = fit_image_get_entry (images->fit_hdr_os,
/* find kernel entry point */
if (images->legacy_hdr_valid) {
- ep = image_get_ep (images->legacy_hdr_os);
+ ep = image_get_ep (&images->legacy_hdr_os_copy);
#if defined(CONFIG_FIT)
} else if (images->fit_uname_os) {
ret = fit_image_get_entry (images->fit_hdr_os,
/* find kernel entry point */
if (images->legacy_hdr_valid) {
- ep = image_get_ep (images->legacy_hdr_os);
+ ep = image_get_ep (&images->legacy_hdr_os_copy);
#if defined(CONFIG_FIT)
} else if (images->fit_uname_os) {
int ret = fit_image_get_entry (images->fit_hdr_os,
/* find kernel entry point */
if (images->legacy_hdr_valid) {
- ep = image_get_ep (images->legacy_hdr_os);
+ ep = image_get_ep (&images->legacy_hdr_os_copy);
#if defined(CONFIG_FIT)
} else if (images->fit_uname_os) {
ret = fit_image_get_entry (images->fit_hdr_os,
printf (" Booting using the fdt blob at 0x%x\n", fdt_blob);
} else if (images->legacy_hdr_valid &&
- image_check_type (images->legacy_hdr_os, IH_TYPE_MULTI)) {
+ image_check_type (&images->legacy_hdr_os_copy, IH_TYPE_MULTI)) {
ulong fdt_data, fdt_len;
/* find kernel entry point */
if (images->legacy_hdr_valid) {
- ep = image_get_ep (images->legacy_hdr_os);
+ ep = image_get_ep (&images->legacy_hdr_os_copy);
#if defined(CONFIG_FIT)
} else if (images->fit_uname_os) {
int ret = fit_image_get_entry (images->fit_hdr_os,