* mtd @ 2018-05-18 8:00 Levente 2018-05-18 9:09 ` mtd David Oberhollenzer 0 siblings, 1 reply; 6+ messages in thread From: Levente @ 2018-05-18 8:00 UTC (permalink / raw) To: linux-mtd Dear all, I don't know if I post this to the right place, so forgive my ignorance. My college discovered a possible bug in OpenWRT's mtd utility. When writing to jffs device, the 'mtd' utility does not skip bad blocks. This patch seems to fix this issue. diff --git a/package/system/mtd/src/jffs2.c b/package/system/mtd/src/jffs2.c index b432f64ac0..5bf3eec328 100644 --- a/package/system/mtd/src/jffs2.c +++ b/package/system/mtd/src/jffs2.c @@ -308,6 +308,16 @@ int mtd_write_jffs2(const char *mtd, const char *filename, const char *dir) for(;;) { struct jffs2_unknown_node *node = (struct jffs2_unknown_node *) buf; + while (mtd_block_is_bad(outfd, mtdofs) && (mtdofs < mtdsize)) { + if (!quiet) + fprintf(stderr, "\nSkipping bad block at 0x%08x ", mtdofs); + + mtdofs += erasesize; + + /* Move the file pointer along over the bad block. */ + lseek(outfd, erasesize, SEEK_CUR); + } + if (read(outfd, buf, erasesize) != erasesize) { fdeof = 1; break; I've cloned your utility repository, but didn't find jffs2.c anywhere. Best regards, Levente ^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: mtd 2018-05-18 8:00 mtd Levente @ 2018-05-18 9:09 ` David Oberhollenzer 2018-05-18 9:14 ` mtd Levente 0 siblings, 1 reply; 6+ messages in thread From: David Oberhollenzer @ 2018-05-18 9:09 UTC (permalink / raw) To: Levente; +Cc: linux-mtd Hi, I took a look at the OpenWRT source repository and the tool you mention looks more like some home grown utility to me. The mtd-utils you've cloned are built by package/utils/mtd-utils/Makefile You may want to sort this out on the OpenWRT mailing list, unless of course the source of that utility has been copied from mkfs.jffs2 at some point and the later happens to have the same issue. See: https://lists.openwrt.org/mailman/listinfo/openwrt-devel Thanks, David ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: mtd 2018-05-18 9:09 ` mtd David Oberhollenzer @ 2018-05-18 9:14 ` Levente [not found] ` <1397936863.163523.1526636992502.JavaMail.zimbra@sigma-star.at> 0 siblings, 1 reply; 6+ messages in thread From: Levente @ 2018-05-18 9:14 UTC (permalink / raw) To: David Oberhollenzer; +Cc: linux-mtd I did this, and the OpenWRT guys directed me here. But thank you for your help anyways. Levente On Fri, May 18, 2018 at 11:09 AM, David Oberhollenzer <goliath@sigma-star.at> wrote: > Hi, > > > I took a look at the OpenWRT source repository and the tool you mention looks more > like some home grown utility to me. > > The mtd-utils you've cloned are built by package/utils/mtd-utils/Makefile > > You may want to sort this out on the OpenWRT mailing list, unless of course the source > of that utility has been copied from mkfs.jffs2 at some point and the later happens > to have the same issue. > > See: https://lists.openwrt.org/mailman/listinfo/openwrt-devel > > > Thanks, > > David ^ permalink raw reply [flat|nested] 6+ messages in thread
[parent not found: <1397936863.163523.1526636992502.JavaMail.zimbra@sigma-star.at>]
* Re: [OpenWrt-Devel] OpenWRT mtd tooling vs mtd-utils [not found] ` <1397936863.163523.1526636992502.JavaMail.zimbra@sigma-star.at> @ 2018-05-18 10:26 ` Jo-Philipp Wich 2018-05-18 11:15 ` David Oberhollenzer 0 siblings, 1 reply; 6+ messages in thread From: Jo-Philipp Wich @ 2018-05-18 10:26 UTC (permalink / raw) To: David Oberhollenzer, Levente, openwrt-devel; +Cc: Richard Weinberger, linux-mtd Hello David, this was actually my fault. I didn't pay close attention and assumed the code to be related to the kernel MTD subsystem. Only now after your mail I realized that it affects the OpenWrt specific formatting utility. I am very sorry for the confusion caused. Kind regards, Jo ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [OpenWrt-Devel] OpenWRT mtd tooling vs mtd-utils 2018-05-18 10:26 ` [OpenWrt-Devel] OpenWRT mtd tooling vs mtd-utils Jo-Philipp Wich @ 2018-05-18 11:15 ` David Oberhollenzer 2018-07-13 9:54 ` Rafał Miłecki 0 siblings, 1 reply; 6+ messages in thread From: David Oberhollenzer @ 2018-05-18 11:15 UTC (permalink / raw) To: Jo-Philipp Wich; +Cc: Levente, openwrt-devel, richard, linux-mtd Thanks for the clarification! Just out of curiosity, is there a specific reason why OpenWRT uses its own formatting utility here instead of using the tools from mtd-utils? ----- Original Message ----- From: "Jo-Philipp Wich" <jo@mein.io> To: "David Oberhollenzer" <goliath@sigma-star.at>, "Levente" <leventelist@gmail.com>, openwrt-devel@lists.openwrt.org Cc: "richard" <richard@sigma-star.at>, "linux-mtd" <linux-mtd@lists.infradead.org> Sent: Friday, May 18, 2018 12:26:48 PM Subject: Re: [OpenWrt-Devel] OpenWRT mtd tooling vs mtd-utils Hello David, this was actually my fault. I didn't pay close attention and assumed the code to be related to the kernel MTD subsystem. Only now after your mail I realized that it affects the OpenWrt specific formatting utility. I am very sorry for the confusion caused. Kind regards, Jo ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [OpenWrt-Devel] OpenWRT mtd tooling vs mtd-utils 2018-05-18 11:15 ` David Oberhollenzer @ 2018-07-13 9:54 ` Rafał Miłecki 0 siblings, 0 replies; 6+ messages in thread From: Rafał Miłecki @ 2018-07-13 9:54 UTC (permalink / raw) To: goliath; +Cc: Jo-Philipp Wich, OpenWrt Development List, linux-mtd, richard, Lev On Fri, 18 May 2018 at 13:16, David Oberhollenzer <goliath@sigma-star.at> wrote: > Thanks for the clarification! > > Just out of curiosity, is there a specific reason why OpenWRT uses its > own formatting utility here instead of using the tools from mtd-utils? It's probably because it includes some features that upstream developers/maintaners would probably find too hacky. In OpenWrt's mtd there is support for some magic deadc0de marker, appending JFFS2 data, handling vendor specific formats like TRX and Seama. ^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2018-07-13 9:54 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-05-18 8:00 mtd Levente
2018-05-18 9:09 ` mtd David Oberhollenzer
2018-05-18 9:14 ` mtd Levente
[not found] ` <1397936863.163523.1526636992502.JavaMail.zimbra@sigma-star.at>
2018-05-18 10:26 ` [OpenWrt-Devel] OpenWRT mtd tooling vs mtd-utils Jo-Philipp Wich
2018-05-18 11:15 ` David Oberhollenzer
2018-07-13 9:54 ` Rafał Miłecki
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox