fis-004-sorted_list.patch 892 B

123456789101112131415161718192021222324252627282930
  1. --- fis.orig/fis.c 2010-05-12 11:09:22.000000000 -0700
  2. +++ fis/fis.c 2010-05-12 11:05:45.000000000 -0700
  3. @@ -401,9 +401,24 @@
  4. dir_t dir;
  5. load_dir(fd,offset,&size,swap_endianness,&dir);
  6. fprintf(stdout,"Name FLASH addr Mem addr Length Entry point Checksum\n");
  7. - FOR_EACH_DIR_ENTRY(dir,i) {
  8. - dump_desc(stdout,get(i));
  9. - }
  10. + uint32_t last_addr = 0;
  11. + bool image_found;
  12. + do {
  13. + uint32_t lowest_addr = 0xffffffff;
  14. + iter_t index;
  15. + image_found = false;
  16. + FOR_EACH_DIR_ENTRY(dir,i) {
  17. + const struct fis_image_desc *d = get(i);
  18. + if ((d->flash_base >= last_addr) && (d->flash_base < lowest_addr)) {
  19. + lowest_addr = d->flash_base;
  20. + image_found = true;
  21. + index = i;
  22. + }
  23. + }
  24. + if (image_found)
  25. + dump_desc(stdout,get(index));
  26. + last_addr = lowest_addr + 1;
  27. + } while (image_found == true);
  28. }