break;
case MTD_IMAGE_FORMAT_SEAMA:
if (mtd_fixseama)
- mtd_fixseama(mtd, 0);
+ mtd_fixseama(mtd, 0, 0);
break;
default:
break;
if (mtd_fixtrx) {
fprintf(stderr,
" -o offset offset of the image header in the partition(for fixtrx)\n");
+ }
+ if (mtd_fixtrx || mtd_fixseama) {
fprintf(stderr,
- " -c datasize amount of data to be used for checksum calculation (for fixtrx)\n");
+ " -c datasize amount of data to be used for checksum calculation (for fixtrx / fixseama)\n");
}
fprintf(stderr,
#ifdef FIS_SUPPORT
break;
case CMD_FIXSEAMA:
if (mtd_fixseama)
- mtd_fixseama(device, 0);
+ mtd_fixseama(device, 0, data_size);
break;
}
extern int trx_fixup(int fd, const char *name) __attribute__ ((weak));
extern int trx_check(int imagefd, const char *mtd, char *buf, int *len) __attribute__ ((weak));
extern int mtd_fixtrx(const char *mtd, size_t offset, size_t data_size) __attribute__ ((weak));
-extern int mtd_fixseama(const char *mtd, size_t offset) __attribute__ ((weak));
+extern int mtd_fixseama(const char *mtd, size_t offset, size_t data_size) __attribute__ ((weak));
extern int mtd_resetbc(const char *mtd) __attribute__ ((weak));
#endif /* __mtd_h */
}
int
-mtd_fixseama(const char *mtd, size_t offset)
+mtd_fixseama(const char *mtd, size_t offset, size_t data_size)
{
int fd;
char *first_block;
ssize_t res;
size_t block_offset;
size_t data_offset;
- size_t data_size;
struct seama_entity_header *shdr;
if (quiet < 2)
}
data_offset = offset + sizeof(struct seama_entity_header) + ntohs(shdr->metasize);
- data_size = mtdsize - data_offset;
+ if (!data_size)
+ data_size = mtdsize - data_offset;
if (data_size > ntohl(shdr->size))
data_size = ntohl(shdr->size);
if (seama_fix_md5(shdr, fd, data_offset, data_size))