mirror of
https://xff.cz/git/u-boot/
synced 2025-09-01 16:52:14 +02:00
cmd: fat: add offset parameter to fatwrite
In this patch, fatwrite command is extended so as to accept an additional parameter of file offset. Signed-off-by: AKASHI Takahiro <takahiro.akashi@linaro.org> Signed-off-by: Alexander Graf <agraf@suse.de>
This commit is contained in:
committed by
Alexander Graf
parent
cb8af8af5b
commit
cda40b2aea
@@ -104,6 +104,7 @@ static int do_fat_fswrite(cmd_tbl_t *cmdtp, int flag,
|
|||||||
int ret;
|
int ret;
|
||||||
unsigned long addr;
|
unsigned long addr;
|
||||||
unsigned long count;
|
unsigned long count;
|
||||||
|
long offset;
|
||||||
struct blk_desc *dev_desc = NULL;
|
struct blk_desc *dev_desc = NULL;
|
||||||
disk_partition_t info;
|
disk_partition_t info;
|
||||||
int dev = 0;
|
int dev = 0;
|
||||||
@@ -126,9 +127,11 @@ static int do_fat_fswrite(cmd_tbl_t *cmdtp, int flag,
|
|||||||
}
|
}
|
||||||
addr = simple_strtoul(argv[3], NULL, 16);
|
addr = simple_strtoul(argv[3], NULL, 16);
|
||||||
count = (argc <= 5) ? 0 : simple_strtoul(argv[5], NULL, 16);
|
count = (argc <= 5) ? 0 : simple_strtoul(argv[5], NULL, 16);
|
||||||
|
/* offset should be a hex, but "-1" is allowed */
|
||||||
|
offset = (argc <= 6) ? 0 : simple_strtol(argv[6], NULL, 16);
|
||||||
|
|
||||||
buf = map_sysmem(addr, count);
|
buf = map_sysmem(addr, count);
|
||||||
ret = file_fat_write(argv[4], buf, 0, count, &size);
|
ret = file_fat_write(argv[4], buf, offset, count, &size);
|
||||||
unmap_sysmem(buf);
|
unmap_sysmem(buf);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
printf("\n** Unable to write \"%s\" from %s %d:%d **\n",
|
printf("\n** Unable to write \"%s\" from %s %d:%d **\n",
|
||||||
@@ -142,9 +145,9 @@ static int do_fat_fswrite(cmd_tbl_t *cmdtp, int flag,
|
|||||||
}
|
}
|
||||||
|
|
||||||
U_BOOT_CMD(
|
U_BOOT_CMD(
|
||||||
fatwrite, 6, 0, do_fat_fswrite,
|
fatwrite, 7, 0, do_fat_fswrite,
|
||||||
"write file into a dos filesystem",
|
"write file into a dos filesystem",
|
||||||
"<interface> <dev[:part]> <addr> <filename> [<bytes>]\n"
|
"<interface> <dev[:part]> <addr> <filename> [<bytes> [<offset>]]\n"
|
||||||
" - write file 'filename' from the address 'addr' in RAM\n"
|
" - write file 'filename' from the address 'addr' in RAM\n"
|
||||||
" to 'dev' on 'interface'"
|
" to 'dev' on 'interface'"
|
||||||
);
|
);
|
||||||
|
Reference in New Issue
Block a user