summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Golle <daniel@makrotopia.org>2021-03-19 12:13:33 +0000
committerDaniel Golle <daniel@makrotopia.org>2021-03-19 13:26:49 +0000
commit964d1e3af0e111bad6d393f8a3be702e334c2398 (patch)
tree0161d4c75b79fd4f3173c997f1c7844384507d92
parentd05ad9308e857eb2964a5b71a54748e79453a714 (diff)
downloadfstools-964d1e3af0e111bad6d393f8a3be702e334c2398.tar.gz
partname: allow skipping existing 'rootfs_data' partition
Apparently some devices with eMMC (e.g. ZyXEL NBG6817) got an exsiting GPT partition called 'rootfs_data'. This partition is then selected as rootfs_data eventhough it may not be suitable for that (too small) or serve another purpose (ie. used by vendor firmware). To avoid this, check if the kernel cmdline contains a variable fstools_ignore_partname=1 and if so, skip partname detection of volumes alltogether. Signed-off-by: Daniel Golle <daniel@makrotopia.org>
-rw-r--r--libfstools/partname.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/libfstools/partname.c b/libfstools/partname.c
index 4560125..5d4fde5 100644
--- a/libfstools/partname.c
+++ b/libfstools/partname.c
@@ -85,7 +85,7 @@ static char* get_cmdline_val(const char* name, char* out, int len)
continue;
strncpy(out, &sep[1], len);
- out[len-1] = 0;
+ out[len-1] = '\0';
return out;
}
@@ -120,6 +120,11 @@ static struct volume *partname_volume_find(char *name)
bool found = false;
glob_t gl;
+ if (get_cmdline_val("fstools_ignore_partname", rootparam, sizeof(rootparam))) {
+ if (!strcmp("1", rootparam))
+ return NULL;
+ }
+
if (get_cmdline_val("root", rootparam, sizeof(rootparam))) {
rootdev = rootdevname(rootparam);
/* find partition on same device as rootfs */