diff options
author | Robert Yang <liezhi.yang@windriver.com> | 2015-04-24 00:54:09 -0700 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2015-04-24 11:14:38 +0100 |
commit | 438b7e0550dad18819ac4f8de697881e6279f201 (patch) | |
tree | bfd239357d8742fd88927e650ce51ef220c2f354 /meta/recipes-devtools/mtd/mtd-utils | |
parent | 2f78aebed25e6394c18eeed2ec840d01d4787e96 (diff) | |
download | poky-438b7e0550dad18819ac4f8de697881e6279f201.tar.gz |
mtd-utils: enable mtd-utils-fix-corrupt-cleanmarker-with-flash_erase--j-command.patch
We still need it, so update and enable it.
(From OE-Core rev: 4b57b7d59ddea33ee7696880ea1652e56f46d843)
Signed-off-by: Robert Yang <liezhi.yang@windriver.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/recipes-devtools/mtd/mtd-utils')
-rw-r--r-- | meta/recipes-devtools/mtd/mtd-utils/mtd-utils-fix-corrupt-cleanmarker-with-flash_erase--j-command.patch | 22 |
1 files changed, 13 insertions, 9 deletions
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 index a66087e301..7207cfcb3a 100644 --- 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 | |||
@@ -36,6 +36,10 @@ JFFS2: Erase block at 0x00028000 is not formatted. It will be erased | |||
36 | Signed-off-by: Liu Shuo <b35362@freescale.com> | 36 | Signed-off-by: Liu Shuo <b35362@freescale.com> |
37 | Signed-off-by: Li Yang <leoli@freescale.com> | 37 | Signed-off-by: Li Yang <leoli@freescale.com> |
38 | 38 | ||
39 | Updated for the new version | ||
40 | |||
41 | Signed-off-by: Robert Yang <liezhi.yang@windriver.com> | ||
42 | |||
39 | --- | 43 | --- |
40 | v2 : get length of availble freeoob bytes from oobinfo information, | 44 | v2 : get length of availble freeoob bytes from oobinfo information, |
41 | not use the ioctl ECCGETLAYOUT which is being deprecated. | 45 | not use the ioctl ECCGETLAYOUT which is being deprecated. |
@@ -44,18 +48,18 @@ v2 : get length of availble freeoob bytes from oobinfo information, | |||
44 | 1 files changed, 39 insertions(+), 7 deletions(-) | 48 | 1 files changed, 39 insertions(+), 7 deletions(-) |
45 | 49 | ||
46 | diff --git a/flash_erase.c b/flash_erase.c | 50 | diff --git a/flash_erase.c b/flash_erase.c |
47 | index fe2eaca..3e94495 100644 | 51 | index 933373a..4b9d84b 100644 |
48 | --- a/flash_erase.c | 52 | --- a/flash_erase.c |
49 | +++ b/flash_erase.c | 53 | +++ b/flash_erase.c |
50 | @@ -98,6 +98,7 @@ int main(int argc, char *argv[]) | 54 | @@ -99,6 +99,7 @@ int main(int argc, char *argv[]) |
51 | int isNAND; | 55 | bool isNAND; |
52 | int error = 0; | 56 | int error = 0; |
53 | uint64_t offset = 0; | 57 | off_t offset = 0; |
54 | + void *oob_data = NULL; | 58 | + void *oob_data = NULL; |
55 | 59 | ||
56 | /* | 60 | /* |
57 | * Process user arguments | 61 | * Process user arguments |
58 | @@ -197,15 +198,43 @@ int main(int argc, char *argv[]) | 62 | @@ -201,15 +202,43 @@ int main(int argc, char *argv[]) |
59 | if (ioctl(fd, MEMGETOOBSEL, &oobinfo) != 0) | 63 | if (ioctl(fd, MEMGETOOBSEL, &oobinfo) != 0) |
60 | return sys_errmsg("%s: unable to get NAND oobinfo", mtd_device); | 64 | return sys_errmsg("%s: unable to get NAND oobinfo", mtd_device); |
61 | 65 | ||
@@ -104,7 +108,7 @@ index fe2eaca..3e94495 100644 | |||
104 | } else { | 108 | } else { |
105 | /* Legacy mode */ | 109 | /* Legacy mode */ |
106 | switch (mtd.oob_size) { | 110 | switch (mtd.oob_size) { |
107 | @@ -223,7 +252,6 @@ int main(int argc, char *argv[]) | 111 | @@ -227,7 +256,6 @@ int main(int argc, char *argv[]) |
108 | break; | 112 | break; |
109 | } | 113 | } |
110 | } | 114 | } |
@@ -112,13 +116,13 @@ index fe2eaca..3e94495 100644 | |||
112 | } | 116 | } |
113 | cleanmarker.hdr_crc = cpu_to_je32(mtd_crc32(0, &cleanmarker, sizeof(cleanmarker) - 4)); | 117 | cleanmarker.hdr_crc = cpu_to_je32(mtd_crc32(0, &cleanmarker, sizeof(cleanmarker) - 4)); |
114 | } | 118 | } |
115 | @@ -272,7 +300,8 @@ int main(int argc, char *argv[]) | 119 | @@ -276,7 +304,8 @@ int main(int argc, char *argv[]) |
116 | 120 | ||
117 | /* write cleanmarker */ | 121 | /* write cleanmarker */ |
118 | if (isNAND) { | 122 | if (isNAND) { |
119 | - if (mtd_write_oob(mtd_desc, &mtd, fd, offset + clmpos, clmlen, &cleanmarker) != 0) { | 123 | - if (mtd_write_oob(mtd_desc, &mtd, fd, (uint64_t)offset + clmpos, clmlen, &cleanmarker) != 0) { |
120 | + void *data = oob_data ? oob_data + clmpos : &cleanmarker; | 124 | + void *data = oob_data ? oob_data + clmpos : &cleanmarker; |
121 | + if (mtd_write_oob(mtd_desc, &mtd, fd, offset + clmpos, clmlen, data) != 0) { | 125 | + if (mtd_write_oob(mtd_desc, &mtd, fd, (uint64_t)offset + clmpos, clmlen, data) != 0) { |
122 | sys_errmsg("%s: MTD writeoob failure", mtd_device); | 126 | sys_errmsg("%s: MTD writeoob failure", mtd_device); |
123 | continue; | 127 | continue; |
124 | } | 128 | } |