From c53b18820756f6f32ad0782d3bf489422b7c4ad3 Mon Sep 17 00:00:00 2001 From: Daniel Golle Date: Mon, 4 Jan 2021 18:05:07 +0000 Subject: [PATCH] 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 --- jffs2reset.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/jffs2reset.c b/jffs2reset.c index 2236e38..acff913 100644 --- a/jffs2reset.c +++ b/jffs2reset.c @@ -19,12 +19,14 @@ #include #include +#include #include #include #include #include #include +#include #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); -- 2.30.2