struct fis_image_desc *redboot = NULL;
struct fis_image_desc *first = NULL;
struct fis_image_desc *last = NULL;
+ struct fis_image_desc *first_fb = NULL;
+ struct fis_image_desc *last_fb = NULL;
struct fis_image_desc *desc;
struct fis_part *part;
uint32_t offset = 0, size = 0;
}
desc--;
+ first_fb = first;
+ last_fb = last;
+
+ if (first_fb->hdr.flash_base > last_fb->hdr.flash_base) {
+ first_fb = last;
+ last_fb = first;
+ }
+
/* determine size of available space */
desc = (struct fis_image_desc *) start;
while ((char *) desc < end) {
if (!desc->hdr.name[0] || (desc->hdr.name[0] == 0xff))
break;
- if (desc->hdr.flash_base > last->hdr.flash_base &&
+ if (desc->hdr.flash_base > last_fb->hdr.flash_base &&
desc->hdr.flash_base < offset)
offset = desc->hdr.flash_base;
}
desc--;
- size = offset - first->hdr.flash_base;
+ size = offset - first_fb->hdr.flash_base;
#ifdef notyet
desc = first - 1;
last++;
desc = first + n_new;
- offset = first->hdr.flash_base;
+ offset = first_fb->hdr.flash_base;
if (desc != last) {
if (desc > last)