Created
September 27, 2014 12:07
-
-
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
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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