This commit is contained in:
Sukru Senli 2015-05-25 18:38:18 +02:00 committed by Martin Schröder
parent fa2504ab2a
commit 75a9ee969d
3 changed files with 1 additions and 116 deletions

View file

@ -15,7 +15,7 @@ PKG_INSTALL:=1
PKG_SOURCE_URL:=git@iopsys.inteno.se:mtd-utils
PKG_SOURCE_PROTO:=git
PKG_SOURCE_VERSION:=1627a29d45121fe96fa19f07eb41ccef5638b9ec
PKG_SOURCE_VERSION:=04fdc787a3cdd7e779724762c2daff0762c78af4
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)

View file

@ -1,58 +0,0 @@
--- a/flash_eraseall.c 2009-03-14 02:09:35.000000000 +0100
+++ b/flash_eraseall.c 2012-09-13 14:06:45.000000000 +0200
@@ -47,6 +47,7 @@
static const char *mtd_device;
static int quiet; /* true -- don't output progress */
static int jffs2; // format for jffs2 usage
+static int broken_cfe; // ignore oob layout and just write the cleanmarker at the start
static void process_options (int argc, char *argv[]);
void show_progress (mtd_info_t *meminfo, erase_info_t *erase);
@@ -162,8 +163,13 @@
if (isNAND) {
struct mtd_oob_buf oob;
oob.ptr = (unsigned char *) &cleanmarker;
- oob.start = erase.start + clmpos;
- oob.length = clmlen;
+ if (broken_cfe) {
+ oob.start = erase.start;
+ oob.length = 8;
+ } else {
+ oob.start = erase.start + clmpos;
+ oob.length = clmlen;
+ }
if (ioctl (fd, MEMWRITEOOB, &oob) != 0) {
fprintf(stderr, "\n%s: %s: MTD writeoob failure: %s\n", exe_name, mtd_device, strerror(errno));
continue;
@@ -198,11 +204,12 @@
for (;;) {
int option_index = 0;
- static const char *short_options = "jq";
+ static const char *short_options = "jqb";
static const struct option long_options[] = {
{"help", no_argument, 0, 0},
{"version", no_argument, 0, 0},
{"jffs2", no_argument, 0, 'j'},
+ {"broken", no_argument, 0, 'b'},
{"quiet", no_argument, 0, 'q'},
{"silent", no_argument, 0, 'q'},
@@ -229,6 +236,9 @@
case 'q':
quiet = 1;
break;
+ case 'b':
+ broken_cfe = 1;
+ break;
case 'j':
jffs2 = 1;
break;
@@ -264,6 +274,7 @@
"Erases all of the specified MTD device.\n"
"\n"
" -j, --jffs2 format the device for jffs2\n"
+ " -b, --broken don't respect oob layout, needed for some Broadcom cfe\n"
" -q, --quiet don't display progress messages\n"
" --silent same as --quiet\n"
" --help display this help and exit\n"

View file

@ -1,57 +0,0 @@
--- a/nandwrite.c 2009-03-14 02:09:35.000000000 +0100
+++ b/nandwrite.c 2012-09-14 12:31:22.821247513 +0200
@@ -88,6 +88,7 @@
" -n, --noecc Write without ecc\n"
" -o, --oob Image contains oob data\n"
" -s addr, --start=addr Set start address (default is 0)\n"
+" -i addr, --ioffs=addr Set offset of the input file (default is 0)\n"
" -p, --pad Pad to page size\n"
" -b, --blockalign=1|2|4 Set multiple of eraseblocks to align to\n"
" -q, --quiet Don't display progress messages\n"
@@ -115,6 +116,7 @@
static const char *standard_input = "-";
static const char *mtd_device, *img;
static int mtdoffset = 0;
+static int imgoffset = 0;
static bool quiet = false;
static bool writeoob = false;
static bool autoplace = false;
@@ -132,7 +134,7 @@
for (;;) {
int option_index = 0;
- static const char *short_options = "ab:fjmnopqs:y";
+ static const char *short_options = "ab:fjmnopqsi:y";
static const struct option long_options[] = {
{"help", no_argument, 0, 0},
{"version", no_argument, 0, 0},
@@ -146,6 +148,7 @@
{"pad", no_argument, 0, 'p'},
{"quiet", no_argument, 0, 'q'},
{"start", required_argument, 0, 's'},
+ {"ioffs", required_argument, 0, 'i'},
{"yaffs", no_argument, 0, 'y'},
{0, 0, 0, 0},
};
@@ -197,6 +200,9 @@
case 's':
mtdoffset = strtol (optarg, NULL, 0);
break;
+ case 'i':
+ imgoffset = strtol (optarg, NULL, 0);
+ break;
case 'b':
blockalign = atoi (optarg);
break;
@@ -411,9 +417,10 @@
if (ifd == STDIN_FILENO) {
imglen = pagelen;
+ lseek (ifd, imgoffset, SEEK_SET);
} else {
imglen = lseek(ifd, 0, SEEK_END);
- lseek (ifd, 0, SEEK_SET);
+ lseek (ifd, imgoffset, SEEK_SET);
}
// Check, if file is page-aligned