memset(desc, 0, sizeof(struct fis_image_desc));
memcpy(desc->hdr.name, part->name, sizeof(desc->hdr.name));
desc->crc.desc = 0;
- desc->crc.file = 0;
+ desc->crc.file = part->crc;
desc->hdr.flash_base = offset;
desc->hdr.mem_base = part->loadaddr;
desc->hdr.entry_point = part->loadaddr;
desc->hdr.size = (part->size > 0) ? part->size : size;
- desc->hdr.data_length = desc->hdr.size;
-
+ desc->hdr.data_length = (part->length > 0) ? part->length :
+ desc->hdr.size;
offset += desc->hdr.size;
size -= desc->hdr.size;
}
#include <sys/reboot.h>
#include <linux/reboot.h>
#include <mtd/mtd-user.h>
+#include "crc32.h"
#include "fis.h"
#include "mtd.h"
ssize_t r, w, e;
ssize_t skip = 0;
uint32_t offset = 0;
+ int buflen_raw = 0;
int jffs2_replaced = 0;
int skip_bad_blocks = 0;
#ifdef FIS_SUPPORT
static struct fis_part new_parts[MAX_ARGS];
static struct fis_part old_parts[MAX_ARGS];
+ struct fis_part *cur_part = NULL;
int n_new = 0, n_old = 0;
if (fis_layout) {
memset(&old_parts, 0, sizeof(old_parts));
memset(&new_parts, 0, sizeof(new_parts));
+ if (!part_offset)
+ cur_part = new_parts;
do {
next = strchr(tmp, ':');
buflen += r;
}
+ if (buflen_raw == 0)
+ buflen_raw = buflen;
+
if (buflen == 0)
break;
if (skip > 0) {
skip -= buflen;
+ buflen_raw = 0;
buflen = 0;
if (skip <= 0)
indicate_writing(mtd);
w += skip;
e += skip;
skip -= buflen;
+ buflen_raw = 0;
buflen = 0;
offset = 0;
continue;
}
w += buflen;
+#ifdef FIS_SUPPORT
+ if (cur_part && cur_part->size
+ && cur_part < &new_parts[MAX_ARGS - 1]
+ && cur_part->length + buflen_raw > cur_part->size)
+ cur_part++;
+ if (cur_part) {
+ cur_part->length += buflen_raw;
+ cur_part->crc = crc32(cur_part->crc, buf, buflen_raw);
+ }
+#endif
+ buflen_raw = 0;
buflen = 0;
offset = 0;
}