diff options
author | Simon Glass | 2013-04-20 08:42:51 +0000 |
---|---|---|
committer | Tom Rini | 2013-05-01 11:17:21 -0400 |
commit | 7eb2c8d573ad932bf67095f11c6b3beba41064f2 (patch) | |
tree | e4f2e0f533ea14d758c09de28c143bbe60c70dbc /common/cmd_sandbox.c | |
parent | a8f6ab5229fb4cd8299df84c8698e128b5125a8e (diff) |
sandbox: fs: Add support for saving files to host filesystem
This allows write of files from the host filesystem in sandbox. There is
currently no concept of overwriting the file and removing its existing
contents - all writing is done on top of what is there. This means that
writing 10 bytes to the start of a 1KB file will only update those 10
bytes, not truncate the file to 10 byte slong.
If the file does not exist it is created.
Signed-off-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'common/cmd_sandbox.c')
-rw-r--r-- | common/cmd_sandbox.c | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/common/cmd_sandbox.c b/common/cmd_sandbox.c index 206a48614da..a28a844ae0e 100644 --- a/common/cmd_sandbox.c +++ b/common/cmd_sandbox.c @@ -32,9 +32,16 @@ static int do_sandbox_ls(cmd_tbl_t *cmdtp, int flag, int argc, return do_ls(cmdtp, flag, argc, argv, FS_TYPE_SANDBOX); } +static int do_sandbox_save(cmd_tbl_t *cmdtp, int flag, int argc, + char * const argv[]) +{ + return do_save(cmdtp, flag, argc, argv, FS_TYPE_SANDBOX, 16); +} + static cmd_tbl_t cmd_sandbox_sub[] = { - U_BOOT_CMD_MKENT(load, 3, 0, do_sandbox_load, "", ""), + U_BOOT_CMD_MKENT(load, 7, 0, do_sandbox_load, "", ""), U_BOOT_CMD_MKENT(ls, 3, 0, do_sandbox_ls, "", ""), + U_BOOT_CMD_MKENT(save, 6, 0, do_sandbox_save, "", ""), }; static int do_sandbox(cmd_tbl_t *cmdtp, int flag, int argc, @@ -56,8 +63,11 @@ static int do_sandbox(cmd_tbl_t *cmdtp, int flag, int argc, } U_BOOT_CMD( - sb, 6, 1, do_sandbox, + sb, 8, 1, do_sandbox, "Miscellaneous sandbox commands", - "load host <addr> <filename> [<bytes> <offset>] - load a file from host\n" - "sb ls host <filename> - save a file to host" + "load host <dev> <addr> <filename> [<bytes> <offset>] - " + "load a file from host\n" + "sb ls host <filename> - list files on host\n" + "sb save host <dev> <filename> <addr> <bytes> [<offset>] - " + "save a file to host\n" ); |