[U-Boot] [PATCH] dfu: fix: Add the absolute path to the file name for ext4 write operation

Lukasz Majewski l.majewski at samsung.com
Wed Jul 16 11:38:52 CEST 2014


Commit 1151b7ac10b81ecbb has cleaned up read and write operations.
Unfortunately, for correct operation the write for ext4 fs requires
absolute patch.
This patch fixes this case.

Signed-off-by: Lukasz Majewski <l.majewski at samsung.com>
---
 drivers/dfu/dfu_mmc.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/dfu/dfu_mmc.c b/drivers/dfu/dfu_mmc.c
index 72fa03e..38aeab0 100644
--- a/drivers/dfu/dfu_mmc.c
+++ b/drivers/dfu/dfu_mmc.c
@@ -117,6 +117,7 @@ static int mmc_file_op(enum dfu_op op, struct dfu_entity *dfu,
 {
 	const char *fsname, *opname;
 	char cmd_buf[DFU_CMD_BUF_SIZE];
+	char *filename = " %s";
 	char *str_env;
 	int ret;
 
@@ -153,7 +154,10 @@ static int mmc_file_op(enum dfu_op op, struct dfu_entity *dfu,
 	if (op != DFU_OP_SIZE)
 		sprintf(cmd_buf + strlen(cmd_buf), " 0x%x", (unsigned int)buf);
 
-	sprintf(cmd_buf + strlen(cmd_buf), " %s", dfu->name);
+	if (dfu->layout == DFU_FS_EXT4 && op == DFU_OP_WRITE)
+		filename = " /%s";
+
+	sprintf(cmd_buf + strlen(cmd_buf), filename, dfu->name);
 
 	if (op == DFU_OP_WRITE)
 		sprintf(cmd_buf + strlen(cmd_buf), " %lx", *len);
-- 
2.0.0.rc2



More information about the U-Boot mailing list