If force_reloc flag is not set and booti is called for an address
ouside RAM (i. e. QSPI NOR flash), we should honor that and not try
to force relocation in a bogus fashion.
Signed-off-by: Vitaly Wool <vitaly.wool@konsulko.com>
Reviewed-by: Leo Yu-Chi Liang <ycliang@andestech.com>
return -EINVAL;
}
*size = lhdr->image_size;
- *relocated_addr = gd->ram_base + lhdr->text_offset;
+ if (force_reloc ||
+ (gd->ram_base <= image && image < gd->ram_base + gd->ram_size)) {
+ *relocated_addr = gd->ram_base + lhdr->text_offset;
+ } else {
+ *relocated_addr = image;
+ }
unmap_sysmem(lhdr);