Skip to content

Instantly share code, notes, and snippets.

@GeoffWilliams
Created September 27, 2014 12:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save GeoffWilliams/e2ece256608a9f084ae5 to your computer and use it in GitHub Desktop.
Save GeoffWilliams/e2ece256608a9f084ae5 to your computer and use it in GitHub Desktop.
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