All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/4] mtd-utils: adding support for lzma in jffs2reader via liblzma
@ 2021-11-09  8:17 Frederic Germain
  2021-11-09  8:17 ` [PATCH 1/4] .gitignore: add new ubiscan utility Frederic Germain
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Frederic Germain @ 2021-11-09  8:17 UTC (permalink / raw)
  To: linux-mtd; +Cc: Frederic Germain

Hi,

This is my first time sending patch, I probably do some things wrong somewhere.

A while ago I, unfortunately, removed a file from my gl-inet 4g openwrt router.
That file is on a jffs2 partition, with LZMA compression.

LZMA support on OpenWRT is activated via a patch which seems never made it to the mainline : jffs2_make_lzma_available.patch.  There might be a problem with the jffs2 integration of LZMA, if it was not integrated into the kernel? The filesystem support should probably be first integrated in the main kernel before these patch in the user tools...

I think openwrt/LEDE is a big use case for jffs2, with maybe a lot of them with LZMA supports (I'm cannot say how much though...)
So it would be cool to have this integrated so people can recover the files they lost.

There are two opensource LZMA libraries that I found on Ubuntu 20.04...
- The source SDK from https://www.7-zip.org/sdk.html . On ubuntu, it's in the p7zip source package, which provides p7zip & p7zip-full package. p7zip-full provides a library, /usr/lib/p7zip/7z.so, but it's not integrated the Linux/GNU way...
- liblzma: from https://tukaani.org/xz/, which integrates an older version of the LZMA SDK provided by www.7-zip.org, but on a standard Linux/GNU library.

It seems LEDE already has patches for mtd-utils, but it seems they integrate source files from www.7-zip.org in a static way.
https://patchwork.ozlabs.org/project/lede/patch/20180330145639.15824-1-hauke@hauke-m.de/

I have to fiddle around to integrate with liblzma, as the low-level decoder is not exposed, but I got help from the XZ project author  https://sourceforge.net/p/lzmautils/discussion/708858/thread/d02ebb9386/

I pushed the patches on https://github.com/fredericgermain/mtd-utils too, main branch. It might just help some people to recover their file anyway.

---
There is also a problem that jffs2reader selects the earliest version of an inode instead of the latest? I've made a patch to take the latest one with data. But I still needed to patch the mtd dump to remove the DIRENT entry that remove the file from the FS. 

Maybe it would be nice that jffs2reader takes inode/version of the file to dump instead of a path? It's easy to get these parameters with jffs2dump.

Best regards,

Frederic Germain (4):
  .gitignore: add new ubiscan utility
  Fix warning about unaligned pointer in jffs2reader
  jffsX-utils: add lzma support on jffs2reader
  find_raw_inode returns latest version with data of inode

 .gitignore                |  1 +
 Makefile.am               |  4 +++
 configure.ac              | 24 +++++++++++++++
 include/linux/jffs2.h     |  2 ++
 include/mtd/jffs2-user.h  |  1 +
 jffsX-utils/Makemodule.am |  2 +-
 jffsX-utils/jffs2reader.c | 63 ++++++++++++++++++++++++++++++++++-----
 7 files changed, 88 insertions(+), 9 deletions(-)

-- 
2.25.1


______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2021-11-09  8:19 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-11-09  8:17 [PATCH 0/4] mtd-utils: adding support for lzma in jffs2reader via liblzma Frederic Germain
2021-11-09  8:17 ` [PATCH 1/4] .gitignore: add new ubiscan utility Frederic Germain
2021-11-09  8:17 ` [PATCH 2/4] Fix warning about unaligned pointer in jffs2reader Frederic Germain
2021-11-09  8:17 ` [PATCH 3/4] jffsX-utils: add lzma support on jffs2reader Frederic Germain
2021-11-09  8:17 ` [PATCH 4/4] find_raw_inode returns latest version with data of inode Frederic Germain

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.