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

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@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);

On 07/16/2014 03:38 AM, Lukasz Majewski wrote:
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.
Shouldn't the user simply supply the absolute patch name as the entity name? That's what I've been doing.
This way, it makes files in sub-directories look more natural; you'd pass in e.g. /boot/zImage rather than boot/zImage, which looks like a relative path.

Hi Stephen,
On 07/16/2014 03:38 AM, Lukasz Majewski wrote:
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.
Shouldn't the user simply supply the absolute patch name as the entity name? That's what I've been doing.
This way, it makes files in sub-directories look more natural; you'd pass in e.g. /boot/zImage rather than boot/zImage, which looks like a relative path.
Hmm.. this is the angle from which I didn't look.
Thanks for the tip. I will adjust envs accordingly. Please discard this patch.

On Tuesday, July 22, 2014 at 10:00:05 AM, Lukasz Majewski wrote:
Hi Stephen,
On 07/16/2014 03:38 AM, Lukasz Majewski wrote:
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.
Shouldn't the user simply supply the absolute patch name as the entity name? That's what I've been doing.
This way, it makes files in sub-directories look more natural; you'd pass in e.g. /boot/zImage rather than boot/zImage, which looks like a relative path.
Hmm.. this is the angle from which I didn't look.
Thanks for the tip. I will adjust envs accordingly. Please discard this patch.
Done.
Best regards, Marek Vasut
participants (3)
-
Lukasz Majewski
-
Marek Vasut
-
Stephen Warren