target: mdm9635: Append "ubi.mtd" to kernel command line  for ubi filesystem

Dynamically add system partition to command line for yaffs2 and
ubi filesystems.

Change-Id: I85f77cb3dd38d7337075b8c898b6e163d9e98965
Signed-off-by: Smita Solanki <ssolanki@codeaurora.org>
diff --git a/target/mdm9635/init.c b/target/mdm9635/init.c
index 5b2e00c..9409e81 100644
--- a/target/mdm9635/init.c
+++ b/target/mdm9635/init.c
@@ -291,15 +291,25 @@
 	}
 
 	/*
-	 * check if cmdline contains "root=" at the beginning of buffer or
-	 * " root=" in the middle of buffer.
+	 * check if cmdline contains "root="/"ubi.mtd" at the beginning of buffer or
+	 * " root="/"ubi.mtd" in the middle of buffer.
 	 */
-	if (((!strncmp(cmdline, "root=", strlen("root="))) ||
-	     (strstr(cmdline, " root="))))
-		dprintf(DEBUG, "DEBUG: cmdline has root=\n");
-	else
-		snprintf(buf, buflen, " root=/dev/mtdblock%d",
-			 system_ptn_index);
+
+	if (strstr(cmdline, "rootfstype=yaffs2")) {
+		if (((!strncmp(cmdline, "root=", strlen("root="))) ||
+			(strstr(cmdline, " root="))))
+			dprintf(DEBUG, "DEBUG: cmdline has root=\n");
+		else
+			snprintf(buf, buflen, " root=/dev/mtdblock%d",
+					system_ptn_index);
+	} else if (strstr(cmdline, "rootfstype=ubifs")){
+		if (((!strncmp(cmdline, "ubi.mtd=", strlen("ubi.mtd="))) ||
+			(strstr(cmdline, " ubi.mtd="))))
+			dprintf(DEBUG, "DEBUG: cmdline has ubi.mtd=\n");
+		else
+			snprintf(buf, buflen, " ubi.mtd=%d",
+				system_ptn_index);
+	}
 
 	return 0;
 }