diff mbox

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

Message ID 1405503532-6415-1-git-send-email-l.majewski@samsung.com
State Rejected
Delegated to: Marek Vasut
Headers show

Commit Message

Łukasz Majewski July 16, 2014, 9:38 a.m. UTC
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(-)

Comments

Stephen Warren July 21, 2014, 4:27 p.m. UTC | #1
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.
Łukasz Majewski July 22, 2014, 8 a.m. UTC | #2
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.
Marek Vasut July 22, 2014, 2:24 p.m. UTC | #3
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
diff mbox

Patch

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