Merge "app: aboot: Ability to flash only one volume for UBIFS partitions"
diff --git a/app/aboot/aboot.c b/app/aboot/aboot.c
index 322a5eb..5451150 100644
--- a/app/aboot/aboot.c
+++ b/app/aboot/aboot.c
@@ -2336,6 +2336,30 @@
 	return;
 }
 
+void cmd_updatevol(const char *vol_name, void *data, unsigned sz)
+{
+	struct ptentry *sys_ptn;
+	struct ptable *ptable;
+
+	ptable = flash_get_ptable();
+	if (ptable == NULL) {
+		fastboot_fail("partition table doesn't exist");
+		return;
+	}
+
+	sys_ptn = ptable_find(ptable, "system");
+	if (sys_ptn == NULL) {
+		fastboot_fail("system partition not found");
+		return;
+	}
+
+	sz = ROUND_TO_PAGE(sz, page_mask);
+	if (update_ubi_vol(sys_ptn, vol_name, data, sz))
+		fastboot_fail("update_ubi_vol failed");
+	else
+		fastboot_okay("");
+}
+
 void cmd_flash_nand(const char *arg, void *data, unsigned sz)
 {
 	struct ptentry *ptn;
@@ -2350,7 +2374,9 @@
 
 	ptn = ptable_find(ptable, arg);
 	if (ptn == NULL) {
-		fastboot_fail("unknown partition name");
+		dprintf(INFO, "unknown partition name (%s). Trying updatevol\n",
+				arg);
+		cmd_updatevol(arg, data, sz);
 		return;
 	}
 
diff --git a/include/dev/flash-ubi.h b/include/dev/flash-ubi.h
index 50577cc..679e5ac 100644
--- a/include/dev/flash-ubi.h
+++ b/include/dev/flash-ubi.h
@@ -155,4 +155,9 @@
 };
 
 int flash_ubi_img(struct ptentry *ptn, void *data, unsigned size);
+inline int update_ubi_vol(struct ptentry *ptn, const char* vol_name,
+				void *data, unsigned size)
+{
+	return -1;
+}
 #endif
diff --git a/target/init.c b/target/init.c
index 97809cc..9191572 100644
--- a/target/init.c
+++ b/target/init.c
@@ -59,6 +59,11 @@
     return 0;
 }
 
+__WEAK int update_ubi_vol(void)
+{
+    return 0;
+}
+
 __WEAK int target_is_emmc_boot(void)
 {
 #if _EMMC_BOOT