Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
patch block.c from openwrt fstools to add support for systems using ubifs instead of mtdblocks
diff --git a/block.c b/block.c
index a1609b4..a68d62a 100644
--- a/block.c
+++ b/block.c
@@ -791,6 +791,19 @@ static int main_hotplug(int argc, char **argv)
return mount_device(find_block_info(NULL, NULL, path), 1);
}
+static int find_block_ubi(char *name, char *part, int plen)
+{
+ // how to look this up? ubinfo? - would be a lot of system calls...
+ if (!strcmp(name, "rootfs"))
+ snprintf(part, plen, "/dev/ubiblock0_0");
+ else if (!strcmp(name, "rootfs_data"))
+ snprintf(part, plen, "/dev/ubi0_1");
+ else
+ return -1;
+
+ return 0;
+}
+
static int find_block_mtd(char *name, char *part, int plen)
{
FILE *fp = fopen("/proc/mtd", "r");
@@ -946,8 +959,11 @@ static int main_extroot(int argc, char **argv)
find_block_mtd("rootfs", fs, sizeof(fs));
if (!fs[0]) {
- ERROR("extroot: unable to locate rootfs mtdblock\n");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.