Hi,
i am working on a new update for fstools that implements ubi properly
via gluebi. this is a rather large rework and will take another 1-2
weeks till ready.
John
On 26/03/2014 22:31, André Valentin wrote:
> Normally a jffs fs start with a know marker. If ubi is used, the
> partition does not habe such a marker. Just 0xFFFFFFFF. This patch
> checks if the partition is of type ubivol and has 0xFFFFFFFF at
> the beginning. In this case the partition is mounted as a jffs.
>
> Signed-off-by: André Valentin <[email protected]> ---
> .../system/fstools/patches/001-jffs-empty.patch | 87
> ++++++++++++++++++++ 1 file changed, 87 insertions(+) create mode
> 100644 package/system/fstools/patches/001-jffs-empty.patch
>
> diff --git a/package/system/fstools/patches/001-jffs-empty.patch
> b/package/system/fstools/patches/001-jffs-empty.patch new file mode
> 100644 index 0000000..c40cbbf --- /dev/null +++
> b/package/system/fstools/patches/001-jffs-empty.patch @@ -0,0 +1,87
> @@ +diff -uNrp a/backend/base.c b/backend/base.c +---
> a/backend/base.c 2014-03-21 10:15:20.000000000 +0100 ++++
> b/backend/base.c 2014-03-26 11:19:08.000000000 +0100 +@@ -67,6
> +67,12 @@ start(int argc, char **argv) + + switch
> (mtd_identify(mtd)) { + case FS_NONE: ++ if
> (mtd_is_ubivol(mtd))
> { ++ backend_mount("overlay"); ++
> break; ++ } ++ return
> ramoverlay(); ++ + case FS_DEADCODE: + return ramoverlay(); +
> +@@ -101,6 +107,10 @@ done(int argc, char **argv) + + switch
> (mtd_identify(mtd)) { + case FS_NONE: ++ if
> (mtd_is_ubivol(mtd))
> { ++ return jffs2_switch(argc, argv); ++ } ++
> return
> ramoverlay(); + case FS_DEADCODE: + return
> jffs2_switch(argc,
> argv); + } +diff -uNrp a/backend/jffs2.c b/backend/jffs2.c +---
> a/backend/jffs2.c 2014-03-21 10:15:20.000000000 +0100 ++++
> b/backend/jffs2.c 2014-03-26 11:23:58.000000000 +0100 +@@ -309,6
> +309,16 @@ jffs2_switch(int argc, char **argv) + switch
> (mtd_identify(mtd)) { + case FS_NONE: + fprintf(stderr,
> "no
> jffs2 marker found\n"); ++ if (mtd_is_ubivol(mtd)) { ++
> ret =
> jffs2_mount(); ++ if (ret) ++ break; ++
> if
> (mount_move("/tmp", "", "/overlay") || fopivot("/overlay", "/rom"))
> { ++ fprintf(stderr, "switching to jffs2 failed\n"); ++
> ret = -1; ++ } ++ break; ++ } +
> /* fall through */ + +
> case FS_DEADCODE: +diff -uNrp a/lib/mtd.c b/lib/mtd.c +---
> a/lib/mtd.c 2014-03-21 10:15:20.000000000 +0100 ++++ b/lib/mtd.c
> 2014-03-26 11:18:09.000000000 +0100 +@@ -199,3 +199,26 @@
> mtd_identify(char *mtd) + + return FS_NONE; + } ++ ++int
> ++mtd_is_ubivol(char *mtd) ++{ ++ int fd = mtd_load(mtd); ++ struct
> mtd_info_user mtdInfo; ++ ++ if (!fd) { ++ fprintf(stderr,
> "reading %s failed\n", mtd); ++ return -1; ++ } ++ if
> (ioctl(fd,
> MEMGETINFO, &mtdInfo)) { ++ fprintf(stderr, "Could not get MTD
> device info from %s\n", mtd); ++ close(fd); ++ return
> -1; ++ }
> ++ ++ close(fd); ++ if (mtdInfo.type == MTD_UBIVOLUME) { ++ return
> 1; ++ } ++ return 0; ++} +diff -uNrp a/lib/mtd.h b/lib/mtd.h +---
> a/lib/mtd.h 2014-03-21 10:15:20.000000000 +0100 ++++ b/lib/mtd.h
> 2014-03-26 11:18:09.000000000 +0100 +@@ -24,5 +24,6 @@ int
> mtd_unlock(int fd); + int mtd_read_buffer(int fd, void *buf, int
> offset, int length); + int mtd_write_buffer(int fd, void *buf, int
> offset, int length); + int mtd_identify(char *mtd); ++int
> mtd_is_ubivol(char *mtd); + + #endif
>
_______________________________________________
openwrt-devel mailing list
[email protected]
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel