diff options
author | Lauren Post <lauren.post@freescale.com> | 2014-03-07 15:52:43 -0600 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2014-03-11 09:30:13 -0700 |
commit | 798877eac9708fcf8206a51318ba3dc576a71893 (patch) | |
tree | 90bf89ad429ab122cf73280b488c3680c615a49f /meta/recipes-devtools/mtd/mtd-utils | |
parent | 7a8f3c783e63178fbd075c31c36ee6f07ff0b979 (diff) | |
download | poky-798877eac9708fcf8206a51318ba3dc576a71893.tar.gz |
mtd-utils: Update version to include fixes after 1.5.0
This includes fixes on master branch not in the 1.5.0 release
(From OE-Core rev: 51a2478b5542b2a1315c98d3f807535b9f0c46d2)
Signed-off-by: Lauren Post <lauren.post@freescale.com>
Signed-off-by: Saul Wold <sgw@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/recipes-devtools/mtd/mtd-utils')
2 files changed, 236 insertions, 0 deletions
diff --git a/meta/recipes-devtools/mtd/mtd-utils/add-exclusion-to-mkfs-jffs2-git-2.patch b/meta/recipes-devtools/mtd/mtd-utils/add-exclusion-to-mkfs-jffs2-git-2.patch new file mode 100644 index 0000000000..57d6a30d82 --- /dev/null +++ b/meta/recipes-devtools/mtd/mtd-utils/add-exclusion-to-mkfs-jffs2-git-2.patch | |||
@@ -0,0 +1,103 @@ | |||
1 | Upstream-Status: Pending | ||
2 | |||
3 | --- /tmp/mkfs.jffs2.c 2009-01-11 15:28:41.000000000 +0100 | ||
4 | +++ git/mkfs.jffs2.c 2009-01-11 15:59:29.000000000 +0100 | ||
5 | @@ -100,6 +100,11 @@ | ||
6 | struct rb_node hardlink_rb; | ||
7 | }; | ||
8 | |||
9 | +struct ignorepath_entry { | ||
10 | + struct ignorepath_entry* next; /* Points to the next ignorepath element */ | ||
11 | + char name[PATH_MAX]; /* Name of the entry */ | ||
12 | +}; | ||
13 | +static struct ignorepath_entry* ignorepath = 0; | ||
14 | struct rb_root hardlinks; | ||
15 | static int out_fd = -1; | ||
16 | static int in_fd = -1; | ||
17 | @@ -408,7 +413,7 @@ | ||
18 | char *hpath, *tpath; | ||
19 | struct dirent *dp, **namelist; | ||
20 | struct filesystem_entry *entry; | ||
21 | - | ||
22 | + struct ignorepath_entry* element = ignorepath; | ||
23 | |||
24 | if (lstat(hostpath, &sb)) { | ||
25 | perror_msg_and_die("%s", hostpath); | ||
26 | @@ -417,6 +422,15 @@ | ||
27 | entry = add_host_filesystem_entry(targetpath, hostpath, | ||
28 | sb.st_uid, sb.st_gid, sb.st_mode, 0, parent); | ||
29 | |||
30 | + while ( element ) { | ||
31 | + if ( strcmp( element->name, targetpath ) == 0 ) { | ||
32 | + printf( "Note: ignoring directories below '%s'\n", targetpath ); | ||
33 | + return entry; | ||
34 | + break; | ||
35 | + } | ||
36 | + element = element->next; | ||
37 | + } | ||
38 | + | ||
39 | n = scandir(hostpath, &namelist, 0, alphasort); | ||
40 | if (n < 0) { | ||
41 | perror_msg_and_die("opening directory %s", hostpath); | ||
42 | @@ -1453,6 +1467,7 @@ | ||
43 | {"root", 1, NULL, 'r'}, | ||
44 | {"pagesize", 1, NULL, 's'}, | ||
45 | {"eraseblock", 1, NULL, 'e'}, | ||
46 | + {"ignore", 1, NULL, 'I'}, | ||
47 | {"output", 1, NULL, 'o'}, | ||
48 | {"help", 0, NULL, 'h'}, | ||
49 | {"verbose", 0, NULL, 'v'}, | ||
50 | @@ -1500,6 +1515,7 @@ | ||
51 | " -L, --list-compressors Show the list of the avaiable compressors\n" | ||
52 | " -t, --test-compression Call decompress and compare with the original (for test)\n" | ||
53 | " -n, --no-cleanmarkers Don't add a cleanmarker to every eraseblock\n" | ||
54 | +" -I, --ignore=PATH Ignore sub directory and file tree below PATH when recursing over the file system\n" | ||
55 | " -o, --output=FILE Output to FILE (default: stdout)\n" | ||
56 | " -l, --little-endian Create a little-endian filesystem\n" | ||
57 | " -b, --big-endian Create a big-endian filesystem\n" | ||
58 | @@ -1666,6 +1682,7 @@ | ||
59 | char *compr_name = NULL; | ||
60 | int compr_prior = -1; | ||
61 | int warn_page_size = 0; | ||
62 | + struct ignorepath_entry* element = ignorepath; | ||
63 | |||
64 | page_size = sysconf(_SC_PAGESIZE); | ||
65 | if (page_size < 0) /* System doesn't know so ... */ | ||
66 | @@ -1676,7 +1693,7 @@ | ||
67 | jffs2_compressors_init(); | ||
68 | |||
69 | while ((opt = getopt_long(argc, argv, | ||
70 | - "D:d:r:s:o:qUPfh?vVe:lbp::nc:m:x:X:Lty:i:", long_options, &c)) >= 0) | ||
71 | + "D:d:r:s:I:o:qUPfh?vVe:lbp::nc:m:x:X:Lty:i:", long_options, &c)) >= 0) | ||
72 | { | ||
73 | switch (opt) { | ||
74 | case 'D': | ||
75 | @@ -1700,6 +1717,28 @@ | ||
76 | warn_page_size = 0; /* set by user, so don't need to warn */ | ||
77 | break; | ||
78 | |||
79 | + case 'I': | ||
80 | + printf( "Note: Adding '%s' to ignore Path\n", optarg ); | ||
81 | + element = ignorepath; | ||
82 | + if ( !ignorepath ) { | ||
83 | + ignorepath = xmalloc( sizeof( struct ignorepath_entry ) ); | ||
84 | + ignorepath->next = 0; | ||
85 | + strcpy( &ignorepath->name[0], optarg ); | ||
86 | + } else { | ||
87 | + while ( element->next ) element = element->next; | ||
88 | + element->next = xmalloc( sizeof( struct ignorepath_entry ) ); | ||
89 | + element->next->next = 0; | ||
90 | + strcpy( &element->next->name[0], optarg ); | ||
91 | + } | ||
92 | + printf( "--------- Dumping ignore path list ----------------\n" ); | ||
93 | + element = ignorepath; | ||
94 | + while ( element ) { | ||
95 | + printf( " * '%s'\n", &element->name[0] ); | ||
96 | + element = element->next; | ||
97 | + } | ||
98 | + printf( "---------------------------------------------------\n" ); | ||
99 | + break; | ||
100 | + | ||
101 | case 'o': | ||
102 | if (out_fd != -1) { | ||
103 | error_msg_and_die("output filename specified more than once"); | ||
diff --git a/meta/recipes-devtools/mtd/mtd-utils/mtd-utils-fix-corrupt-cleanmarker-with-flash_erase--j-command.patch b/meta/recipes-devtools/mtd/mtd-utils/mtd-utils-fix-corrupt-cleanmarker-with-flash_erase--j-command.patch new file mode 100644 index 0000000000..a66087e301 --- /dev/null +++ b/meta/recipes-devtools/mtd/mtd-utils/mtd-utils-fix-corrupt-cleanmarker-with-flash_erase--j-command.patch | |||
@@ -0,0 +1,133 @@ | |||
1 | Upstream-Status: Pending | ||
2 | From patchwork Mon Aug 8 08:16:43 2011 | ||
3 | Content-Type: text/plain; charset="utf-8" | ||
4 | MIME-Version: 1.0 | ||
5 | Content-Transfer-Encoding: 7bit | ||
6 | Subject: mtd-utils: fix corrupt cleanmarker with flash_erase -j command | ||
7 | Date: Sun, 07 Aug 2011 22:16:43 -0000 | ||
8 | From: b35362@freescale.com | ||
9 | X-Patchwork-Id: 108873 | ||
10 | Message-Id: <1312791403-13473-1-git-send-email-b35362@freescale.com> | ||
11 | To: <dwmw2@infradead.org> | ||
12 | Cc: Liu Shuo <b35362@freescale.com>, Artem.Bityutskiy@nokia.com, | ||
13 | Li Yang <leoli@freescale.com>, linux-mtd@lists.infradead.org | ||
14 | |||
15 | From: Liu Shuo <b35362@freescale.com> | ||
16 | |||
17 | Flash_erase -j should fill discrete freeoob areas with required bytes | ||
18 | of JFFS2 cleanmarker in jffs2_check_nand_cleanmarker(). Not just fill | ||
19 | the first freeoob area. | ||
20 | |||
21 | The below is the result without this workaround: | ||
22 | |||
23 | JFFS2: Erase block at 0x00000000 is not formatted. It will be erased | ||
24 | JFFS2: Erase block at 0x00004000 is not formatted. It will be erased | ||
25 | JFFS2: Erase block at 0x00008000 is not formatted. It will be erased | ||
26 | JFFS2: Erase block at 0x0000c000 is not formatted. It will be erased | ||
27 | JFFS2: Erase block at 0x00010000 is not formatted. It will be erased | ||
28 | JFFS2: Erase block at 0x00014000 is not formatted. It will be erased | ||
29 | JFFS2: Erase block at 0x00018000 is not formatted. It will be erased | ||
30 | JFFS2: Erase block at 0x0001c000 is not formatted. It will be erased | ||
31 | JFFS2: Erase block at 0x00020000 is not formatted. It will be erased | ||
32 | JFFS2: Erase block at 0x00024000 is not formatted. It will be erased | ||
33 | JFFS2: Erase block at 0x00028000 is not formatted. It will be erased | ||
34 | ... | ||
35 | |||
36 | Signed-off-by: Liu Shuo <b35362@freescale.com> | ||
37 | Signed-off-by: Li Yang <leoli@freescale.com> | ||
38 | |||
39 | --- | ||
40 | v2 : get length of availble freeoob bytes from oobinfo information, | ||
41 | not use the ioctl ECCGETLAYOUT which is being deprecated. | ||
42 | |||
43 | flash_erase.c | 46 +++++++++++++++++++++++++++++++++++++++------- | ||
44 | 1 files changed, 39 insertions(+), 7 deletions(-) | ||
45 | |||
46 | diff --git a/flash_erase.c b/flash_erase.c | ||
47 | index fe2eaca..3e94495 100644 | ||
48 | --- a/flash_erase.c | ||
49 | +++ b/flash_erase.c | ||
50 | @@ -98,6 +98,7 @@ int main(int argc, char *argv[]) | ||
51 | int isNAND; | ||
52 | int error = 0; | ||
53 | uint64_t offset = 0; | ||
54 | + void *oob_data = NULL; | ||
55 | |||
56 | /* | ||
57 | * Process user arguments | ||
58 | @@ -197,15 +198,43 @@ int main(int argc, char *argv[]) | ||
59 | if (ioctl(fd, MEMGETOOBSEL, &oobinfo) != 0) | ||
60 | return sys_errmsg("%s: unable to get NAND oobinfo", mtd_device); | ||
61 | |||
62 | + cleanmarker.totlen = cpu_to_je32(8); | ||
63 | /* Check for autoplacement */ | ||
64 | if (oobinfo.useecc == MTD_NANDECC_AUTOPLACE) { | ||
65 | - /* Get the position of the free bytes */ | ||
66 | - if (!oobinfo.oobfree[0][1]) | ||
67 | + struct nand_ecclayout_user ecclayout; | ||
68 | + int i, oobavail; | ||
69 | + | ||
70 | + for (i = 0, oobavail = 0; oobinfo.oobfree[i][1]; i++) | ||
71 | + oobavail += oobinfo.oobfree[i][1]; | ||
72 | + | ||
73 | + if (!oobavail) | ||
74 | return errmsg(" Eeep. Autoplacement selected and no empty space in oob"); | ||
75 | + | ||
76 | + /* Get the position of the free bytes */ | ||
77 | clmpos = oobinfo.oobfree[0][0]; | ||
78 | - clmlen = oobinfo.oobfree[0][1]; | ||
79 | - if (clmlen > 8) | ||
80 | - clmlen = 8; | ||
81 | + clmlen = MIN(oobavail, 8); | ||
82 | + | ||
83 | + if (oobinfo.oobfree[0][1] < 8 && oobavail >= 8) { | ||
84 | + int left, n, last = 0; | ||
85 | + void *cm; | ||
86 | + | ||
87 | + oob_data = malloc(mtd.oob_size); | ||
88 | + if (!oob_data) | ||
89 | + return -ENOMEM; | ||
90 | + | ||
91 | + memset(oob_data, 0xff, mtd.oob_size); | ||
92 | + cm = &cleanmarker; | ||
93 | + for (i = 0, left = clmlen; left ; i++) { | ||
94 | + n = MIN(left, oobinfo.oobfree[i][1]); | ||
95 | + memcpy(oob_data + oobinfo.oobfree[i][0], | ||
96 | + cm, n); | ||
97 | + left -= n; | ||
98 | + cm += n; | ||
99 | + last = oobinfo.oobfree[i][0] + n; | ||
100 | + } | ||
101 | + | ||
102 | + clmlen = last - clmpos; | ||
103 | + } | ||
104 | } else { | ||
105 | /* Legacy mode */ | ||
106 | switch (mtd.oob_size) { | ||
107 | @@ -223,7 +252,6 @@ int main(int argc, char *argv[]) | ||
108 | break; | ||
109 | } | ||
110 | } | ||
111 | - cleanmarker.totlen = cpu_to_je32(8); | ||
112 | } | ||
113 | cleanmarker.hdr_crc = cpu_to_je32(mtd_crc32(0, &cleanmarker, sizeof(cleanmarker) - 4)); | ||
114 | } | ||
115 | @@ -272,7 +300,8 @@ int main(int argc, char *argv[]) | ||
116 | |||
117 | /* write cleanmarker */ | ||
118 | if (isNAND) { | ||
119 | - if (mtd_write_oob(mtd_desc, &mtd, fd, offset + clmpos, clmlen, &cleanmarker) != 0) { | ||
120 | + void *data = oob_data ? oob_data + clmpos : &cleanmarker; | ||
121 | + if (mtd_write_oob(mtd_desc, &mtd, fd, offset + clmpos, clmlen, data) != 0) { | ||
122 | sys_errmsg("%s: MTD writeoob failure", mtd_device); | ||
123 | continue; | ||
124 | } | ||
125 | @@ -291,5 +320,8 @@ int main(int argc, char *argv[]) | ||
126 | show_progress(&mtd, offset, eb, eb_start, eb_cnt); | ||
127 | bareverbose(!quiet, "\n"); | ||
128 | |||
129 | + if (oob_data) | ||
130 | + free(oob_data); | ||
131 | + | ||
132 | return 0; | ||
133 | } | ||