summaryrefslogtreecommitdiff
path: root/package/mtd
diff options
context:
space:
mode:
Diffstat (limited to 'package/mtd')
-rw-r--r--package/mtd/Makefile2
-rw-r--r--package/mtd/src/jffs2.c3
-rw-r--r--package/mtd/src/mtd.c8
-rw-r--r--package/mtd/src/trx.c6
4 files changed, 11 insertions, 8 deletions
diff --git a/package/mtd/Makefile b/package/mtd/Makefile
index 27338d7..7ca6b0e 100644
--- a/package/mtd/Makefile
+++ b/package/mtd/Makefile
@@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk
include $(INCLUDE_DIR)/kernel.mk
PKG_NAME:=mtd
-PKG_RELEASE:=17
+PKG_RELEASE:=18
PKG_BUILD_DIR := $(KERNEL_BUILD_DIR)/$(PKG_NAME)
STAMP_PREPARED := $(STAMP_PREPARED)_$(call confvar,CONFIG_MTD_REDBOOT_PARTS)
diff --git a/package/mtd/src/jffs2.c b/package/mtd/src/jffs2.c
index aaf9be5..2a83bd4 100644
--- a/package/mtd/src/jffs2.c
+++ b/package/mtd/src/jffs2.c
@@ -244,9 +244,6 @@ int mtd_replace_jffs2(const char *mtd, int fd, int ofs, const char *filename)
pad(erasesize);
free(buf);
- if (trx_fixup) {
- trx_fixup(outfd, mtd);
- }
return (mtdofs - ofs);
}
diff --git a/package/mtd/src/mtd.c b/package/mtd/src/mtd.c
index 92873ca..18efcf5 100644
--- a/package/mtd/src/mtd.c
+++ b/package/mtd/src/mtd.c
@@ -294,6 +294,7 @@ mtd_write(int imagefd, const char *mtd, char *fis_layout, size_t part_offset)
ssize_t r, w, e;
ssize_t skip = 0;
uint32_t offset = 0;
+ int jffs2_replaced = 0;
#ifdef FIS_SUPPORT
static struct fis_part new_parts[MAX_ARGS];
@@ -417,6 +418,7 @@ resume:
fprintf(stderr, "\nAppending jffs2 data from %s to %s...", jffs2file, mtd);
/* got an EOF marker - this is the place to add some jffs2 data */
skip = mtd_replace_jffs2(mtd, fd, e, jffs2file);
+ jffs2_replaced = 1;
/* don't add it again */
jffs2file = NULL;
@@ -482,6 +484,10 @@ resume:
offset = 0;
}
+ if (jffs2_replaced && trx_fixup) {
+ trx_fixup(fd, mtd);
+ }
+
if (!quiet)
fprintf(stderr, "\b\b\b\b ");
@@ -575,7 +581,7 @@ int main (int argc, char **argv)
force = 0;
buflen = 0;
quiet = 0;
- no_erase = 0;
+ no_erase = 0;
while ((ch = getopt(argc, argv,
#ifdef FIS_SUPPORT
diff --git a/package/mtd/src/trx.c b/package/mtd/src/trx.c
index d1aab36..65c2440 100644
--- a/package/mtd/src/trx.c
+++ b/package/mtd/src/trx.c
@@ -154,15 +154,15 @@ mtd_fixtrx(const char *mtd, size_t offset)
if (quiet < 2)
fprintf(stderr, "Trying to fix trx header in %s at 0x%x...\n", mtd, offset);
- block_offset = offset & ~(erasesize - 1);
- offset -= block_offset;
-
fd = mtd_check_open(mtd);
if(fd < 0) {
fprintf(stderr, "Could not open mtd device: %s\n", mtd);
exit(1);
}
+ block_offset = offset & ~(erasesize - 1);
+ offset -= block_offset;
+
if (block_offset + erasesize > mtdsize) {
fprintf(stderr, "Offset too large, device size 0x%x\n", mtdsize);
exit(1);