diff options
author | Daniel Golle <daniel@makrotopia.org> | 2021-01-04 18:05:07 +0000 |
---|---|---|
committer | Daniel Golle <daniel@makrotopia.org> | 2021-01-04 20:55:32 +0000 |
commit | c53b18820756f6f32ad0782d3bf489422b7c4ad3 (patch) | |
tree | ebb145b8f22dee9a9e3b57aab373480a287757fb | |
parent | f415323b7c87d66ab11d89325937d5dae5eb65c9 (diff) | |
download | fstools-c53b18820756f6f32ad0782d3bf489422b7c4ad3.tar.gz |
jffs2reset: support fristboot on unmounted UBI overlay
To erase the overlay partitions on systems using UBIFS overlay,
instead of writing the jffs2-marker, truncating the UBI volume to 0
has the desired effect.
Signed-off-by: Daniel Golle <daniel@makrotopia.org>
-rw-r--r-- | jffs2reset.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/jffs2reset.c b/jffs2reset.c index 2236e38..acff913 100644 --- a/jffs2reset.c +++ b/jffs2reset.c @@ -19,12 +19,14 @@ #include <fcntl.h> #include <dirent.h> +#include <stdint.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <unistd.h> #include <getopt.h> +#include <mtd/ubi-user.h> #include "libfstools/libfstools.h" #include "libfstools/volume.h" @@ -79,6 +81,13 @@ static int jffs2_mark(struct volume *v) return -1; } + if (volume_identify(v) == FS_UBIFS) { + uint64_t llz = 0; + int ret = ioctl(fd, UBI_IOCVOLUP, &llz); + close(fd); + return ret; + } + sz = write(fd, &deadc0de, sizeof(deadc0de)); close(fd); |